Client Guide

Best MCP Servers for Claude Code CLI (2026)

Anthropic's command-line coding agent with native MCP support. Configure servers via project settings or the --mcp flag for terminal-based AI development workflows.

60+ Compatible Servers
JSON Config

What is Claude Code?

Claude Code is Anthropic's agentic coding tool that runs entirely in your terminal. Unlike GUI-based editors, Claude Code operates as a command-line interface where you describe tasks in natural language and Claude autonomously reads files, writes code, runs commands, and manages your project. It natively supports the Model Context Protocol (MCP), allowing you to extend its capabilities with external tools, file system access, GitHub integration, database connections, and any custom tooling you build.

How MCP Works with Claude Code

Claude Code discovers MCP servers through configuration files and command-line flags. When you start a Claude Code session, it reads the MCP server definitions from your project's .claude/settings.json file (or the global ~/.claude/settings.json), spawns each server process, and makes their tools available throughout the session. Claude Code can then autonomously decide when to use these tools to accomplish your tasks.

The key difference from Claude Desktop is that Claude Code is designed for deep coding workflows. It already has built-in file system access and command execution, so MCP servers in Claude Code are most valuable for adding specialized capabilities like database queries, API interactions, search, and persistent memory.

Detailed Setup Process

There are three ways to configure MCP servers in Claude Code, each suited for different scenarios:

Method 1: Project-Level Configuration (Recommended)

Create a .claude/settings.json file in your project root. This is ideal for project-specific servers that your team can share via version control:

  1. Create the .claude directory in your project root if it does not exist.
  2. Create .claude/settings.json with your MCP server configurations under the mcpServers key.
  3. Run claude in your terminal from the project directory. Claude Code automatically detects and connects to the configured servers.

Method 2: Global Configuration

For servers you want available in every project, add them to ~/.claude/settings.json. This is useful for general-purpose servers like memory or web search that are not project-specific.

Method 3: CLI Flag (One-Off Sessions)

For quick one-off use, pass MCP servers via the --mcp flag: claude --mcp "server-name:npx -y @modelcontextprotocol/server-name". Servers added this way are only available for that single session.

Advanced Configuration

Project vs. Global Settings Precedence

When both project-level and global settings define the same MCP server, the project-level configuration takes precedence. This lets you override global defaults for specific projects. For example, you might have a global filesystem server pointing to your home directory, but a project-level one pointing to just the project's source directory for tighter security.

Environment Variables

Claude Code supports environment variables in MCP server configurations via the env field. These variables are passed only to the specific server process, not to Claude Code itself. For sensitive values like API tokens, you can also use a .env file in your project root - Claude Code will load these automatically, and servers can access them if they are included in the env configuration or inherited from the parent process.

Transport Options

Claude Code supports stdio transport (the default) where servers communicate via standard input/output. For remote servers, you can use SSE transport by specifying a url field instead of command and args. Stdio is recommended for local servers due to lower latency, while SSE enables connecting to shared team servers or cloud-hosted MCP services.

Troubleshooting Common Issues

  • "Failed to start MCP server: command not found" - The specified command (e.g., npx) is not in your terminal's PATH. Verify with which npx and ensure your shell profile loads the correct Node.js installation.
  • "MCP server disconnected unexpectedly" - The server process crashed. Run the server command directly in a terminal to see error output. Common causes: missing dependencies, incorrect arguments, or port conflicts for SSE servers.
  • "No MCP servers found" - Claude Code could not find a .claude/settings.json file. Make sure you are running Claude Code from the directory containing the .claude folder, or check that your global ~/.claude/settings.json exists and is valid JSON.
  • Server starts but tools are not used - Claude Code decides autonomously when to use MCP tools. If it is not using a tool you expect, try explicitly asking it to use that tool or mentioning the capability (e.g., "search my database for...").
  • Environment variables not working - Ensure the env field is at the same level as command and args in the server configuration. Variables defined in env override system environment variables for that server process only.

Recommended MCP Servers

While Claude Code already has built-in file and terminal access, these MCP servers add valuable extra capabilities:

  • Filesystem Server - Useful for sandboxed file access when you want to restrict Claude Code to specific directories.
  • GitHub Server - Browse repositories, manage issues, create pull requests, and review code without leaving the terminal.
  • PostgreSQL Server - Query databases with natural language, explore schemas, and generate reports.
  • Brave Search Server - Give Claude web search capabilities for research, documentation lookups, and fact-checking.
  • Memory Server - Persistent memory across sessions, ideal for storing project context, decisions, and preferences.

Browse our complete MCP server directory for more options.

Related Guides

For a detailed comparison of MCP setups across different AI clients, see our MCP Servers for Cursor, VS Code, and Claude guide. Visit our tutorials section for hands-on walkthroughs.

Performance Tips

  • Only configure servers you actively use. Each MCP server is a separate process. In a terminal workflow where startup speed matters, fewer servers means faster session initialization.
  • Use project-level configs instead of loading everything globally. This keeps each project lean with only the servers it needs.
  • Pre-install server packages globally instead of using npx -y for servers you use frequently. Global installs skip the package resolution step: npm install -g @modelcontextprotocol/server-filesystem.
  • Use stdio transport for local servers - it is faster than SSE and requires no port management.
  • Monitor memory usage with htop or top if you notice slowdowns. Some MCP servers (especially database servers) can consume significant memory with large datasets.

Security Considerations

Claude Code runs with your user permissions and can already access your filesystem and execute commands. MCP servers add additional capabilities that require careful consideration:

  • Review server permissions. Each MCP server can only do what its implementation allows. Read the server's documentation to understand what access it requires.
  • Use project-level configs with minimal scope. Point filesystem servers at specific project directories, not your entire home folder.
  • Protect API keys. Use environment variables or a secrets manager rather than hardcoding tokens in config files that might be committed to version control. Add .claude/settings.json to your .gitignore if it contains secrets.
  • Audit third-party servers. Only use MCP servers from trusted sources. Review the source code or use servers from the official MCP servers repository.
  • For a comprehensive overview, read our MCP Server Security Guide.

Comparing Claude Code with Other Clients

Claude Code is ideal for developers who live in the terminal and want an agentic, keyboard-driven workflow. If you prefer a graphical chat interface, try Claude Desktop. For a full IDE experience with MCP, consider Cursor or VS Code with GitHub Copilot. All clients share the same MCP server ecosystem - your server configurations are portable across clients with only minor format differences.

Configuration

Config file location: .claude/settings.json or --mcp flag

{ "mcpServers": { "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/you/projects/myapp"] }, "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here" } }, "postgres": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost:5432/mydb"] }, "brave-search": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-brave-search"], "env": { "BRAVE_API_KEY": "your_brave_api_key_here" } }, "memory": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-memory"] } } }

Setup Guide

1

Install Claude Code via npm: npm install -g @anthropic-ai/claude-code.

2

Create a .claude directory in your project root: mkdir -p .claude

3

Create .claude/settings.json with your MCP server configurations under the mcpServers key.

4

Run claude in your terminal from the project directory to start a session with MCP servers loaded.

5

Claude Code will display the connected MCP servers at startup. Verify your servers appear in the list.

6

Alternatively, use the --mcp flag for one-off sessions: claude --mcp "server-name:command args".

7

For global configuration, add servers to ~/.claude/settings.json to make them available across all projects.

Need help setting up Claude Code CLI?

Check our step-by-step IDE setup guide with troubleshooting tips.

Read Setup Guide

Explore Claude Code CLI Servers by Category

Find the best MCP servers for Claude Code CLI in each category.

File Systems

MCP servers for secure file operations, directory management, and document processing. These servers provide sandboxed access to local and remote file systems with configurable permissions.

Databases

MCP servers for connecting AI assistants to SQL and NoSQL databases. Query, analyze, and manage your data through natural language with support for PostgreSQL, SQLite, MongoDB, Redis, and more.

APIs

MCP servers that connect AI assistants to external APIs and web services. Search the web, fetch data, interact with third-party platforms, and automate API workflows through natural language.

Cloud Services

MCP servers for managing cloud infrastructure across AWS, Google Cloud, Azure, and platforms like Vercel, Netlify, and Cloudflare. Deploy, monitor, and manage cloud resources through AI assistants.

Developer Tools

MCP servers for software development workflows including version control, CI/CD, code analysis, browser testing, and project management. Supercharge your development process with AI-powered tooling.

Analytics

MCP servers for monitoring, observability, and data analytics. Connect AI assistants to Grafana, Datadog, and search platforms to analyze metrics, logs, and business data in real time.

Communication

MCP servers for messaging, video conferencing, and team collaboration platforms. Connect AI assistants to Slack, Discord, and Zoom for automated communication workflows.

Business Applications

MCP servers for CRM, e-commerce, project management, and business automation platforms. Connect AI to Shopify, Stripe, Salesforce, HubSpot, Notion, and more to streamline business operations.

Frequently Asked Questions

Ready to supercharge Claude Code CLI with MCP?

Browse our complete directory of 60+ MCP servers, read our setup guides, and start building with the Model Context Protocol today.

60+ ServersFree & Open SourceStep-by-Step GuidesSecurity Reviews