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.

Share:
33956+ 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

Compatible MCP Servers

All 33956 servers in our directory work with Claude Code CLI.

n8n-mcp

189,137

A comprehensive MCP server that provides full control over n8n automation workflows through natural language. It offers 43 tools for managing workflows, executions, credentials, and data tables, with safety features like write-mode protection and dou

APIsAI/ML

Ecc MCP Server

188,249

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

AI/MLProductivity

Javaguide MCP Server

155,815

Java 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发

AI/MLDatabases

Dify MCP Server

142,215

Production-ready platform for agentic workflow development.

AI/MLDeveloper Tools

Open Webui MCP Server

138,158

User-friendly AI Interface (Supports Ollama, OpenAI API, ...)

AI/ML

gemini-cli-mcp

104,466

A secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in

APIsAI/ML

Awesome Mcp Servers MCP Server

87,339

⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.

AI/MLAPIs

Slack MCP Server

86,067

Enables interaction with Slack workspaces through comprehensive channel management, messaging, user management, file uploads, and Block Kit formatting. Features secure credential storage via macOS Keychain and supports all major Slack operations incl

APIs

Servers MCP Server

86,018

Model Context Protocol Servers

APIs

Netdata MCP Server

78,898

Real-time infrastructure monitoring with metrics, logs, alerts, and ML-based anomaly detection.

AI/MLDatabases

Cc Switch MCP Server

77,534

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io

APIs

Lobehub MCP Server

77,511

🤯 LobeHub is your Chief Agent Operator, organizing your agents into 7×24 operations by hiring, scheduling, and reporting on your entire AI team.

AI/ML

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.

Browser Automation

MCP servers for browser automation, web testing, scraping, screenshot capture, and PDF generation. Control Playwright, Puppeteer, Skyvern, and more through AI assistants.

Search & Data Extraction

MCP servers for web search, data extraction, and content retrieval. Connect AI assistants to Brave Search, Exa, Firecrawl, and 385+ other search and extraction tools.

Knowledge & Memory

MCP servers for persistent memory, knowledge graphs, vector databases, and context management. Give AI assistants long-term memory and access to structured knowledge.

Finance & Fintech

MCP servers for financial services, payment processing, trading, and cryptocurrency. Connect AI assistants to Stripe, banking APIs, market data, and blockchain tools.

Security

MCP servers for security monitoring, authentication, vulnerability scanning, and compliance. Connect AI assistants to Sentry, auth providers, and security scanners.

Data Science & ML

MCP servers for data science, machine learning, and scientific computing. Connect AI assistants to Jupyter notebooks, pandas, ML frameworks, and data processing pipelines.

Version Control

MCP servers for version control systems including Git, GitHub, and GitLab. Manage repositories, pull requests, code reviews, and CI/CD pipelines through AI assistants.

Coding Agents

MCP servers for AI coding agents, code generation, task management, and automated testing. Enhance your development workflow with intelligent coding assistants.

Marketing & SEO

MCP servers for marketing automation, SEO optimization, content management, and social media. Connect AI assistants to analytics platforms, SEO tools, and marketing workflows.

Monitoring & Observability

MCP servers for monitoring, observability, and logging. Connect AI assistants to Grafana, Datadog, Sentry, and other tools for intelligent incident response and system analysis.

Frequently Asked Questions

Ready to supercharge Claude Code CLI with MCP?

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

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