Skip to content

MCP Servers Best Practice

MCP (Model Context Protocol) servers extend Claude Code with connections to external tools, databases, and APIs. This guide covers recommended servers for daily use and configuration best practices.

MCP Servers for Daily Use

"Went overboard with 15 MCP servers thinking more = better. Ended up using only 4 daily." -- r/mcp (682 upvotes)

MCP ServerWhat It DoesResources
Context7Fetches up-to-date library docs into context. Prevents hallucinated APIs from outdated training dataReddit: "by far the best MCP for coding" -- npm
PlaywrightBrowser automation -- implement, test, and verify UI features autonomously. Screenshots, navigation, form testingReddit: essential for frontend -- Docs
Claude in ChromeConnects Claude to your real Chrome browser -- inspect console, network, DOM. Debug what users actually seeReddit: "game changer" for debugging
DeepWikiFetches structured wiki-style documentation for any GitHub repo -- architecture, API surface, relationshipsReddit: "put it behind a gateway with Context7"
ExcalidrawGenerate architecture diagrams, flowcharts, and system designs as hand-drawn Excalidraw sketches from promptsGitHub

Workflow Pipeline

Research (Context7/DeepWiki) -> Debug (Playwright/Chrome) -> Document (Excalidraw)

Configuration

MCP servers are configured in .mcp.json at the project root (project-scoped) or in ~/.claude.json (user-scoped).

Server Types

TypeTransportExample
stdioSpawns a local processnpx, python, binary
httpConnects to a remote URLHTTP/SSE endpoint

Example .mcp.json

json
{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"]
    },
    "playwright": {
      "command": "npx",
      "args": ["-y", "@playwright/mcp"]
    },
    "deepwiki": {
      "command": "npx",
      "args": ["-y", "deepwiki-mcp"]
    },
    "remote-api": {
      "type": "http",
      "url": "https://mcp.example.com/mcp"
    }
  }
}

Keep Secrets Out of Version Control

Use environment variable expansion for secrets instead of committing API keys in .mcp.json:

json
{
  "mcpServers": {
    "remote-api": {
      "type": "http",
      "url": "https://mcp.example.com/mcp?token=${MCP_API_TOKEN}"
    }
  }
}

Settings for MCP Servers

These settings in .claude/settings.json control MCP server approval:

KeyTypeDescription
enableAllProjectMcpServersbooleanAuto-approve all .mcp.json servers without prompting
enabledMcpjsonServersarrayAllowlist of specific server names to auto-approve
disabledMcpjsonServersarrayBlocklist of specific server names to reject

Permission Rules for MCP Tools

MCP tools follow the mcp__<server>__<tool> naming convention in permission rules:

json
{
  "permissions": {
    "allow": [
      "mcp__*",
      "mcp__context7__*",
      "mcp__playwright__browser_snapshot"
    ],
    "deny": [
      "mcp__dangerous-server__*"
    ]
  }
}

MCP Scopes

MCP servers can be defined at three levels:

ScopeLocationPurpose
Project.mcp.json (repo root)Team-shared servers, committed to git
User~/.claude.json (mcpServers key)Personal servers across all projects
SubagentAgent frontmatter (mcpServers field)Servers scoped to a specific subagent

Precedence Order

Subagent > Project > User

Sources