Skip to main content

Model Context Protocol (MCP): Connecting AI to Everything

5 min read

General Swe

Stop copy-pasting database results. Connect your agent to Postgres via MCP and let it query directly.

Data Sci

Give your agent direct access to your data warehouse through MCP instead of exporting CSVs.

Model Context Protocol (MCP): Connecting AI to Everything

TL;DR

  • MCP is the USB-C for AI. Model Context Protocol is an open standard that connects AI applications to external systems: databases, APIs, file systems, and more.
  • Build once, use everywhere. MCP servers work across Claude Desktop, Cursor, VS Code, and any MCP-compatible client—no vendor lock-in.
  • Three core primitives: Resources (data), Tools (actions), and Prompts (workflows). Your agent gets read access, write actions, and reusable procedures.

Copy the database query results. Paste into the chat. "Now analyze this." Export the CSV. Drag it into the window. "Compare with last quarter." This copy-paste-pray workflow is what most people do with AI in 2026—and it's like faxing a document to someone sitting next to you.

MCP eliminates the middleman. Your agent connects directly to your database, your GitHub repos, your Slack channels, your Google Drive. No export. No paste. You say "show me the data" and it queries the source.

Where things stand: Claude Desktop, Cursor, Zed, VS Code, and Windsurf all support MCP natively. Install an MCP server once (e.g. for Postgres or GitHub), and every compatible client can use it. Developers build servers for their APIs; users compose them like LEGO bricks. The ecosystem has grown to 60+ official servers and hundreds more from the community.

What Is MCP?

Model Context Protocol (MCP) is an open-source standard for connecting AI applications to external systems. Think of it as a universal adapter that lets AI agents talk to databases, APIs, file systems, and services in a standardized way.

From modelcontextprotocol.io:

  • For developers: MCP reduces development time and complexity when building or integrating with AI applications.
  • For AI applications: MCP provides access to an ecosystem of data sources, tools, and apps.
  • For end-users: MCP results in more capable AI applications that can access your data and take actions on your behalf.

Just as USB-C provides a standardized way to connect electronic devices, MCP provides a standardized way to connect AI applications to external systems.

Architecture: Client ↔ Server

MCP uses a client-server model:

  • MCP Client — The AI application (e.g. Claude Desktop, Cursor). It discovers and invokes capabilities from servers.
  • MCP Server — A lightweight service that exposes data and tools. Examples: a Postgres server, a GitHub server, a file system server.

One client can connect to multiple servers. Each server can expose:

  1. Resources — Read-only data (e.g. files, database rows, API responses).
  2. Tools — Functions the agent can call (e.g. "create GitHub issue," "run SQL query").
  3. Prompts — Reusable workflows or templates (e.g. "analyze this dataset," "summarize this PR").

Protocol: JSON-RPC 2.0 over stdio, HTTP with SSE, or WebSocket. Most users never see this—you install a server via config file, and the client handles the rest.

The "aha" here: MCP servers are composable. You can connect 5 servers to one client—Postgres, GitHub, Slack, file system, and Figma—and the agent decides which to use based on your request. It's like having 5 specialists on call, and the agent is the dispatcher.

The Three Core Primitives

1. Resources

Resources are read-only data that your agent can access. Think of them as "things the agent can read."

Examples:

  • File contents from your local machine
  • Database table schemas
  • API responses (e.g. Slack messages, GitHub issues)
  • Documentation from Notion or Confluence

How it works:
A server exposes a list of resource URIs (e.g. file:///path/to/file.txt or postgres://table/users). The client (agent) can fetch and read them.

Use case:
"Summarize the last 10 GitHub issues in the 'bugs' milestone." The GitHub MCP server exposes issues as resources; the agent reads and summarizes.

2. Tools

Tools are functions the agent can call to take actions. Think of them as "things the agent can do."

Examples:

  • Run a SQL query
  • Create a GitHub issue or PR
  • Send a Slack message
  • Write a file to disk
  • Call a REST API endpoint

How it works:
The server defines a tool schema (name, description, input parameters). The agent sees the tool, decides when to use it, and calls it with the right parameters.

Use case:
"Create a GitHub issue titled 'Fix login bug' and assign it to me." The agent calls the GitHub MCP server's create_issue tool.

Automatic execution:
Some clients (like Cursor) can auto-execute "safe" tools (e.g. read-only queries). Others prompt the user for approval before taking actions (e.g. posting to Slack).

3. Prompts

Prompts are reusable workflows or templates that the agent can invoke. Think of them as "things the agent can follow."

Examples:

  • "Analyze this dataset and generate a report"
  • "Review this PR for security issues"
  • "Summarize commits since the last release"

How it works:
A server exposes a list of named prompts with placeholders (e.g. {{repo_name}}). The client fills in the values and follows the steps.

Use case:
"Use the 'PR review' prompt on the latest pull request." The agent invokes the prompt, fetches the PR diff via the GitHub server's resources, and follows the review checklist.

What MCP Enables

For developers

  • Faster integrations: Use existing MCP servers instead of building custom integrations.
  • Standardized APIs: One protocol for all tools and data sources.
  • Open ecosystem: 60+ official servers and hundreds more community-built.

For AI applications

  • Access to data: Read from databases, files, APIs without custom code.
  • Take actions: Create issues, send messages, run queries—anything a tool can do.
  • Reusable workflows: Invoke prompts that encode best practices and procedures.

For end-users

  • More capable agents: Your agent can "see" your calendar, "read" your Notion docs, and "write" GitHub issues.
  • Less manual work: Instead of copy-pasting data or running scripts, ask the agent to do it.
  • Personalized AI: Connect to your own data and tools, not just public APIs.

Real-World Examples

Example 1: Database queries

Problem: You need to analyze sales data, but you don't remember the exact SQL.
Solution: Install the Postgres MCP server. Ask your agent: "Show me the top 5 products by revenue in March 2026."
What happens:

  1. The agent uses the Postgres server's query tool to inspect the schema.
  2. It writes and runs a SQL query.
  3. It returns the results in a readable format.

Before MCP: You'd manually connect to the DB, write the query, export results, and paste them into the chat.
After MCP: "Show me the data." Done.

Example 2: GitHub automation

Problem: You want to create a GitHub issue for every failing test in your CI pipeline.
Solution: Install the GitHub MCP server. Ask your agent: "Read the CI logs and create issues for each failure."
What happens:

  1. The agent reads the CI logs (via a file system server or HTTP resource).
  2. It parses the failures.
  3. For each failure, it calls the GitHub server's create_issue tool.

Before MCP: You'd manually copy test names, open GitHub, and create issues one by one.
After MCP: "Create the issues." Done.

Example 3: Multi-tool workflows

Problem: You need to analyze a Figma design, generate code, and deploy it.
Solution: Combine three servers—Figma MCP (read designs), local file system MCP (write code), and a deploy tool MCP (trigger deployment).
What happens:

  1. The agent fetches the Figma design via the Figma server's resources.
  2. It generates React components and writes them to disk via the file system server.
  3. It deploys via the deploy server's deploy tool.

Before MCP: You'd export the design, write code manually, and deploy manually.
After MCP: "Build and deploy the Figma design." Done.

Top MCP Servers to Use (2026)

Official servers (by Anthropic)

  • Filesystem — Read/write local files and directories.
  • GitHub — Create issues, PRs, read repos, search code.
  • PostgreSQL — Query and inspect Postgres databases.
  • Slack — Read channels, send messages.
  • Google Drive — Read/write Google Docs, Sheets, Slides.
  • Git — Read commit history, diffs, branches.

Community favorites

  • Notion — Read and write Notion pages and databases.
  • Jira — Create/update tickets, query issues.
  • Figma — Read design files, export assets.
  • Brave Search — Web search results.
  • Puppeteer — Browser automation (navigate, screenshot, interact).
  • YouTube — Fetch video transcripts.
  • AWS — Manage EC2, S3, Lambda, and more.

Find more: modelcontextprotocol.io/servers or search GitHub for "mcp-server."

How to Use MCP in Your Workflow

Step 1: Install an MCP client

  • Claude Desktop — Native MCP support. Install from claude.ai/download.
  • Cursor — Built-in MCP support (check settings).
  • VS Code / Zed / Windsurf — Check for MCP extensions or native support.

Step 2: Install an MCP server

Most servers are npm or Python packages. Example (GitHub server):

npm install -g @modelcontextprotocol/server-github

Or use npx to run without installing:

npx -y @modelcontextprotocol/server-github

Step 3: Configure the client

Add the server to your client's config file. Example for Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here"
      }
    }
  }
}

Restart the client. The server is now connected.

Step 4: Use it

Open the client and ask: "List my GitHub repos" or "Create an issue titled 'Fix bug'." The agent will use the GitHub server automatically.

Building Your Own MCP Server

You don't need to be an AI researcher. If you can write a function, you can build an MCP server.

Why build your own?

  • Custom APIs: Connect agents to your company's internal APIs.
  • Niche tools: Integrate services that don't have official servers yet.
  • Specialized workflows: Expose domain-specific data and actions.

Quick start

Choose a framework:

  • Python: Use the MCP Python SDK which includes the high-level FastMCP interface (recommended) and lower-level primitives.
  • TypeScript/Node: Use the MCP TypeScript SDK.

Example: A "current time" server in Python (FastMCP):

from fastmcp import FastMCP

mcp = FastMCP("time-server")

@mcp.tool()
def get_current_time() -> str:
"""Get the current time in ISO format."""
from datetime import datetime
return datetime.now().isoformat()

if **name** == "**main**":
mcp.run()

Save as time_server.py, run it, and configure your client to use it. The agent can now call get_current_time() as a tool. That's it—10 lines and your agent has a new superpower.

Steps to build:

  1. Define your primitives. What resources, tools, or prompts do you want to expose?
  2. Write the code. Use a framework to define tools and resources.
  3. Test locally. Run the server and connect a client to verify it works.
  4. Package and share. Publish to npm/PyPI or share the repo. Document the setup.

Learn more: modelcontextprotocol.io/docs/develop/build-server

Related Lessons

MCP is one piece of the agent toolkit. Two other capabilities complement it directly:

  • AGENTS.md — MCP gives agents access to tools and data. AGENTS.md tells agents how to work on your project (build commands, test steps, conventions). Use both: MCP for connections, AGENTS.md for project context.
  • Subagents — MCP servers expose tools. Subagents can use those tools in isolated contexts—e.g., a read-only database subagent that connects via the Postgres MCP server but can never run write queries.

MCP vs. Agent Skills

Both MCP and Agent Skills extend agent capabilities, but they solve different problems:

MCPAgent Skills
PurposeConnect agents to external tools and data.Give agents portable procedures and expertise.
What it providesResources (data), Tools (actions), Prompts (workflows).Instructions (SKILL.md) + optional scripts/references.
When to useYou need the agent to access something (database, API, file system).You need the agent to know how to do something (workflow, checklist, best practice).
ExampleA Postgres MCP server lets the agent run SQL queries.A "Database review" skill describes when and how to use the Postgres server (e.g. check schema first, then run this type of query).

They work together:
Install a GitHub MCP server (the tool). Add a "PR review" skill (the procedure). The skill says: "When the user asks to review a PR, use the GitHub server to fetch the diff, then follow this checklist…" The server provides access; the skill provides knowledge.

Your agent can only work with data you copy-paste. You manually fetch database results, export CSVs, and paste into chat. Same for APIs, files, and external tools.

Click "With MCP" to see the difference →

When to Use MCP vs. Custom Code

Use custom code when…Use MCP when…
You need a one-off script for a specific task.You want the agent to access a tool or data source repeatedly.
The integration is simple and won't be reused.You want the integration to work across multiple clients (Claude, Cursor, VS Code).
You're prototyping and speed matters more than reusability.You want to share the integration with your team or the community.

Rule of thumb: If you find yourself copy-pasting data or running the same script more than twice, consider building or using an MCP server.

Quick Check

What are the three core primitives that an MCP server can expose?

Quick Check

Your agent needs to create a GitHub issue from a failing test. What combination of MCP primitives does this use?

Common Pitfalls

1. Installing too many servers at once

Mistake: Installing 20+ MCP servers on day one, overwhelming the agent with context.
Fix: Start with 2-3 servers for your most common tasks (e.g. file system, GitHub, Postgres). Add more as needed.

2. Not reading the server's docs

Mistake: Installing a server and expecting the agent to "figure it out."
Fix: Read the server's README. Most servers require API keys or config (e.g. GitHub needs a personal access token). Set these up first.

3. Forgetting to restart the client

Mistake: Adding a server to the config but not restarting the client.
Fix: Always restart your MCP client (e.g. Claude Desktop) after changing the config file.

4. Mixing up MCP and skills

Mistake: Expecting MCP to teach the agent how to use a tool.
Fix: MCP provides access. Use Agent Skills to provide instructions on when and how to use MCP servers.

Security and Privacy

Who has access to what?

  • MCP servers run locally (usually) or on your own infrastructure. Your data doesn't go to a third party unless the server explicitly calls an external API.
  • Clients decide what to send. The agent (client) decides which tools to call and what data to send to the server.
  • User approval: Some clients (e.g. Claude Desktop) prompt for approval before calling "dangerous" tools (e.g. deleting files).

Best practices

  1. Use read-only mode when possible. Many servers support a read-only flag (e.g. file system can expose files but not write).
  2. Scope API keys. Give servers the minimum permissions needed (e.g. GitHub token with repo read access, not admin).
  3. Review server code. MCP servers are open source. Inspect the code before installing, especially for sensitive data.
  4. Keep secrets in env vars. Never hardcode API keys in config files. Use environment variables.

Real-World Use Cases (2026)

Use case 1: Engineering

Scenario: You're debugging a production issue.
Setup: Install file system MCP (logs), GitHub MCP (issues), and Slack MCP (notifications).
Workflow: "Read the error logs from /var/log/app.log, create a GitHub issue with the stack trace, and post a summary to #incidents on Slack."
Result: The agent does all three steps. You review and approve. 5 minutes instead of 30.

Use case 2: Data analysis

Scenario: Your PM asks: "Which features are most used by enterprise customers?"
Setup: Install Postgres MCP (data warehouse) and Google Sheets MCP (reports).
Workflow: "Query the usage table, filter by enterprise tier, aggregate by feature, and export to a Google Sheet."
Result: The agent writes and runs the SQL, creates the sheet, and shares the link. No manual export, no copy-paste.

Use case 3: Content creation

Scenario: You're writing a blog post and need to cite recent commits.
Setup: Install Git MCP (commit history) and file system MCP (write to disk).
Workflow: "Generate a changelog from the last 20 commits and save it to changelog.md."
Result: The agent fetches commits, formats them, and writes the file. You edit and publish.

Do This Next

  1. Read the overview. Open modelcontextprotocol.io/docs/getting-started/intro and skim the architecture docs.
  2. Install a client. If you don't have one, download Claude Desktop (easiest) or check if Cursor/VS Code supports MCP.
  3. Install your first server. Start with the file system server (safe, no API keys needed). Configure it in your client's config file and restart.
  4. Test it. Ask your agent: "List the files in my project directory" or "Read the README.md file." Verify it works.
  5. Add a second server. Based on your daily tasks, add GitHub, Postgres, or Slack. Use it for real work—create an issue, run a query, send a message.
  6. Combine with skills. If you use Agent Skills, write a skill that describes when and how to use your MCP servers. Example: "Database review" skill that says "Use the Postgres MCP to check schema first, then run these queries…"

By experience tier:

  • 1–3 years: Start with read-only servers: file system and Git. Ask your agent to "list files" or "show recent commits." Get comfortable with the idea that your agent can see your project.
  • 4–7 years: Add action servers: GitHub (create issues, PRs) and Postgres (run queries). Use them for real daily tasks—not demos. The value clicks when you stop exporting CSVs.
  • 8–15 years: Chain multiple servers into workflows (read logs → create issue → notify Slack). Build your first custom MCP server for an internal API your team uses daily.
  • 15–20 years: Evaluate MCP adoption across teams. Standardize which servers are approved, how API keys are managed, and what permissions each server gets. Create internal server templates.
  • 20–30 years: Drive MCP as infrastructure strategy. Every internal API should have an MCP server alongside its REST docs. This is the "API gateway for agents" pattern—you've seen this before with REST, GraphQL, and gRPC.
  • 30+ years: You've watched integration patterns evolve from CORBA to SOAP to REST to GraphQL. MCP is the next layer—purpose-built for agent consumption. The principles of clean interfaces and composability haven't changed; the consumer has.

Resources