MCP Server Integration
Building and connecting MCP servers for Claude Code and the Anthropic ecosystem. Project-level vs user-level configuration, environment variable expansion for secrets, tool discovery at connection time, MCP resources for content catalogs, and choosing community servers vs custom implementations.
Quick Reference
- →Project-scoped config: .mcp.json in repo root -- shared with the team via git
- →User-scoped config: ~/.claude.json -- personal/experimental servers, not committed
- →Environment variables expand at runtime: ${GITHUB_TOKEN} in .mcp.json reads from your shell env
- →NEVER commit secrets in .mcp.json -- always use env var expansion
- →All MCP tools are discovered at connection time -- the client queries the server's tool list
- →MCP resources expose read-only content catalogs (documentation, templates, schemas) to Claude
- →Community MCP servers exist for GitHub, Jira, Slack, Postgres, and 50+ other integrations
- →Build custom MCP servers only for team-specific internal APIs -- don't reinvent standard integrations
- →Enhance tool descriptions on community servers if the defaults are too minimal
- →MCP servers run as local processes (stdio transport) or remote services (SSE/HTTP transport)
What Is MCP and Why It Matters
The Model Context Protocol (MCP) is an open protocol that standardizes how AI applications connect to external tools and data sources. Instead of building custom integrations for every tool, MCP provides a universal interface: servers expose tools and resources, clients (like Claude Code or Claude Desktop) discover and use them. Think of it as USB for AI tools -- one protocol, any tool, any client.
MCP servers expose tools via stdio/SSE, configured per-project or per-user
When Claude Code starts up with MCP servers configured, it connects to each server and queries its available tools. These tools then appear alongside built-in tools (Read, Write, Edit, Bash, Grep, Glob) and Claude can call them in the same way. The user does not need to know whether a tool is built-in or provided by an MCP server -- it is all seamless.
MCP is an open protocol adopted by multiple AI tools. An MCP server you build for Claude Code also works with other MCP-compatible clients. This is important for the exam -- MCP is a protocol standard, not an Anthropic-proprietary feature.