MCP security
How to connect an AI agent to onefold safely, and what the connection can never reach.
A connection you make by signing in lets an AI agent act as you, and an organization agent acts as one of your organization's roles. Treat either with the same care as your own access to the developer portal.
Prefer sign-in
When your client supports it, sign in. No secret is pasted into a file, the consent screen shows what you are granting, the token lasts 15 minutes, and one click in the portal ends it. Use an agent credential only where sign-in is not possible.
Treat an agent credential as a secret
- Keep it out of source code and out of any file you commit. Read it from an environment variable or your client's secret input where the client offers one.
- Give each machine or job its own credential, so you can revoke one without stopping the others.
- It is shown once. If you are not sure where a copy went, revoke it and create another.
- Give it an expiry. Your organization can cap how long every credential lives; see Credential lifetime.
Grant the least that does the job
- If the agent only needs to inspect, choose Read. See Scopes and permissions.
- If it works on one application, choose that application on the consent screen rather than every application.
- A connection can do what your role allows on each application and organization, and no more. Connecting from an account with a narrower role narrows the agent too.
- For an organization agent, create it on the application's Agents tab when it needs one application, and pick the narrowest role that does the job.
- Tick Read and write user metadata only for an agent that needs it. With it, a leaked credential reads and replaces the metadata your application keeps on every person who authorized it.
Disconnect what you no longer use
Review the Agents tab of your applications and organizations now and then. Each entry shows what it acts as, what it may do, and its credentials with their expiry and last use. Disconnect or Revoke anything you do not recognise or no longer need; it takes effect at once.
What the platform enforces
- PKCE on every sign-in. An authorization code is useless without the verifier the client
kept. Only
S256is accepted. - A token for one server. A token issued for the MCP server is refused by every other onefold endpoint, and a token issued for anything else is refused by the MCP server.
- Exact redirect matching. A code is sent only to a redirect URI the client's published metadata lists. Only the port may differ, and only on a loopback address.
- The issuer on every callback. The
issparameter lets a client refuse a code from a server it did not ask. - Immediate revocation. A disconnected client's access token and refresh token are both refused from that moment.
- Rotating refresh tokens. A refresh token is replaced each time it is used, and reusing an old one ends the whole chain. See Keep users signed in.
- Your approval for what matters. A change the portal asks you to verify, or one that moves money, is made only after you open the agent's link, verify it is you and approve. The link lasts 30 minutes, opens only for you, and closes when the agent is revoked. See Changes you approve.
- Images as data. An upload carries the image inside the call. No tool fetches a URL, and an image goes through the same checks as one uploaded in the portal.
- A record of what happened. Every change an agent makes is on the application's Activity tab, marked as made by an agent. The arguments of a tool call are never stored.
What a connection can never reach
- Anything about an account: a password, an email address, sessions, two-factor or passkeys.
- More about a person than they disclosed to your application. Somebody admitted who has not authorized it appears as an ID alone, and a pending invitation as the address you invited.
- A secret after the call that created it. A client secret, API key or webhook signing secret is returned once.
- A new credential for itself. A connection can create credentials only for the organization agents it created, and never one that reaches further than its own grant.
- Anything after it ends. Revoking an agent or disconnecting a connection also revokes every API key and agent it created, and revoking one credential revokes the API keys that credential created.
What the platform does not do
It does not review what your agent decides to do with the tools. A write-capable connection can delete an application, revoke an API key, block a person from an application or invite one if the agent calls that tool and its grant and your role allow it. Many clients ask you to approve each tool call; keep that on for tools that change things.
What ends a connection
A connection made by signing in ends, with every API key and agent it created, when:
- you, or a member with Manage agents and their credentials, disconnect it;
- you revoke the client's access to your account;
- you reset your password through Forgot password?, or the platform's operators set a password for your account;
- your account is disabled;
- you leave an organization, for that organization's applications: the connection loses its reach there, and the keys and agents it created there are revoked.
Changing your password from the Security page, where you enter the current one, leaves your connections working. Organization agents act as a role, not as a person, so none of these end them. See Agent credentials for what ends an organization agent.