Skip to main content
Model Context Protocol (MCP) is an open standard that enables Claude Code to connect with external data sources, APIs, and services. MCP servers act as bridges between Claude and the outside world.

What Are MCPs?

MCPs are JSON configuration files (.json) that define server connections:
  • Server configuration - How to start and connect to MCP servers
  • Command and arguments - What to execute (npm packages, binaries, scripts)
  • Environment variables - Configuration and API keys
  • Capabilities - What tools and resources the server provides
MCP servers run as separate processes and communicate with Claude Code via stdio (standard input/output).

MCP Architecture

MCP configuration lives in .mcp.json at your project root:

Configuration Structure

MCP Categories

Access web content and external APIs:
  • web-fetch - HTTP requests, web scraping, API calls
  • github-integration - GitHub API access (repos, issues, PRs)
  • slack-integration - Slack API for messages and channels
Capabilities:
  • Fetch web pages and parse HTML
  • Make REST API requests
  • Download files and images
  • Parse JSON and XML responses

Real-World Examples

Example 1: Web Fetch MCP

File: .mcp.json
Usage in Claude Code:
Claude automatically uses the MCP server to make the HTTP request.

Example 2: PostgreSQL Database MCP

File: .mcp.json
Usage in Claude Code:
Claude connects to PostgreSQL and executes the query.

Example 3: GitHub Integration MCP

File: .mcp.json
Usage in Claude Code:
Claude uses the GitHub API via MCP to fetch and analyze issues.

Installing MCPs

Single MCP

The MCP configuration merges with your existing .mcp.json.

Multiple MCPs

With Category Prefix

MCP servers are downloaded on-demand when first used. No manual installation required beyond configuration.

Environment Variables

Many MCPs require API keys or connection strings:

Secure Configuration

DON’T hardcode secrets:
DO use environment variables:
Set variables in your shell:
Or use .env files (add to .gitignore):
Never commit API keys, database passwords, or tokens to version control. Use environment variables or secret management tools.

MCP Server Types

NPM Packages

Most official MCPs are npm packages:
The -y flag auto-installs packages without prompting.

Python Scripts

Requires the Python package to be installed: pip install mcp-server-name

Custom Executables

Docker Containers

MCP Capabilities

MCP servers can provide:

1. Tools

Functions that Claude can call:

2. Resources

Data that Claude can read:

3. Prompts

Pre-built prompt templates:

Creating Custom MCP Servers

You can build custom MCP servers:
1

Choose Implementation

Use the MCP SDK for TypeScript or Python:
2

Implement Server

Create server with tools and resources:
3

Configure in .mcp.json

Add your server configuration:
4

Test

Use your custom server in Claude Code:
For detailed MCP development guides, see MCP Documentation.

MCP Best Practices

1. Security First

  • Never hardcode credentials
  • Use environment variables for secrets
  • Validate all inputs
  • Limit server permissions
  • Use read-only access when possible

2. Error Handling

Servers should handle errors gracefully:

3. Resource Management

  • Close connections properly
  • Implement timeouts
  • Clean up resources
  • Handle server shutdown gracefully

4. Documentation

Document your MCP tools clearly:

Troubleshooting MCPs

Server Won’t Start

Check the command and arguments:
Test manually:

Environment Variables Not Working

Ensure variables are exported:
Check variable syntax:

Connection Errors

Verify network access:
  • Database servers are running
  • Firewall allows connections
  • Credentials are correct
  • Connection strings are properly formatted

Permission Denied

Ensure executable permissions:

MCP vs Claude Code Tools

MCPs extend Claude’s capabilities beyond the built-in tools. Use them to connect Claude with your specific services and data sources.

Official MCP Servers

Anthropics maintains official MCP servers:
  • @modelcontextprotocol/server-fetch - HTTP requests
  • @modelcontextprotocol/server-filesystem - File operations
  • @modelcontextprotocol/server-github - GitHub API
  • @modelcontextprotocol/server-postgres - PostgreSQL
  • @modelcontextprotocol/server-sqlite - SQLite
Browse all at MCP Registry.

Next Steps

Browse MCPs

Explore 65+ available MCPs

MCP Documentation

Official MCP specification

Create MCP Server

Build custom MCP servers

Settings

Configure Claude Code behavior