What this unit solvesMCP (Model Context Protocol) is the standard protocol for connecting external tools and data sources to an agent. You will learn what integration problem MCP solves, how to configure and verify a server, how to evaluate a server by trust level and permission scope, and how it compares to CLI tools and built-ins for each scenario. The goal is a clear, actionable criterion for when to use MCP and when not to.
Learning objectives
- Explain what MCP is, which integration problem it solves, and why a cross-tool protocol is needed.
- Configure and verify a local MCP server (using Claude Code as the primary reference).
- Evaluate whether to introduce a given MCP server based on trust source and permission scope.
- Explain the trade-offs between MCP, CLI, and built-in tools, and know when to prefer CLI (see 04-10).
- Identify the primary MCP attack surfaces and apply minimum-necessary protections (see 03-3).
1. What MCP is
MCP (Model Context Protocol) is an open standard proposed by Anthropic in 2024 that defines how external tools and data sources are called by an LLM. An MCP server exposes three interface types:tools (callable functions), resources (referenceable data), and prompts (executable command templates). Once an MCP client (such as Claude Code, Cursor, Claude Desktop, or Codex) connects, it mounts these interfaces into its own context so the model can call them exactly like built-in tools [1].
The concrete problem it solves: integration fragmentation. If every LLM tool (Claude Code, Cursor, Codex, Antigravity…) had to build its own interface for GitHub, Slack, and Postgres separately, the N x M development and maintenance cost would push integration behind a paywall. MCP compresses that to N+M: a server is written once and reused across multiple clients; a client with built-in MCP capability needs no per-service customization.
Key concepts:
- MCP server: a process or service that exposes
tools,resources, andprompts. Can be a local stdio process (npx server-foo) or a remote HTTP / WebSocket service. - MCP client: the model-side caller. Claude Code has a built-in MCP client; once a server is attached, its tools are mounted under the
mcp__<server>__<tool>namespace. - Transport: the protocol between client and server. Claude Code supports stdio (local process), http (including the
streamable-httpalias, the most widely supported cloud transport), sse (deprecated), and ws (WebSocket, for servers that need to push events) [1].
2. Connecting a server: configure, register, verify
Claude Code offers three installation paths (as of 2026-06, per the official MCP chapter [1]):2.1 Via claude mcp add CLI (most common)
2.2 Three scopes
Where the config is stored and whether it is team-shared is controlled by--scope [1]:
Important security design: project-scope servers (from
.mcp.json) are flagged as pending approval when Claude Code starts and require an interactive review before they activate [1]. This is the protection added after CVE-2025-59536: .mcp.json cannot silently auto-approve unknown servers without the user’s knowledge.
“local scope” and “local settings” are two different thingsMCP local scope is stored in
~/.claude.json; ordinary local settings live in .claude/settings.local.json. The names are similar but the layers are different [1].2.3 Editing .mcp.json directly
For project scope or when you need environment variable expansion:
${VAR} and ${VAR:-default} expansion syntax are supported; an unset variable with no default causes Claude Code to fail when parsing the config [1]. timeout is the hard wall-clock limit per tool call for that server (milliseconds) and can be overridden with the MCP_TIMEOUT environment variable.
2.4 Verifying the connection
After installing, run:1
Confirm the server appears in /mcp
Run
/mcp and confirm the target server shows as connected with the expected tool count.2
Run a simple call
For example, call
mcp__notion__search with a simple query and confirm the model can invoke it and receive a response.3
Confirm the response format matches expectations
Check that the returned data structure matches the server’s documentation; rule out schema version mismatches.
4
Observe the OAuth flow on first call
HTTP servers typically require an initial OAuth authorization. Confirm the scope matches your actual needs — do not accept it wholesale.
3. Choosing a server: trust, permissions, and official status
Before introducing an MCP server, work through these three questions:3.1 Three trust tiers
3.2 Permission scope
Theenv and args the server declares in .mcp.json hint at which resources it requires. Map that to “does this server actually need this?”:
- A server that only runs
grepdoes not need write access. - A server that only queries issues does not need outbound network access.
- A server that simultaneously requires write + outbound network +
~/.sshpaths: maximum alertness.
code.claude.com/docs/en/permissions page provides three-tier allow / deny / ask rules for Bash, Edit, and Read; permission scoping for MCP servers uses mcp__<server>__* tool-level rules [2].
Permission review exampleA server’s Review points: is this the official Slack server? The OAuth scope includes
.mcp.json config:chat:write (can post messages) — does your workflow actually need the agent to post messages automatically? If not, remove chat:write from the scope and add it back only when the need arises [1]. oauth.scopes lets you narrow OAuth permissions to the minimum required (precise scope locking).3.3 MCP servers bundled in plugins
A plugin can package MCP servers inside it [1]. Plugins in theclaude-plugins-official and claude-community marketplaces automatically connect their bundled MCP servers when activated. Review these too: the mcpServers section in the plugin’s .mcp.json or plugin.json is where the server config lives.
4. Trade-offs against CLI and built-in tools
4.1 Decision criteria
4.2 Situations where MCP is the wrong tool
- One-off commands: running
gh pr listvia the Bash tool is sufficient; there is no need to install the GitHub MCP server. - Heavy shell pipelines: multi-step pipelines like
find | xargs grep | sed | jqare handled most directly in the shell; wrapping them as MCP requires splitting into multiple tool calls, each consuming context. - Operations requiring high auditability: CLI commands go into shell history; MCP calls require separate logging configuration.
4.3 Never mix CLI and MCP for the same operation
Mixing is a source of silent bugs: you rungh pr create in the shell while the agent simultaneously calls mcp__github__create_pull_request via MCP — both succeed, and the state is now inconsistent. Pick one path per operation; once you switch to a fallback, do not revert to mixing (see 04-10 for a full treatment).
5. Security boundaries
MCP is a high-leverage integration interface and a high-leverage attack surface. Cross-reference the supply-chain SOP in 03-3 Security, Privacy, and Supply-Chain Risk and 04-7 Plugins; this section covers only what is MCP-specific:5.1 Attack surfaces
5.2 Minimum necessary protections
~/.ssh, ~/.aws, **/.env*) in permissions.deny; log MCP tool calls; review the active server list once per quarter.
5.3 Tool search and context control
Claude Code enables MCP tool search by default: MCP tools are not fully loaded into context at session start but are dynamically discovered by Claude viaToolSearch [1]. This substantially reduces context cost for multi-server setups, but it is not a security mechanism. Connected servers can still be called when the task is relevant to them. For particularly sensitive servers, combine alwaysLoad: false (the default) with a mcp__<server>__* rule in permissions.deny.
6. Tool comparison
Naming and boundaries
- Claude Code has a built-in MCP client; no plugin is required to use MCP servers.
- OpenAI, Antigravity, GitHub Copilot, and Cursor vary in how deeply and on what timeline they support MCP; check each vendor’s current official documentation before adopting.
- SSE transport is marked deprecated in the official documentation; use
httpfor new configurations [1].
Hands-on exercises
30-minute practice
- Get a server running (15 minutes): install
claude mcp add --transport http notion https://mcp.notion.com/mcp(or choose a service you already have an account for, such as Sentry or GitHub). Confirm the status in Claude Code’s/mcpinterface, then run one simple call to verify the connection. - Write a project-scope config (10 minutes): take an operation you currently perform via MCP and move it to
.mcp.jsonunder project scope. On the next Claude Code startup, observe the user-approval dialog and decide whether to approve or reject. - Security scan (5 minutes): run the three
rgscans from this section against~/.claude.jsonand.mcp.json, record every hit, and review each manually.
Common pitfalls
Self-check
The bar for passing this unit
- Can you state the difference between MCP’s three scopes in under a minute, and identify which one triggers user approval?
- Can you list at least three questions to ask when deciding whether to install a given MCP server?
- For the MCP server you currently use (or are considering adding): can you state its trust tier, its declared permission scope, and whether you have verified it only uses those permissions?
- Can you run all three
rgsupply-chain scans before installing a new MCP server?
Sources and further reading
Factual claims are grounded in official documentation; fast-changing items are annotated as of 2026-05.-
[1] Anthropic, “Connect Claude Code to tools via MCP,” code.claude.com, 2026. [Online]. Available: https://code.claude.com/docs/en/mcp (as of 2026-06; covers four transport types, three scopes, OAuth,
headersHelper, tool search,streamable-httpalias, security notice, and theclaude.ai/directoryofficial server directory) -
[2] Anthropic, “Configure permissions,” code.claude.com, 2026. [Online]. Available: https://code.claude.com/docs/en/permissions (as of 2026-06; MCP tool-level
mcp__server__*allow / deny rules and how they compose withBash/Editrules) - [3] Model Context Protocol, “MCP specification,” modelcontextprotocol.io, 2026. [Online]. Available: https://modelcontextprotocol.io (as of 2026-06; official specification home)
- [4] Snyk, “ToxicSkills: 2026 Report on Malicious Skills in the Wild,” snyk.io, 2026. [Online]. Available: https://snyk.io (as of 2026-06; supply-chain risk statistics for Skills / MCP servers)
- [5] OpenAI, “Model Context Protocol,” developers.openai.com, 2026. [Online]. Available: https://developers.openai.com/codex/mcp (as of 2026-06; Codex CLI MCP config.toml location, stdio and Streamable HTTP transport, OAuth and bearer token authentication)
- [6] Google, “MCP servers with Gemini CLI,” google-gemini.github.io, 2026. [Online]. Available: https://google-gemini.github.io/gemini-cli/docs/tools/mcp-server.html (as of 2026-06; settings.json path and mcpServers section, stdio / SSE / HTTP streaming transports)
- [7] GitHub Docs, “Adding MCP servers for GitHub Copilot CLI,” docs.github.com, 2026. [Online]. Available: https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-mcp-servers (as of 2026-06; ~/.copilot/mcp-config.json, stdio / HTTP / SSE transport, GitHub MCP Registry)
- [8] Cursor, “MCP,” cursor.com, 2026. [Online]. Available: https://cursor.com/docs/cli/mcp (as of 2026-06; .cursor/mcp.json and ~/.cursor/mcp.json locations, stdio and Streamable HTTP transport)
- Security: 03-3 Security, Privacy, and Supply-Chain Risk.
- CLI-first principles: 04-10 CLI-first vs. MCP.
- Built-in tool inventory: 04-8 Vendor Built-in Tools.
- MCP servers bundled in plugins: 04-7 Plugins.
- Preloading servers via
mcpServersin a Subagent: 04-5 Subagents. - Enforcement via hooks: 04-6 Hooks.