DIY MCP Server
What Is This About?
Since MCP servers (AI agents or Agentic AI) are all the rage, I figured "how hard can it be to build one?"
What Is MCP?
MCP and the AI Agent Landscape |
Model Context Protocol (MCP) is an open standard created by Anthropic (the makers of Claude.ai) to action the promise of Agentic AI or AI Agents, that are supposed to be the intermediaries between humans and AI to help humans get stuff done. They also help Claude connect to the outside world, like the Web or your filesystem.
Give Me More Context
Claude's training with public data ended around October 2024. So, when you ask a question, Claude isn't generally aware of late-breaking information. Claude also doesn't automatically carry memories or context of what you discussed in earlier chat sessions.
That's where MCP servers come in. They allow Claude to access data it wasn't trained with and use its training to answer our "today" questions using a combination of "training from yesterday" and "new data from today" via MCP servers.
Think of MCP as giving your AI:
- 🧠 An even better brain
- 💾 A longer memory
- 🧭 A more current and accessible map of its world and tools
- 🎯 A sense of purpose
- 🛠️ The ability to act, not just pontificate
How can MCP servers help me?
Something to note: MCP servers can generally only be leveraged by Claude Desktop (e.g. on Mac), not via the Web version (https://claude.ai/).
On my Desktop version, I have many MCP servers installed. Here are a few examples:
- File System. Lets me ask Claude questions about information that is on my file system and obviously wasn't available to Claude when it was trained on publicly available information.
- Brave Search. Information is getting published on the Web everyday. And several MCP servers can be integrated into Claude Desktop to bring that information to Claude.
- Memory. Claude obviously doesn't know anything about you unless you let Claude know your name and ask it to search the public domain. Claude might find your LinkedIn, but it still wouldn't know your inner thoughts (how you grew up, the events that shaped you) unless you share them with Claude. And once you share them, the Memory MCP server is able to store them (privately) on your machine (in JSON format) so that Claude is able to remember them and reference them for future conversations.
So, you can ask Claude, "what should I watch this week?" And Claude responds with matches sourced from the Web, but filtered based on knowing what you like to watch and formatted in the most consumable format per your stated preferences. Isn't that radical!
I've had Claude make me a whole list of stuff to watch this month based on my genre preferences, the ratings thresholds I like to stick to on IMDB and Rotten Tomatoes, and whatever else you can think of.
If you want your AI to behave more like an agent and less like a chatbot, MCP is the spine that holds that whole structure together.
Yup, sorry to make this all about Claude. But when it comes to MCP servers (AI Agents or Agentic AI), Claude is at the center of it. So, I used Claude to exemplify the MCP value proposition.
But MCP is an open standard and doesn't depend on Claude in order to work its wonders.
Scaffolding
What better way to learn MCP than to create an MCP server, hook it up to Claude and see how it works and what it can do?
My goal is not to come up with business ideas but to give you a technical framework to implement your ideas.
Your ideas could be commercial or social or something else. Fire doesn't care whether it is used to generate heat to keep people from freezing or burn down homes. It depends on how you use it,
But the framework I have provided will hopefully let you extend Claude to bring it into the real world.
The DIY Part
The entire process I followed is really well documented in the readme files on Github. But high-level, I'm hosting the MCP server on a NodeJS environment using AWS Lambda.
Lambdas provide the scalability, cost-efficiency, high availability, and seamless integration with the awesome AWS ecosystem (logging, monitoring, email, and storage, just to name a few). However, Lambdas are also stateless and Claude requires a stable persistent connection per the MCP protocol.
Therefore, I have an MCP client that runs locally on my machine to provide that stable connection to Claude (via standard IO that's part of the MCP SDK) and serves as an intermediary between Claude and the MCP server running on Lambda.
Here's the code (client, server) with documentation and tests demonstrating how I got this done. Bring on the questions.
Additional Resources
Comments
Post a Comment