Model Context Protocol (MCP)

MCP servers, ecosystem, building servers, and security.

Anthropic's open standard for connecting an agent to external tools and data sources — the piece that turns "I wrote a custom integration for every tool" into "I connect to a standard MCP server."

Core concepts

  1. MCP servers vs clients: A server exposes tools/resources over the protocol; your agent (the client) discovers and calls them without custom per-tool integration code. MCP Docs
  2. The growing MCP server ecosystem: Thousands of community and official MCP servers now exist for common tools (GitHub, Slack, databases, file systems) — check before building a custom integration.
  3. Building your own MCP server: Worth doing once your own product's data needs to be agent-accessible in a standard way, not just via a bespoke API.
  4. Security considerations: An MCP server is a new trust boundary — treat it with the same scrutiny as any other execution surface an agent can reach. Anthropic: MCP security best practices

What Is It?

MCP is Anthropic's open standard for connecting agents to tools and data.

Servers advertise capabilities; clients invoke them with structured requests.

Ecosystem includes reference servers for filesystem, git, databases, and more.

Why Should I Care?

Building MCP once beats maintaining N custom plugin formats.

Security reviews focus on server boundaries and scopes.

Real World Analogy

MCP is a universal power strip — your agent laptop plugs in once, and every compliant device (server) shares the same outlet shape.

Visual Mental Model

text
MCP client (IDE/agent)
       |
  MCP server -> DB / Git / SaaS

Beginner Explanation

MCP servers expose tools and resources to clients (Claude Desktop, Cursor, custom agents). Learn to run existing servers before writing your own.

Smallest Possible Example

python
# MCP server exposes tools + resources
TOOLS = ["search", "read_file"]
print("client discovers", TOOLS)

Common Mistakes

❌ Running MCP servers with root filesystem access.

Scope roots and read-only modes for dev agents.

❌ Vague tool descriptions.

Models mis-select tools; write descriptions like API docs.

❌ No transport auth (stdio vs HTTP).

Remote HTTP MCP needs TLS and tokens.

Real Project Example

Cursor IDE integrates MCP for repo-aware coding agents.

Cloudflare documents remote MCP hosting patterns.

Build This Mini Project

Run a official filesystem or git MCP server locally, connect from a client, and log one tool invocation.

Interview Question

What does an MCP server expose?

Tools (callable actions), resources (readable data), and prompts (templates) — discovered by MCP clients over the protocol transport.

Key Takeaways

  • MCP standardizes tool wiring.
  • Start with existing servers.
  • Lock down filesystem scope.
  • Describe tools precisely.

Resources

YouTube learning

Core concepts from video walkthroughs:

The 60-second story

Every new appliance used to need a new plug shape, and every new house rewired the plug. MCP is the agreement that the wall socket can look the same. A server is the appliance: it offers tools and resources. A client is the house: your agent. The agent asks “what sockets are here?” and then uses them. You stop writing a custom integration for every toaster.

The ecosystem is a junk drawer that became a catalog. GitHub, Slack, files, databases — someone may have already built the appliance. Look before you machine a new plug. Building your own server is worth it when your product’s data should be reachable by many agents, not only by the one app you wrote last quarter. You publish a socket. Other people’s agents bring their own houses.

Security is the part where the analogy gets sharp. A universal socket that can run tools is a new door into the building. Treat the server like any other door: who can open it, what it can touch, what a prompt injection in a document could ask it to do. “It speaks a standard” is not a lock.

Map the wall.

  • An MCP server is the appliance.
  • The agent is the house, the client.
  • Discovery is reading the sockets instead of hardcoding them.
  • The catalog is the drawer of appliances you might not need to build.
  • Your own server is a socket you publish for your data.
  • The trust boundary is the door, not the logo.
text
agent (client) -- discovers --> server
agent -- calls tool --> your runtime on that server

The model still does not execute the tool by magic. The server does. MCP standardizes the introduction and the call shape. It does not delete your permission checks.

The protocol exists because N agents times M tools was becoming N times M integrations, and every one drifted. A shared socket cuts that down. The cost is a door you must watch. People who install every community server on a production laptop are collecting doors.

Mental model: a universal power adapter for tools. The agent plugs in. The server does the work. You still decide which appliances are allowed in the kitchen.

You have the page if you can say client versus server in one breath, and if “check the catalog” comes before “write a server.” A standard plug is a convenience. It is not permission to leave every appliance running in the kitchen overnight.

Threads in the same domain as this chapter — go deeper on iHateReading without leaving the roadmap.

New AI agents SDKs and a few changes in programming cover

New AI agents SDKs and a few changes in programming

SDK launches and workflow tools worth wiring into agent backends.

Agent harnessing: the part of building AI agents nobody talks about cover

Agent harnessing: the part of building AI agents nobody talks about

Loop, tools, memory, sandbox, and tracing live in your code — not the model weights.

AI agent system that researches 100 blogs a day cover

AI agent system that researches 100 blogs a day

RSS, Reddit, YouTube transcripts, and URL hashing for a research pipeline.