Skip to content

MCP (Model Context Protocol)

Model Context Protocol lets agents connect to external services through a common interface.

When to Use MCP

When bash's flexibility becomes a liability, MCP adds structure.

Use MCP when you need Use Bash when you want
Constrained inputs with schema validation
Per-user permissions on the same tool
Structured audit logs (allowed/denied)
User consent before sensitive actions
OAuth token management for remote APIs
Full local flexibility
Existing shell scripts
Pipes and redirects
One-off commands
Standard CLI tools (git, npm, docker)

Context overhead

MCP servers add to your context window. Each enabled server consumes tokens describing its available tools. Be selective about which servers you enable.

Decision Tree

flowchart TD
    A[Need to perform a task] --> B{Can Bash do it?}
    B -->|Yes| C[Use Bash]
    B -->|No| D{Is it file I/O?}
    D -->|Yes| E[Use Read/Write/Edit]
    D -->|No| F{Requires external auth?}
    F -->|No| G[Probably use Bash]
    F -->|Yes| H[Consider MCP]
    H --> I{Does MCP server exist?}
    I -->|Yes| J[Use MCP]
    I -->|No| K[Use Bash + API directly]

Configuration

// ~/.claude.json
{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "DATABASE_URL": "postgresql://localhost/mydb"
      }
    }
  }
}
// opencode.json
{
  "mcp": {
    "servers": {
      "postgres": {
        "command": "npx",
        "args": ["-y", "@modelcontextprotocol/server-postgres"],
        "env": {
          "DATABASE_URL": "postgresql://localhost/mydb"
        }
      }
    }
  }
}

Common MCP Servers

Category Examples
Databases PostgreSQL, MySQL, MongoDB, SQLite
Issue trackers JIRA, Linear, GitHub Issues
Messaging Slack, Discord
Cloud AWS, GCP, Azure
Observability Sentry, PagerDuty, Datadog

Learn More