Model Context Protocol (MCP)

MCP is an open standard developed by Anthropic for connecting AI agents to external data sources, tools, and services. It provides a standardized way for agents to interact with the world beyond their training data.


Contents


How MCP Works

MCP Architecture — 3-Layer Client-Server Model
Layer 1: HOST (AI Application)
Claude Code, OpenCode, Cursor, Windsurf, OpenClaw, Gemini CLI, Copilot
↓ MCP Protocol (stdio / SSE) ↓
Layer 2: MCP CLIENT (built into Host)
Manages connections, routes requests, handles authentication
↓ Tools / Resources / Prompts ↓
Layer 3: MCP SERVERS
📄 Filesystem
🐙 GitHub
🗄️ Database
🔍 Web Search
🌐 Browser
🧠 Memory
⏰ Time / Git
🤖 Seq. Thinking
Layer Component Role
1 Host (AI App) The AI application you use — Claude Code, OpenCode, Cursor, OpenClaw
2 MCP Client (built into Host) Manages connections, routes requests, handles authentication
3 MCP Servers Expose tools, resources, and prompts for the agent

The Agent (Layer 1) sends requests through its built-in MCP Client (Layer 2), which communicates with MCP Servers (Layer 3) that connect to real external services — filesystems, APIs, databases.


Key Concepts

Concept Description Example
Tools Actions the agent can perform Create a GitHub PR, query a database
Resources Data the agent can read Read a file, fetch a web page
Prompts Pre-built templates for common tasks "Review this PR" template
Transports How client and server communicate stdio (local), SSE (remote)

Quick Start: Add an MCP Server

To add an MCP server to your agent, add it to your agent's configuration:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "your-token"
      }
    }
  }
}

Then restart your agent and the new tools will be available automatically.


Most servers follow a similar pattern:

  1. Install the server (usually via npm or docker)
  2. Configure in your agent's mcpServers config
  3. Restart your agent to detect new tools

Filesystem MCP Server

Official server from Anthropic's MCP repository. Provides safe read/write access to local files and directories.

Aspect Details
Install npx -y @modelcontextprotocol/server-filesystem
Config No extra config needed
Permissions Reads files, creates directories
Best For Codebase navigation, local file operations
Installation
npx -y @modelcontextprotocol/server-filesystem
Configuration:
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem"],
      "env": {
        "ALLOWED_DIRECTORIES": "/path/to/your/project"
      }
    }
  }
}

Git MCP Server

Official Git server from Anthropic's MCP repository. Provides tools for reading, searching, and analyzing Git repositories — commit history, branches, diffs, file status.

Aspect Details
Install uvx mcp-server-git
Config No extra config needed (runs in current repo)
Permissions Read-only access to Git history
Best For Code review, git log analysis, branch inspection
Installation
uvx mcp-server-git
Configuration:
{
  "mcpServers": {
    "git": {
      "command": "uvx",
      "args": ["mcp-server-git"]
    }
  }
}
Features:

GitHub MCP Server

Two options available — the official server from GitHub and the Anthropic MCP version.

Option 1 — Official GitHub MCP Server
Aspect Details
Install npx -y @github/github-mcp-server
Config Requires GITHUB_TOKEN environment variable
Best For GitHub-native PR review, issues, code management
Installation:
npx -y @github/github-mcp-server
Configuration:
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@github/github-mcp-server"],
      "env": {
        "GITHUB_TOKEN": "ghp_your-token-here"
      }
    }
  }
}
Option 2 — Anthropic's MCP GitHub Server
Aspect Details
Install npx -y @modelcontextprotocol/server-github
Config Requires GITHUB_TOKEN environment variable
Best For General GitHub API access
Configuration:
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "ghp_your-token-here"
      }
    }
  }
}
Using Claude's managed endpoint:
{
  "mcpServers": {
    "github": {
      "url": "https://api.anthropic.com/v1/mcp/github"
    }
  }
}
Token setup: Create at github.com/settings/tokens — use fine-grained tokens scoped to specific repos. Troubleshooting:

PostgreSQL MCP Server

Provides read-only access to PostgreSQL databases. Good for querying schemas, running migrations, and database introspection.

Aspect Details
Install npx -y @modelcontextprotocol/server-postgres
Config Requires DATABASE_URL environment variable
Permissions Read-only database access
Best For Backend development, database querying, schema analysis
Installation
npx -y @modelcontextprotocol/server-postgres
Configuration:
{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "DATABASE_URL": "postgresql://user:password@localhost:5432/mydb"
      }
    }
  }
}
Features:

SQLite MCP Server

Provides read/write access to SQLite databases. Good for local development, prototyping, and data inspection.

Aspect Details
Install npx -y @modelcontextprotocol/server-sqlite
Config Requires database file path
Permissions Full read/write database access
Best For Local development, data inspection, quick prototyping
Installation
npx -y @modelcontextprotocol/server-sqlite
Configuration:
{
  "mcpServers": {
    "sqlite": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-sqlite"],
      "env": {
        "DATABASE_PATH": "./data/mydatabase.db"
      }
    }
  }
}
Features:

Slack MCP Server

Provides access to Slack channels, messages, and threads. Good for team communication workflows.

Aspect Details
Install npx -y @modelcontextprotocol/server-slack
Config Requires SLACK_TOKEN and optionally SLACK_TEAM_ID
Permissions Read/write messages, join channels
Best For Team communication, message retrieval, channel management
Installation
npx -y @modelcontextprotocol/server-slack
Configuration: Create a Slack app at api.slack.com/apps with scopes: channels:history, channels:read, chat:write, channels:join, users:read.
{
  "mcpServers": {
    "slack": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-slack"],
      "env": {
        "SLACK_TOKEN": "xoxb-your-token-here",
        "SLACK_TEAM_ID": "T1234567890"
      }
    }
  }
}
Troubleshooting:

Web Search / Brave Search MCP Server

Provides internet search and web page fetching capabilities.

Aspect Details
Install npx -y @modelcontextprotocol/server-brave-search
Config No extra config needed for basic usage
Best For Research, documentation lookup, current information
Installation
npx -y @modelcontextprotocol/server-brave-search
Configuration: Works out of the box. Optionally add API key for higher rate limits:
{
  "mcpServers": {
    "brave-search": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-brave-search"],
      "env": {
        "BRAVE_API_KEY": "optional-api-key-here"
      }
    }
  }
}
Features:

Puppeteer MCP Server

Provides headless browser automation capabilities. Supports web scraping, testing, and web interaction.

Aspect Details
Install npx -y @modelcontextprotocol/server-puppeteer
Config No extra config needed
Best For Web scraping, automated testing, web interaction
Installation
npx -y @modelcontextprotocol/server-puppeteer
Configuration:
{
  "mcpServers": {
    "puppeteer": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-puppeteer"]
    }
  }
}
Features:

Playwright MCP Server

Microsoft's Playwright-based MCP server for browser automation. More feature-rich than Puppeteer — supports multiple browsers, network mocking, and accessibility snapshots.

Aspect Details
Install npx -y @playwright/mcp
Config No extra config needed
Best For Cross-browser testing, modern web automation
Installation
npx -y @playwright/mcp
Configuration:
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["-y", "@playwright/mcp"]
    }
  }
}
Features:

Memory MCP Server

Provides persistent memory storage across agent sessions. Good for long-running agents and context persistence.

Aspect Details
Install npx -y @modelcontextprotocol/server-memory
Config Requires memory backend URL
Best For Long-running agents, context persistence, cross-session memory
Installation
npx -y @modelcontextprotocol/server-memory
Configuration:
{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"],
      "env": {
        "MEMORY_BACKEND_URL": "your-backend-url"
      }
    }
  }
}
Features: Backend options: Redis, PostgreSQL, Supabase, Local filesystem

Sequential Thinking MCP Server

Enhances agent reasoning with structured thinking chains. Good for complex problem solving and step-by-step analysis.

Aspect Details
Install npx -y @modelcontextprotocol/server-sequential-thinking
Config No extra config needed
Best For Complex problems, multi-step reasoning, analysis
Installation
npx -y @modelcontextprotocol/server-sequential-thinking
Configuration:
{
  "mcpServers": {
    "sequential-thinking": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
    }
  }
}
Features:

Time MCP Server

Official Time server from Anthropic's MCP repository. Provides current time and timezone information for agents.

Aspect Details
Install uvx mcp-server-time
Config No extra config needed
Best For Timezone-aware agents, scheduling, timestamps
Installation
uvx mcp-server-time
Configuration:
{
  "mcpServers": {
    "time": {
      "command": "uvx",
      "args": ["mcp-server-time"]
    }
  }
}
Features:

Context Mode MCP Server

An MCP server that enables context-aware agent behaviors with mode switching for different development scenarios.

Aspect Details
Install npx -y context-mode
Config No extra config needed
Best For Context-aware prompting, mode-based agent behavior
Installation
npx -y context-mode
Configuration:
{
  "mcpServers": {
    "context-mode": {
      "command": "npx",
      "args": ["-y", "context-mode"]
    }
  }
}
Features:

Context7 MCP Server

A context-aware MCP server by Upstash that provides relevant context from external sources to AI agents.

Aspect Details
Install npx @upstash/context7-mcp --api-key
Config Requires Upstash API key
Best For RAG-based context injection, external knowledge retrieval
Installation
npx @upstash/context7-mcp --api-key YOUR_API_KEY
Configuration:
{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["@upstash/context7-mcp", "--api-key", "your-api-key-here"]
    }
  }
}
Features:

DuckDuckGo MCP Server

Provides privacy-focused web search capabilities through DuckDuckGo search engine.

Aspect Details
Install npx duckduckgo-mcp-server
Config No API key required (free, privacy-focused)
Best For Privacy-respecting web search, research
Installation
npx duckduckgo-mcp-server
Configuration:
{
  "mcpServers": {
    "duckduckgo": {
      "command": "npx",
      "args": ["duckduckgo-mcp-server"]
    }
  }
}
Features:

Android MCP Server

Enables AI agents to interact with Android devices — take screenshots, tap, type, and automate Android UI.

Aspect Details
Install uvx --python 3.13 android-mcp
Config Requires ADB connection to Android device
Best For Android automation, UI testing, device control
Installation
uvx --python 3.13 android-mcp
Configuration: Requires ADB connected to your Android device:
# Connect device via USB/Wi-Fi
adb devices
{
  "mcpServers": {
    "android": {
      "command": "uvx",
      "args": ["--python", "3.13", "android-mcp"]
    }
  }
}
Features:

Tools Supporting MCP

Tool MCP Support Notes
Claude Code Full Native MCP client. Configure in claude.json
OpenCode Full MCP server via config file
Cursor Yes Cursor MCP server support
Windsurf Yes MCP integration
OpenClaw Yes MCP tools support

Best Practices

Practice Description
Security Use environment variables for secrets, never hardcode in config files
Permissions Use minimum required scopes for tokens (principle of least privilege)
Rate limiting Be aware of API rate limits (GitHub: 5000/hour, Slack: varies)
Docker Containerize MCP servers for isolation and easy deployment
Testing Test MCP servers with npx -y before full integration

Troubleshooting

Issue Solution
MCP server not starting Check Node.js version (requires 18+), ensure npx is in PATH
Tool not visible in agent Restart agent after updating mcpServers config
Permission errors Verify token scopes and account permissions
Connection refused Check firewall, ensure server is listening on correct port