DEV Community

Cover image for Quick overview of Model Context Protocol (MCP)
jldec
jldec

Posted on • Originally published at jldec.me

Quick overview of Model Context Protocol (MCP)

MCP is a protocol for integrating AI applications with external data and other services. It was created by Anthropic as a way for Claude to access resources on the desktop.

MCP servers can be coded do almost anything, including network calls to other services. This has led to MCP being talked about as a foundation for building AI agents, even though its desktop-centric design is far from the Web protocols you might expect.

The following is a quick overview of MCP. For additional information, I recommend:

  1. This video by Mahesh
  2. The MCP user guide
  3. The MCP spec
  4. Reference MCP servers
  5. Swyx's spicy take

MCP clients and servers

How it works

To make a tool call, the MCP client exchanges JSON-RPC messages with the MCP server.

A desktop client will spawn servers as subprocesses so that it can communicate with them over stdio.

Besides tool calls, the protocol also supports:

There are debugging tools and SDKs for Python, Typescript, Java, and Kotlin.

Why are people excited?

Talking to your own tools feels like magic.

Image description

Here is another example from Cloudflare.

Gotcha

The way Claude Desktop spawns servers in subprocesses has resulted in a few pitfalls. I ran into this myself after configuring the filesystem server as described in the quickstart.

Image description

The error stems from differences in the PATH when Claude Desktop spawns server subprocesses. One fix is to use absolute paths in ~/Library/Application Support/Claude/claude_desktop_config.json on MacOS. E.g.

{
  "mcpServers": {
    "filesystem": {
      "command": "/Users/jldec/n/bin/node",
      "args": [
        "/Users/jldec/mcp/servers/src/filesystem/dist/index.js",
        "/Users/jldec/mcp/claude"
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

What's next?

The buzz is real, but it's early days and AI agent platforms are just getting started.

  • I'm optimistic for HTTP to supplant stdio, especially with the recent announcement of remote servers with auth. This is particularly important for scaling agents on the network and supporting multiple clients per server.

  • A registry should accelerate the network effects of MCP, making servers and their capabilities more discoverable e.g. by other agents.

  • .well-known/mcp.json provides a way for agents to find AI interfaces on websites without the need for a central registry.

  • Stateless requests, streaming, and namespacing - all good things adopted from Web protocols.

🚀

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay