I wrote a decent MCP server for AI today

It was a lot of fun writing a Model Context Protocol Server so that an AI-enabled IDE was able to use my data. For all the wrong reasons though.

If you never looked at the MCP spec, it is a total disaster. It is certainly AI-generated and clearly not a single software engineer was involved.

I did write an "MCP Server" and even hooked it up to Zed.dev editor I installed specifically to test out the agentic AI coding. Here is a catch though... It is a tiny bash script. It reads JSON from stdin (with jq) and writes one of 3 possible JSON responses to stdout (it is just echo).

I can not even estimate how many such tiny text-processing scripts I wrote throughout my career. Most of it I never even saved anywhere, except my shell's history. Really, when I type | jq '.data[]|.attributes.name' at the end of a curl call I do not even think of it much. And yet this is exactly the kind of "AI extension" and "MCP server" code I see published to GitHub for most of those categories.

Technically the spec does contain some provisions for a real server (HTTP). But Zed.dev does not support it. It only supports what they called "stdio" protocol. And there is no server architecture involved. I have no idea why they even had the idea to call it a "Server" - it is just a basic CLI executable. Is cat a "server" as well?

The spec is incredibly long and is full of repeated details. The fun part - you do not need any of that. The 3 possible JSON responses you need to start with are:

  1. initialize - and you can return just a static JSON content introducing your "Server". Just replace the response id with of the id from the request.

  2. tools/list - and you can return another static JSON with the list of commands you plan to support. The id placeholder replacement is all you need again.

  3. tools/call - finally a place you can get a little more creative. Return what you want the user and AI to see when they call your "MCP Server".

Technically, you do not even to parse the input JSON. As long as you regex out the command and id you can just switch over possible commands and substitute the id in the response.

That is all there is. It took me less than an hour to write my first ever MCP Server. And this includes staring into the MCP spec in disbelief.

Posted On

Category:

Tags: /