~/academy $ claude learn mcp-in-claude-code
Connect MCP servers to Claude Code
Add an MCP server to Claude Code with claude mcp add, choose local, project or user scope, sign in with /mcp, keep tokens out of git and stay safe. 8 min
Watch it done: connect your first MCP server to Claude Code
Step 1 of 7
Open a terminal in a project folder. You add servers from your normal terminal, not inside a Claude Code session.
- Open a terminal in a project folder. You add servers from your normal terminal, not inside a Claude Code session. Type: cd ~/projects/my-app.
- Add the Claude Code documentation server. It is hosted at a URL and needs no sign-in, so it is a safe first server. With no --scope it is saved at local scope: just you, just this project. Type: claude mcp add --transport http claude-code-docs https://code.claude.com/docs/mcp. It confirms with a line starting "Added HTTP MCP server claude-code-docs" and ending "to local config", then a File modified: line naming the file it wrote.
- Check the connection. Needs authentication means a sign-in is due; Failed to connect means the server did not answer. Type: claude mcp list. claude-code-docs appears in the list with the status ✔ Connected.
- Start Claude Code. Connected servers load into the session automatically. Type: claude.
- Ask Claude to use the server by name. Normally Claude picks tools on its own; naming it here makes the test go through the new server. Type: Use the claude-code-docs server to look up what MCP_TIMEOUT does. Approve the tool the first time Claude calls it. The tool call in the reply is labelled with the server name, which shows the answer came from the server.
- See every server from inside a session. For a server that needs a login, choose it here and follow the steps in your browser. Type: /mcp. A list of your servers and their status opens. This is also where you sign in to servers that use a browser login.
- Back in your shell (type /exit to leave Claude Code), remove the server when you are done. Each connected server takes up context in every session, so remove ones you no longer use. Type: claude mcp remove claude-code-docs. It prints: Removed MCP server "claude-code-docs" from local config. A File modified: line follows, naming the file it updated.
Commands from the official Claude Code MCP quickstart and MCP docs, checked 18 November 2026. Lines marked Note describe what happens and are not real output.
$ Read
Two kinds of server
An MCP server gives Claude extra tools: search your issue tracker, query a database, drive a browser. Remote servers are hosted at a URL and use the http transport. Local servers are programs Claude Code starts on your machine, using the default stdio transport. The older SSE transport is deprecated.
You add servers from your normal terminal, not inside a session. For a local server, everything after -- is the command that starts it, passed through untouched.
claude mcp add --transport http notion https://mcp.notion.com/mcp
claude mcp add playwright -- npx -y @playwright/mcp@latest
claude mcp list claude mcp get notion claude mcp remove notion
Lesson notes: Connect MCP servers to Claude Code
Everything in this lesson as text, for revision or to read without the interactive steps. By the end you will be able to: You connect a safe MCP server, check it is working, and know which scope and sign-in method to use for real ones.
Step 1 of 6 · Read
Two kinds of server
An MCP server gives Claude extra tools: search your issue tracker, query a database, drive a browser. Remote servers are hosted at a URL and use the
httptransport. Local servers are programs Claude Code starts on your machine, using the defaultstdiotransport. The older SSE transport is deprecated.You add servers from your normal terminal, not inside a session. For a local server, everything after
--is the command that starts it, passed through untouched.Remote server claude mcp add --transport http notion https://mcp.notion.com/mcp
Local server claude mcp add playwright -- npx -y @playwright/mcp@latest
Manage claude mcp list claude mcp get notion claude mcp remove notion
Step 2 of 6 · Try it in the terminal
Add a safe first server
The Claude Code documentation has its own hosted MCP server at https://code.claude.com/docs/mcp. It needs no sign-in and only searches public docs. Add it over HTTP with the name claude-code-docs.
Hint: claude mcp add, then --transport http, then the name, then the URL.
Show the command
$ claude mcp add --transport http claude-code-docs https://code.claude.com/docs/mcp Added HTTP MCP server claude-code-docs with URL: https://code.claude.com/docs/mcp to local config File modified: /home/you/.claude.json
Step 3 of 6 · Read
Scopes: who gets the server
local (the default): only you, only this project, stored in
~/.claude.json. project: everyone who clones the repository, stored in.mcp.jsonat the project root, which you commit. user: only you, in every project, also in~/.claude.json. Pick one with--scope.If the same name exists in more than one scope, local wins, then project, then user. To change scope, remove the server and add it again with the new
--scope.The first time a teammate opens a project with servers in
.mcp.json, Claude Code asks them to approve each one, so a cloned repository cannot quietly start programs.claude mcp reset-project-choicesbrings the prompt back if they dismissed it.Step 4 of 6 · Read
Signing in without leaking tokens
Many hosted servers (Sentry, Linear, Notion) use a browser sign-in. Add the server, start a session, run
/mcp, choose the server and pick Authenticate. You can also runclaude mcp login <name>from your shell.Servers that use a fixed token take it as a header:
--header "Authorization: Bearer <token>". Never write a real token into.mcp.json. That file is committed. Use an environment variable instead, which Claude Code expands when it loads the file..mcp.json (safe to commit) { "mcpServers": { "api-server": { "type": "http", "url": "https://api.example.com/mcp", "headers": { "Authorization": "Bearer ${API_KEY}" } } } }Step 5 of 6 · Read
Stay safe with servers
Only connect servers you trust. Connectors in the Anthropic Directory are reviewed; for anything else, check who runs the server before you connect it. A server that fetches outside content, such as web pages or tickets, can carry prompt injection: text written to steer Claude.
MCP tools are named
mcp__<server>__<tool>, so normal permission rules apply to them.mcp__github__*in a deny list blocks every tool from that server. Each connected server also puts its tool names into every session's context, so remove the ones you no longer use.Step 6 of 6 · Quiz
Check your understanding
Your team should all get the same issue-tracker server when they clone the repo. Which command?
- claude mcp add --scope project --transport http tracker https://tracker.example.com/mcp
- claude mcp add --scope user --transport http tracker https://tracker.example.com/mcp
- The same command with no --scope
- Paste the server URL into CLAUDE.md
Show the answer
claude mcp add --scope project --transport http tracker https://tracker.example.com/mcp Project scope writes .mcp.json at the root. Commit it and each teammate approves the server on first use.