MCP authentication and security basics
An MCP server acts on your accounts with whatever access you give it, and an AI agent decides when to call it. A few habits make that safe: choose the right kind of credential, grant as little as possible, keep secrets out of shared files and review what the agent does.
The three ways servers authenticate
- No authentication. Public documentation and search servers often need nothing. They are safe to try because they cannot reach your accounts, but your queries still go to the provider.
- OAuth. The client sends you to the provider's sign-in page, you approve the access it requests, and the client stores a token it can refresh. You never handle a secret. MCP's authorization specification is built on OAuth 2.1, and most vendor-hosted servers in this registry use it.
- API keys and tokens. You create a key in the provider's dashboard and give it to the server, through an environment variable for local servers or a header for remote ones. These keys are often long-lived and easy to leak, so they need the most care.
When a server offers both OAuth and a key, prefer OAuth for interactive use. Keep keys for automation, where nobody is present to complete a browser sign-in.
Grant the least access that works
- Create keys with narrow scopes. Most providers let you limit a token to particular repositories, projects or permissions. A token that can only read issues cannot delete a repository.
- Use read-only modes while you evaluate a server. Several listings support them, for example MongoDB's
--readOnlyflag, Supabase'sread_only=trueURL parameter and Linear's read-only endpoint. - Point database and cloud servers at development or sandbox environments first, and use dedicated database users or service accounts with limited roles.
- Turn off tools you don't need. Claude Desktop connectors and VS Code let you disable individual tools, and Codex's
enabled_toolsanddisabled_toolssettings limit which tools the agent can see.
Keep secrets out of shared files
Configuration files are easy to commit, sync or paste into a chat. Treat any file that contains a real key as a secret, and prefer configurations that refer to a secret instead of containing it:
- Cursor resolves
${env:NAME}inmcp.json, so the file can name a variable instead of holding its value. - VS Code's
inputsprompt for a value once and store it securely; the registry's VS Code examples use them for every credential. - Claude Code expands
${VAR}in a project's.mcp.json, and Codex'sbearer_token_env_varandenv_http_headersread tokens from the environment. - The registry's JSON examples mark every value you must supply with
REPLACE_WITH_..., and its command-line examples read keys from shell variables such as"$BRAVE_API_KEY".
If a key ends up in a commit or a shared file, revoke it in the provider's dashboard and create a new one. Deleting the file is not enough.
Review what the agent does
All the clients covered here ask before running an MCP tool by default and can show the arguments the agent wants to send. Keep that on for tools that write, delete, spend money or send messages, and read the arguments rather than approving by habit. Automatic approval is reasonable for read-only tools you trust, or for a local server running in VS Code's sandbox.
Be aware of prompt injection. Tools return text from web pages, issues, emails and documents, and that text can contain instructions aimed at the agent, such as asking it to call another tool with your data. A server can be completely honest and still pass on malicious content. Approval prompts, narrow permissions and not connecting high-value accounts to agents that also read untrusted content are the practical defences.
Local server risks
A local server is code running with your privileges. The MCP security guidance warns that a malicious or compromised local server, or a startup command hidden in a shared configuration, can run anything your account can. Install servers from their official sources, read a repository's MCP configuration before trusting the workspace, and be cautious with one-line installs from unknown publishers. Clients add guardrails here: Claude Code asks you to approve project-scoped servers, VS Code ties workspace servers to Workspace Trust, and Codex only reads project configuration in trusted projects.
What good servers do on their side
If you build or choose a server, the specification's security guidance lists some things to look for. A server should accept only tokens issued for it, and should not pass a client's token through to another API. A proxy server should get your consent before it relays an authorization. Remote servers should protect sessions against hijacking, and servers that fetch URLs on your behalf should guard against server-side request forgery. Vendor-hosted servers from the provider of the underlying API, like most new listings in this registry, are usually the safest choice for this reason.
A short checklist
- Use the official server from the vendor, remote with OAuth if it exists.
- Grant the narrowest scope, and start in read-only mode or a sandbox.
- Keep keys in environment variables or prompted inputs, never in committed files.
- Keep tool approval on for anything that writes, and read the arguments.
- Remove servers you no longer use; Claude Code also deletes their stored OAuth tokens when you do.
Every registry listing names the credential or sign-in it needs. Start with the guide for your client: Claude Code and Codex CLI, Cursor, VS Code or Claude Desktop.
More setup guides
Sources
This guide was written from the official documentation below and last reviewed on 12 October 2026. Client interfaces change often; when a menu or file name here differs from what you see, the upstream documentation wins. Report a correction through the contact page.