The Model Context Protocol (MCP) is a standard way to give an AI assistant access to external systems such as GitHub, Linear, Slack, databases, and observability tools. Claude Code, Anthropic's command-line coding agent, can act as an MCP client and call tools that these servers expose.
This article shows how to connect Claude Code to an MCP server, how to choose where the configuration lives, how to authenticate, and what to check before trusting a server.
Adding a Server: Transports and the Basic Command
Most setups use one command: claude mcp add. You give it a transport, a name, and either a server URL or a launch command. The transport describes how Claude Code talks to the server.
- HTTP: a remote server reached by URL. This is the usual choice for hosted services.
- SSE (Server-Sent Events): an older style of remote server, still supported by some providers.
- stdio: a local program that Claude Code launches and talks to through standard input and output.
Remote HTTP server
For a hosted server, pass --transport http, a name of your choice, and the URL:
claude mcp add --transport http notion https://mcp.notion.com/mcpRemote SSE server
If a provider only offers SSE, change the transport:
claude mcp add --transport sse asana https://mcp.asana.com/sseLocal stdio server
For a local server, put the launch command after a -- separator. Everything after it is the command Claude Code will run. A filesystem server is a common example:
claude mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem /path/to/projectThe -- matters: it separates Claude Code's own options from the options of the server program.
Scopes, Project Files, and Authentication
Claude Code stores each server in one of three scopes: local, project, or user. Local is the default and keeps the server private to you in the current project. User scope makes it available across all your projects. Project scope writes the server into a .mcp.json file at the project root, which you can commit so the whole team shares it.
claude mcp add --transport http --scope project notion https://mcp.notion.com/mcpYou can also create .mcp.json by hand instead of running the command. A minimal file for a remote server looks like this:
{
"mcpServers": {
"notion": {
"type": "http",
"url": "https://mcp.notion.com/mcp"
}
}
}OAuth and static tokens
Many remote servers use OAuth, a sign-in flow that grants access without sharing your password. After adding such a server, start Claude Code and run /mcp inside the session. It shows each server's status and lets you complete the browser-based sign-in.
Some servers instead use a static token passed in a header or an environment variable. One caveat: Claude Code saves the configuration without validating the credentials. A wrong token will not fail when you add the server; it appears later as a connection failure.
Verifying, Managing, and Trusting Servers
To confirm a server works, use either of these:
claude mcp listfrom your terminal, to see configured servers./mcpinside a Claude Code session, to see live status and handle authentication.
If you see a server marked as connected, its tools are available to Claude in that session. If it is not, check the URL, the launch command, and any token first.
You may also see servers that come from your Claude.ai account, known as connectors. If you do not want them in Claude Code, you can turn them off with the disableClaudeAiConnectors setting or by setting the environment variable ENABLE_CLAUDEAI_MCP_SERVERS=false.
Trust and security
Connecting a server is a trust decision. Anthropic's documentation advises verifying that you trust each server, because one that fetches external content can expose you to prompt injection: hidden instructions in fetched data that try to steer the model.
Researchers have also framed third-party MCP servers as software supply-chain dependencies. In practice, that means treating them like any package you install:
- Prefer servers from vendors or maintainers you recognise.
- Review what a local stdio command will actually execute on your machine.
- Grant the narrowest credentials the task needs.
- Be careful when committing a project-scoped
.mcp.json, since teammates will be prompted to use the same servers.
Conclusion
Connecting Claude Code to an MCP server comes down to a single claude mcp add command, or a shared .mcp.json file, followed by a check with /mcp or claude mcp list. Choose HTTP for hosted services, stdio for local programs, and a scope that matches who should use the server.
The technical steps are quick; the harder part is judgement. Each server expands what the agent can reach, so add only those you trust and give them only the access they need.
