Skip to main content

MCP Servers

3 min read

Extend Claude Code with Model Context Protocol servers


title: MCP Servers description: Extend Claude Code with Model Context Protocol servers

Model Context Protocol (MCP) servers extend Claude Code's capabilities by providing access to external data sources, tools, and services. This guide covers setup, configuration, and best practices.

What is MCP?

MCP (Model Context Protocol) is an open standard that allows AI assistants to securely connect to external systems. MCP servers can provide:

  • Resources - Data Claude can read (files, databases, APIs)
  • Tools - Actions Claude can perform (queries, writes, API calls)
  • Prompts - Pre-defined prompt templates

Configuration

MCP servers are configured in your settings file:

Location: ~/.claude/settings.json (global) or .claude/settings.json (project)

JSON

Official MCP Servers

Filesystem Server

Access files and directories:

JSON

Capabilities:

  • Read file contents
  • List directory contents
  • Search files by pattern
  • Get file metadata

PostgreSQL Server

Query PostgreSQL databases:

JSON

Capabilities:

  • Execute SELECT queries
  • Describe tables and schemas
  • List databases

SQLite Server

Work with SQLite databases:

JSON

Git Server

Enhanced git operations:

JSON

Capabilities:

  • View commit history
  • Show diffs
  • List branches
  • Search commits

GitHub Server

Access GitHub repositories and issues:

JSON

Capabilities:

  • List repositories
  • Read issues and PRs
  • Search code
  • View file contents

Slack Server

Interact with Slack workspaces:

JSON

Google Drive Server

Access Google Drive files:

JSON

Community MCP Servers

The MCP ecosystem includes many community-built servers:

| Server | Purpose | Install | |--------|---------|---------| | mcp-server-fetch | HTTP requests | npx -y mcp-server-fetch | | mcp-server-puppeteer | Browser automation | npx -y mcp-server-puppeteer | | mcp-server-brave-search | Web search | npx -y mcp-server-brave-search | | mcp-server-memory | Persistent memory | npx -y mcp-server-memory |

Find more at github.com/anthropics/mcp-servers

Multiple Servers

You can configure multiple MCP servers simultaneously:

JSON

Environment Variables

Using System Environment Variables

Reference existing environment variables:

JSON

Setting Server-Specific Variables

JSON

Building Custom MCP Servers

Server Template (TypeScript)

TypeScript

Server Template (Python)

Python

Debugging MCP Servers

Enable Debug Logging

Bash

Check Server Status

Bash

This shows:

  • Connected servers
  • Available tools
  • Available resources

Common Issues

Server not starting:

Bash

Permission errors:

  • Check file/directory permissions
  • Verify API keys are valid
  • Ensure network access for external APIs

Server crashes:

  • Check server logs
  • Verify all required environment variables are set
  • Test with minimal configuration first

Security Best Practices

1. Limit File Access

Only expose necessary directories:

JSON

2. Use Read-Only Access When Possible

Some servers support read-only mode:

JSON

3. Separate Configs by Environment

Development (~/.claude/settings.json):

JSON

Production (project .claude/settings.json):

JSON

4. Rotate Credentials

Regularly rotate API keys and tokens used by MCP servers.

Performance Tips

1. Use Project-Level Config

Configure servers at project level when they're only needed for specific projects.

2. Limit Resource Scope

Narrow down the scope of resources servers can access.

3. Use Caching

Some servers support caching - enable it for better performance:

JSON

Next Steps

Generated with AI using Claude AI by Anthropic

Model: Claude Opus 4.5 · Generated: 2025-12-20 · Build: v1.21.0-75762dc

Edit this page on GitHub··

Discussion

0/2000

Comments are reviewed before being published