About Learning about MCP
Learning about MCP is a Node-based MCP server project and learning exercise. Its README documents MCP primitives, transports, and server-side error handling, while noting sampling and roots remain to be implemented.
Key features
- 01Node-based server implementation
- 02Notes on stdio and SSE transports
- 03Descriptions of MCP core primitives
- 04Built-in SDK error handling
Use cases
- 01Learning MCP server concepts
- 02Reviewing transport options
- 03Understanding server tool error handling
MCP support
The project is an MCP server learning exercise. It discusses resources, prompts, tools, sampling, roots, and stdio and SSE transports; sampling and roots are listed as TODOs.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMELearning about MCP
TODO:
-
Implement sampling https://modelcontextprotocol.io/docs/concepts/sampling
-
Implement roots.
Learnings
-
There are two transport methods:
-
Via stdio. Here, you have to provide a path to a server binary client can use.
-
Via sse. Here, you have to provide a network address for the server.
- This transport method seems more universal to me. It allows the server to be deployed separately than the client.
-
-
I really wanted to use
fastifyfor the server, but I could not make it work with the existing SDK.- This is a great opportunity to learn how to write such server using only Node!
-
Core primitives that relate to MCP are:
-
Resources – You can think of these as data (like PDFs, database records and so on) that client can use to shape the correct response to the users query.
-
Prompts – Think of those as pre-defined prompts you sometimes see under the text box in "prompt to x" flows.
-
Tools – Those allow the LLM to perform actions on the user behalf. It is the server that calls the tool and responds with the result to the client. Clients job is to then pass the results to the LLM.
-
Sampling – To be honest, I'm unsure what those are yet.
-
Roots – Those define the "boundaries" of the server. For example, if your server exposes a tool that works with the file system, you could include specific directory in the "roots" so that the tool is "bounded" only to that directory.
-
Transports – Already wrote about them above. There is the STDIO and SSE transport. As for the messages, they are formatted via JSON-RPC 2.0.
-
-
I really like the fact that the SDK has error-handling built-in.
- I can throw an error in the server
toolcallback function, and the client SDK will handle that, and respond accordingly.
- I can throw an error in the server
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.