DEV Community

Cover image for Real MCP has a lot going on - but the core idea is this simple
KUSHAL BARAL
KUSHAL BARAL

Posted on

Real MCP has a lot going on - but the core idea is this simple

MCP (Model Context Protocol) is everywhere right now. Claude uses it, Cursor uses it, a ton of AI tooling is being built on top of it. There's an official SDK, servers, transports, capabilities negotiation... it can feel like a lot.

But when I actually dug into what MCP is doing at its core, I realized — it's just structured JSON going back and forth. That's the whole idea. So I built a minimal version from raw Python, no libraries, to make sure I actually understood it before touching the real thing.

What MCP actually is

Strip away the SDK and the spec details — here's the mental model:

  • a server exposes tools (functions an AI can call)
  • a client discovers those tools and calls them by name
  • everything is JSON, every message has a predictable shape

The real MCP spec adds things like capability negotiation, resource types, prompt templates, SSE transport, and more. But that core loop — client asks, server responds with a tool result — is the same.

Think of it like HTTP but designed specifically for AI agents calling tools. The protocol exists so any agent can talk to any server without needing custom glue code.

What I built to understand it

Two versions, zero external dependencies — just Python stdlib:

Basic version — the absolute minimum:

  • client sends a JSON request
  • server reads it from stdin
  • server runs a tool
  • server replies with JSON on stdout

Richer version — closer to real MCP, adds a JSON-RPC style flow:

  • initialize — handshake, server returns its name and version
  • tools/list — client asks what tools exist
  • tools/call — client calls a tool by name with arguments

That three-step flow is basically what happens every time an AI agent connects to a real MCP server.

How a protocol works (the bit no one explains)

Two processes agree on a message format, then just talk. That's it. In this case:

  • the server sits there reading stdin line by line
  • the client writes one JSON object per line, reads one JSON response back
  • no sockets, no framework — just text in an agreed shape

Real MCP uses stdio transport for local servers and SSE for remote ones. Same idea, just fancier plumbing.

Try it

python3 basic-mcp-server.py
Enter fullscreen mode Exit fullscreen mode

Type a raw request:

{"tool": "say_hello", "arguments": {"name": "bro"}}
Enter fullscreen mode Exit fullscreen mode

Get back:

{"result": "Hello bro"}
Enter fullscreen mode Exit fullscreen mode

No library. No magic. Just Python reading and writing JSON — same as what the real SDK wraps.

Full code here → https://github.com/kushal1o1/Mcp-basics


Now I want to build an actual MCP module on top of this foundation — something useful, something real. A devtool? A workflow helper for AI agents?

Drop your idea in the comments — what MCP module should I build next? I'll pick the most interesting one and document the whole thing.

Top comments (0)