Comprehensive guide11 min read

MCP: Model Context Protocol

SFEIR Instituteβ€’

TL;DR

The Model Context Protocol (MCP) is an open standard that connects Claude Code to external tools - GitHub, browsers, databases - via lightweight servers. This guide shows you how to configure, secure, and leverage MCP servers to transform your agent into a development hub capable of interacting with your entire technical ecosystem. Check out the [MCP quickstart](/en/claude-code/claude-code-mcp-model-context-protocol/quickstart) to get started in 5 minutes.

The Model Context Protocol (MCP) is an open standard that connects Claude Code to external tools - GitHub, browsers, databases - via lightweight servers. This guide shows you how to configure, secure, and leverage MCP servers to transform your agent into a development hub capable of interacting with your entire technical ecosystem. Check out the MCP quickstart to get started in 5 minutes.

The Model Context Protocol (MCP) is a standardized protocol created by Anthropic that allows Claude Code to call external tools through a unified interface. MCP supports three transport modes - stdio, SSE, and HTTP streamable - and provides access to an ecosystem of over 200 community servers. MCP was designed to solve the fragmented integration problem between language models and development tools.

How does the Model Context Protocol (MCP) work?

MCP is an abstraction layer between Claude Code and your external tools. Each MCP server exposes a set of "tools" that the agent can invoke during an interactive session or in headless and CI/CD mode.

The protocol follows a client-server model. Claude Code acts as the MCP client. The MCP server encapsulates the access logic for a resource - GitHub API, Playwright browser, Brave search engine.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     JSON-RPC      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Claude Code  β”‚ ◄──────────────► β”‚  MCP Server   β”‚
β”‚  (client)     β”‚   stdio/SSE/HTTP β”‚ (e.g. GitHub) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

In practice, an MCP server receives JSON-RPC requests and returns structured results. The average response time ranges between 50 and 300 ms depending on the server and network latency.

ComponentRoleExample
MCP ClientSends tool requestsClaude Code v1.0+
MCP ServerExposes tools via JSON-RPC@modelcontextprotocol/server-github
TransportCommunication channelstdio, SSE, HTTP streamable
ToolSingle exposed actioncreate_issue, search_code, navigate

Each tool has a typed input/output schema. Claude Code reads this schema at session startup and knows how to format its calls.

Key takeaway: MCP standardizes communication between Claude Code and any external tool via a JSON-RPC protocol with three transport modes.

What are the three available MCP transport modes?

MCP offers three transports to connect Claude Code to a server. The choice depends on your architecture and network constraints. For a detailed comparison, check the MCP cheatsheet.

stdio transport

The stdio mode launches the server as a child process. Claude Code communicates via stdin/stdout. This is the default mode and the simplest to configure.

claude mcp add github-server -- npx -y @modelcontextprotocol/server-github

This transport offers latency under 10 ms since there is no network layer. It is suitable for Node.js or Python servers running locally.

SSE transport (Server-Sent Events)

The SSE mode connects Claude Code to a remote server via HTTP. Use this transport for shared team servers or servers hosted on a dedicated machine.

claude mcp add --transport sse analytics-server https://mcp.example.com/sse

The SSE connection maintains a unidirectional stream from server to client. Client requests go through standard HTTP POST calls. Typical latency is 100 to 500 ms.

HTTP streamable transport

Since the MCP 2025-03 specification, the HTTP streamable transport is gradually replacing SSE. It uses a single HTTP endpoint with bidirectional streaming.

claude mcp add --transport http my-server https://mcp.example.com/mcp
TransportLatencyUse caseAuthentication
stdio< 10 msLocal developmentToken in env variable
SSE100-500 msShared remote serverHTTP Bearer header
HTTP streamable80-400 msProduction, cloud APIOAuth 2.0, API key

Key takeaway: choose stdio for local, SSE or HTTP streamable for remote servers - HTTP streamable transport is the recommended standard in 2026.

How to add and configure an MCP server in Claude Code?

Open your terminal and use the claude mcp add command to register a server. Claude Code stores the configuration in the .claude/settings.json file or in ~/.claude/settings.json for global scope.

Quick command-line setup

# Add a GitHub server with token
claude mcp add github -- npx -y @modelcontextprotocol/server-github

# Add a server with environment variables
claude mcp add --env GITHUB_TOKEN=ghp_xxxx github -- npx -y @modelcontextprotocol/server-github

# List configured servers
claude mcp list

# Remove a server
claude mcp remove github

Configuration via JSON file

For a versioned configuration with your project, create a .mcp.json file at the root of the repository. This file is automatically read by Claude Code at startup.

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "${GITHUB_TOKEN}"
      }
    },
    "brave-search": {
      "command": "npx",
      "args": ["-y", "@anthropic/mcp-server-brave-search"],
      "env": {
        "BRAVE_API_KEY": "${BRAVE_API_KEY}"
      }
    }
  }
}

the ${VAR} syntax in the .mcp.json file resolves variables from your shell environment. In practice, you store secrets in a .env file that you add to .gitignore.

Configuration scope follows three levels: project (.mcp.json), user (~/.claude/settings.json), and system. The project level takes priority. Check the complete MCP tutorial for a step-by-step guide for each method.

Key takeaway: the claude mcp add command registers a server in one line - for team projects, version a .mcp.json file at the root of the repository.

How to use MCP tools during a Claude Code session?

Once the MCP server is added, its tools are available in your session. Launch Claude Code and verify the connection with the /mcp command.

# Start Claude Code
claude

# In session, check MCP servers
/mcp

Claude Code displays the list of connected servers and their tools. You do not need to call the tools manually - the agent invokes them when the context requires it.

Practical usage examples

Here is how Claude Code uses MCP tools in real-world situations. If you are just getting started, the first conversations guide helps you understand basic interactions.

Code search with GitHub MCP:

You: "Find all files that import the auth module in the frontend repo"
Claude Code β†’ calls mcp__github__search_code({query: "import auth", repo: "org/frontend"})

Web navigation with Playwright MCP:

You: "Go to Stripe's pricing page and extract the rates"
Claude Code β†’ calls mcp__playwright__navigate({url: "https://stripe.com/pricing"})
           β†’ calls mcp__playwright__screenshot()

Issue creation with GitHub MCP:

You: "Create an issue to track the SSL connection bug"
Claude Code β†’ calls mcp__github__create_issue({title: "SSL connection bug", body: "..."})

Each MCP call requires your explicit approval. Claude Code displays the tool name and its parameters before execution. You can authorize a tool permanently via session permissions.

ActionMCP ToolServerAverage time
Search codesearch_codeGitHub200 ms
Create an issuecreate_issueGitHub350 ms
Read a remote fileget_file_contentsGitHub180 ms
Capture a pagescreenshotPlaywright1200 ms
Web searchweb_searchBrave Search400 ms

In practice, 80% of MCP calls resolve in under 500 ms for local stdio servers.

Key takeaway: MCP tools are invoked automatically based on context - verify the connection with /mcp and control each call via the permissions system.

How to secure your MCP servers?

MCP security rests on three pillars: permissions, secrets, and isolation. Configure these elements before sharing your configuration with a team. For detailed best practices, check the MCP checklist.

Permission management

Claude Code applies a three-level permission system for MCP tools:

  1. Systematic prompt - the tool asks for confirmation on every call (default)
  2. Session authorization - you approve once for the entire session
  3. Permanent authorization - the tool is added to the allowlist in settings

Verify the scope of each authorization. A create_issue tool on GitHub deserves manual validation. A read-only search_code tool can be authorized per session.

Secret protection

Never store tokens in plain text in .mcp.json. Here are the recommended methods:

# Method 1: environment variable
export GITHUB_TOKEN=ghp_your_token
claude mcp add github -- npx -y @modelcontextprotocol/server-github

# Method 2: reference in .mcp.json + .env file
echo "GITHUB_TOKEN=ghp_your_token" >> .env
echo ".env" >> .gitignore

73% of secret leaks in open-source projects come from unprotected configuration files, according to GitGuardian (2025). Run git diff --cached before each commit to verify the absence of tokens.

Network isolation

For remote MCP servers (SSE, HTTP), configure a proxy or VPN if your data is sensitive. The stdio transport offers native isolation since it does not traverse the network.

Integration with Git via Claude Code lets you version your MCP configuration while excluding sensitive files through .gitignore rules.

Key takeaway: protect your secrets with environment variables, use the granular permission system, and audit each tool before permanent authorization.

The MCP ecosystem has over 200 servers as of February 2026. Here are the three most adopted servers by developers, based on npm statistics.

GitHub MCP Server

The @modelcontextprotocol/server-github server exposes 15 tools covering issues, pull requests, files, and search. It is maintained by Anthropic. In practice, 92% of Claude Code users with MCP enabled activate this server first.

claude mcp add github -e GITHUB_TOKEN=ghp_xxx -- npx -y @modelcontextprotocol/server-github

Brave Search MCP Server

Brave Search MCP provides access to web search directly from Claude Code. The server returns structured results with titles, URLs, and snippets. Responses arrive in 400 ms on average.

claude mcp add brave -e BRAVE_API_KEY=BSA_xxx -- npx -y @anthropic/mcp-server-brave-search

Playwright MCP Server

Playwright MCP turns Claude Code into a web navigation agent. It can open pages, click, fill forms, and capture screenshots. To dive deeper into agentic coding, this server is essential.

claude mcp add playwright -- npx -y @anthropic/mcp-server-playwright
ServerExposed toolsDownloads/monthPrimary use case
GitHub15 tools180,000+Code management, issues, PRs
Brave Search3 tools95,000+Structured web search
Playwright12 tools120,000+Navigation, scraping, testing
Filesystem8 tools75,000+File read/write
PostgreSQL6 tools45,000+Database queries

To resolve connection issues with these servers, check the MCP troubleshooting guide. The MCP tips will help you optimize performance.

Key takeaway: GitHub, Brave Search, and Playwright form the essential trio of MCP servers - install them first to cover 90% of development needs.

How to create your own MCP server?

You can create a custom MCP server in fewer than 50 lines of code. The official SDK @modelcontextprotocol/sdk (version 1.12 as of February 2026) provides the necessary primitives.

Minimal TypeScript server

import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

const server = new McpServer({
  name: "my-server",
  version: "1.0.0"
});

server.tool("hello", { name: "string" }, async ({ name }) => ({
  content: [{ type: "text", text: `Hello ${name}` }]
}));

const transport = new StdioServerTransport();
await server.connect(transport);

Save this file then add the server to Claude Code:

claude mcp add my-server -- npx tsx my-server.ts

SFEIR Institute offers a dedicated one-day Claude Code training where you build your own MCP servers during hands-on labs. You will learn to connect Claude Code to your internal APIs and business databases.

To go further, the two-day AI-Augmented Developer training covers MCP integration in complete CI/CD workflows, with exercises on GitHub Actions and automated test pipelines.

If you already master the basics, the one-day AI-Augmented Developer - Advanced training dives deeper into creating multi-tool MCP servers, agent orchestration, and advanced prompt engineering patterns.

Key takeaway: the official MCP SDK lets you create a custom server in fewer than 50 lines - test your server locally with the stdio transport before any deployment.

What common problems arise with MCP and how to solve them?

The most frequent MCP errors involve connection, authentication, and timeouts. Check the MCP FAQ for recurring questions.

The server does not start

Verify that Node.js 22+ is installed and the npm package is accessible. In practice, 60% of startup errors come from a Node.js version below 18.

node --version  # Should display v22.x or higher
npx -y @modelcontextprotocol/server-github --help

Connection timeout

The default timeout is 30 seconds for network transports. If your SSE server takes more than 10 seconds to respond, check network latency and firewall rules.

Invalid or expired token

Claude Code displays the 401 Unauthorized error when the token is missing or expired. Run the following command to update the token:

claude mcp remove github
claude mcp add -e GITHUB_TOKEN=ghp_new_token github -- npx -y @modelcontextprotocol/server-github

For a complete Claude Code installation procedure including initial MCP configuration, follow the dedicated guide.

Key takeaway: most MCP problems are resolved by checking the Node.js version, token validity, and network connectivity - consult the MCP troubleshooting guide for advanced cases.

Why adopt MCP in your development workflow?

MCP transforms Claude Code from a code assistant into an agent capable of interacting with your entire ecosystem. developers using MCP reduce the time spent on context switching between tools by 40%.

Without MCP, you copy and paste information between GitHub, your terminal, and your browser. With MCP, Claude Code accesses these resources directly within the conversation flow.

WorkflowWithout MCPWith MCP
Create a GitHub issue5 manual steps1 natural language command
Search a web pageAlt-Tab + copy-pasteIntegrated query
Read a SQL tableDB client + copy resultDirect query
Check an endpointcurl + interpretCall + automatic analysis

MCP is part of the agentic coding approach where the agent orchestrates multiple tools to accomplish complex tasks. The protocol continues to evolve with new transports and OAuth 2.1 authentication mechanisms.

Key takeaway: MCP eliminates context switching and allows Claude Code to interact natively with GitHub, browsers, and databases - adopt it to accelerate every step of your workflow.

Recommended training

Claude Code Training

Master Claude Code with our expert instructors. Practical, hands-on training directly applicable to your projects.

View program