MCP (Model Context Protocol) servers give Claude Code the ability to interact with external systems - browsers, databases, APIs, cloud services. Instead of pasting query results into chat or describing what a webpage looks like, the right MCP server lets Claude see and act on these things directly. But each server adds tool schemas to the context window, and not every server is worth the cost. Here is what is actually useful, how to set each one up, and when to skip MCP entirely in favor of CLI tools.
How MCP Servers Work in Claude Code
Claude Code acts as an MCP client. It connects to MCP servers defined in the project or user settings, discovers their available tools, and calls those tools during conversations. Each server’s tool schemas are loaded into context at the start of a session.
Configuration lives in .claude/settings.json:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@anthropic-ai/mcp-playwright"]
}
}
}
When Claude Code starts, it spins up each configured server, fetches the tool list, and adds those tools to its available capabilities. This happens automatically - no manual connection step.
Playwright MCP - Visual UI Verification
This is the highest-value MCP server for frontend developers. Playwright MCP gives Claude the ability to launch a browser, navigate to pages, take screenshots, click elements, and fill forms.
Setup:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@anthropic-ai/mcp-playwright"]
}
}
}
What it enables:
- Claude can verify that UI changes actually look correct by taking screenshots
- Form testing - Claude fills out forms and checks validation behavior
- Visual regression - Claude compares current rendering against expected layout
- End-to-end verification after code changes
Real usage pattern: After making a CSS change, tell Claude to “open localhost:3000/dashboard and verify the sidebar layout.” Claude launches the browser, takes a screenshot, and can identify visual issues that would otherwise require manual checking.
Context cost: Moderate. Playwright MCP exposes roughly 15-20 tools (navigate, click, screenshot, fill, etc.). The schemas add a few hundred tokens to every interaction.
GitHub MCP - PR and Issue Management
The GitHub MCP server exposes repository operations - creating PRs, commenting on issues, reviewing code, managing labels.
Setup:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["@anthropic-ai/mcp-github"],
"env": {
"GITHUB_TOKEN": "<personal-access-token>"
}
}
}
}
What it enables:
- Create pull requests with proper descriptions directly from Claude Code
- Read issue details and linked PRs for context
- Post review comments on specific lines of code
- Manage labels and milestones
When to skip it: If the workflow already uses gh (GitHub CLI), the MCP server adds marginal value. Claude Code can run gh pr create, gh issue list, and gh pr review via bash. The CLI approach uses zero extra context tokens because bash is always available. The MCP server is better when the goal is structured data access - pulling issue details into context for analysis, or batch operations across multiple PRs.
| Approach | Context Cost | Structured Data | Setup |
|---|---|---|---|
| GitHub MCP | ~500 tokens for schemas | Yes - typed responses | Token required in config |
gh CLI |
Zero extra | Text output, needs parsing | gh auth login once |
PostgreSQL / SQLite MCP - Database Access
Database MCP servers let Claude query databases directly. This is transformative for debugging and development.
PostgreSQL setup:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["@anthropic-ai/mcp-postgres", "postgresql://user:pass@localhost:5432/mydb"]
}
}
}
SQLite setup:
{
"mcpServers": {
"sqlite": {
"command": "npx",
"args": ["@anthropic-ai/mcp-sqlite", "--db", "./data/app.db"]
}
}
}
What it enables:
- Claude reads the actual schema, not a stale documentation version
- Debugging data issues by querying the database directly
- Writing migrations after inspecting current table structures
- Verifying that code changes produce correct database state
Safety note: The PostgreSQL MCP server runs read-only queries by default. This is the correct default. Giving an LLM write access to a production database is asking for trouble. For development databases where writes are acceptable, the configuration allows it, but think carefully before enabling it.
When to skip it: For one-off queries, running psql -c "SELECT ..." via bash is simpler and adds zero context overhead. The MCP server pays off when Claude needs to explore the schema, run multiple related queries, or understand table relationships.
Filesystem MCP - Advanced File Operations
The Filesystem MCP server provides tools for file operations beyond what Claude Code’s built-in file tools offer.
Setup:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["@anthropic-ai/mcp-filesystem", "--root", "/path/to/project"]
}
}
}
What it enables:
- Directory tree visualization
- File search with advanced patterns
- Bulk file operations
- File metadata access
When to skip it: Claude Code already has built-in file read, write, and search tools. The Filesystem MCP server is only worth it for projects where advanced file operations are frequent - large monorepos, codegen projects, or documentation sites with hundreds of files. For typical projects, the built-in tools are sufficient and the MCP server just adds unnecessary context cost.
The Context Cost Problem
Every MCP server adds its tool schemas to the context window. This is not free.
| Server | Approximate Schema Tokens | Tools Exposed |
|---|---|---|
| Playwright | 400-600 | 15-20 |
| GitHub | 800-1200 | 25-35 |
| PostgreSQL | 200-400 | 5-10 |
| SQLite | 200-400 | 5-10 |
| Filesystem | 300-500 | 10-15 |
A setup with all five servers might add 2000-3000 tokens to every single message in every conversation. Over a long session with 50 back-and-forth messages, that is 100,000-150,000 extra input tokens. At current pricing, that is not trivial.
The rule: Only enable MCP servers that the current project actually uses. A frontend project does not need PostgreSQL MCP. A CLI tool project does not need Playwright. Use project-level settings (.claude/settings.json in the repo) rather than user-level settings so each project only loads what it needs.
When CLI Tools Beat MCP
MCP servers are not always the right answer. For many operations, Claude running a CLI command via bash is simpler, cheaper, and equally effective.
| Task | MCP Server | CLI Alternative | Recommendation |
|---|---|---|---|
| Create a GitHub PR | GitHub MCP | gh pr create |
CLI - zero context cost |
| Run a single SQL query | Postgres MCP | psql -c "..." |
CLI for one-offs |
| Take a screenshot | Playwright MCP | None equivalent | MCP - no CLI alternative |
| Search files | Filesystem MCP | rg, find |
CLI - already built in |
| Explore DB schema | Postgres MCP | psql -c "\d" |
MCP for multi-table exploration |
| Fill and test a form | Playwright MCP | None equivalent | MCP - no CLI alternative |
The pattern: MCP servers win when the task requires multi-step interaction with an external system (browsing a UI, exploring a database schema) or when structured data is needed. CLI tools win for one-shot operations where the output is text.
Recommended Setup by Project Type
Frontend web app:
- Playwright MCP (visual verification)
- Skip GitHub MCP (use
ghCLI) - Database MCP only if the app has one
Backend API:
- PostgreSQL/SQLite MCP (schema exploration, data verification)
- Skip Playwright
- Skip GitHub MCP (use
ghCLI)
Full-stack:
- Playwright MCP
- Database MCP
- Skip Filesystem MCP (built-in tools suffice)
Open source maintainer:
- GitHub MCP (batch PR/issue management justifies context cost)
- Skip everything else
Setup Verification
After configuring MCP servers, verify they are working:
# Start Claude Code and check available tools
claude --print-tools
Each MCP server’s tools should appear in the output. If a server fails to start, Claude Code logs the error and continues without it. Check the logs if expected tools are missing:
# View Claude Code logs for MCP connection issues
claude --debug
The right set of MCP servers turns Claude Code from a code editor into something closer to a full development environment. But the wrong set - too many servers, unused servers, servers that duplicate CLI capabilities - just wastes context and money. Be deliberate about what gets enabled.
Comments