Skip to content

Model Context Protocol

MCP provides a standardized way for AI agents to connect to external services. Every MCP server costs context tokens, expands the security surface, and adds operational complexity. Before adding an MCP server, ask: is this the right tool, or would a CLI work?

Many tasks that seem to require MCP servers are better solved with existing CLI tools.

What MCP Is

MCP is a JSON-RPC protocol connecting AI applications to external systems:

┌─────────────────────────────────────────────────────────────┐
│                        Host (AI App)                        │
│  Claude Code, Cursor, Opencode, etc.                        │
│                                                             │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐         │
│  │   Client    │  │   Client    │  │   Client    │         │
│  │  (handler)  │  │  (handler)  │  │  (handler)  │         │
│  └──────┬──────┘  └──────┬──────┘  └──────┬──────┘         │
└─────────┼────────────────┼────────────────┼─────────────────┘
          │                │                │
          ▼                ▼                ▼
    ┌──────────┐     ┌──────────┐     ┌──────────┐
    │  Server  │     │  Server  │     │  Server  │
    │ (Postgres)│    │  (Slack) │     │  (JIRA)  │
    └──────────┘     └──────────┘     └──────────┘

Each server exposes three capability types:

Capability Purpose Example
Tools Functions the agent can call query_database, send_message
Resources Read-only data the agent can access Database schemas, config files
Prompts Reusable instruction templates Query patterns, message formats

Context Economics

Every enabled MCP server costs tokens:

If an MCP server has 15 tools and you need two, you're wasting tokens. Be selective.

A web project needs different servers than a data pipeline. Configure per-project, not globally.

Load tool definitions on-demand. Example: Cursor's @tool syntax fetches definitions only when invoked.

Decision Framework

Use MCP When

  • OAuth flows or API keys that shouldn't appear in shell history
  • Multi-step API interactions where the server tracks pagination state
  • Services without good CLI tools (JIRA, Linear)
  • Heavy repeated use where token cost amortizes

Avoid MCP When

  • A CLI already exists: gh, aws, gcloud
  • One-off API calls work fine with curl
  • File operations - built-in tools are faster
  • Speculative enablement wastes tokens

MCP vs CLI Comparison

Service MCP Server CLI Alternative Recommendation
GitHub @modelcontextprotocol/server-github gh CLI Use CLI
AWS Community servers aws CLI Use CLI
Slack @modelcontextprotocol/server-slack curl + webhook MCP if heavy use
PostgreSQL @modelcontextprotocol/server-postgres psql Either
JIRA Community servers curl MCP
Linear Community servers curl MCP

Effective Patterns

Don't chain 100 MCP tool calls. Write a script that loops.

Filter at the source. Returning 10k rows burns context and degrades responses.

Keep frequently-used tool combinations as skills.

Topics

  • Security - Threat model, attack vectors, mitigations

External Resources

Runtime-specific: