Learn · Tool design & MCP · CCAR-F task 2.4
MCP servers in Claude Code and agents
Connect tools and data once with MCP: transports, scopes, .mcp.json with env vars, tool names and where MCP fits in the SDK and API.
Key ideas
- MCP roles: host (the AI app), one client per server, and servers exposing tools, resources and prompts.
- Transports: stdio for local subprocesses, HTTP for remote servers; SSE is deprecated.
- Scopes: local (default, ~/.claude.json), project (.mcp.json, shared), user (~/.claude.json, all projects).
- Keep secrets out of .mcp.json with ${VAR} or ${VAR:-default} expansion.
- MCP tools are named mcp__server__tool; use that in permission rules such as mcp__github__*.
- Prefer existing community servers; expose catalogues as resources; fix the description if Claude ignores your tool.
- MCP output is capped at 25,000 tokens by default in Claude Code (MAX_MCP_OUTPUT_TOKENS).
Worked example: Team server plus personal server
The team's GitHub server lives in the repo's .mcp.json with ${GITHUB_TOKEN}; a developer's experimental server is added at user scope in ~/.claude.json. Both connect in the same session, and their tools are discovered at connect time.
Exam traps
- Committing an API token in .mcp.json instead of using ${VAR} expansion.
- Building a custom server for a standard integration that already has a community server.
- Thinking project and user servers are mutually exclusive; all scopes load together.
- Assuming the Messages API MCP connector supports local servers or resources; it is remote and tools only.
Official docs
Practise CCAR-F questions · Next lesson: Explicit criteria beat vague instructions