MCP Server Examples: Learning From a Reference Server
Learn an MCP server's shape from the official reference servers: repo layout, tool declarations, transports, and the stdout mistake that breaks stdio.
Updated · Markdown version
The fastest way to learn what an MCP server looks like is to read one that the protocol maintainers wrote, then compare it with a small tool-declaring example. The official reference repository and the Python build tutorial together show the parts every server shares: tool declarations, a transport, and a process that speaks JSON-RPC.
What the reference repository contains
As of 2026-11-21, the repository lists seven reference servers: Everything, Fetch, Filesystem, Git, Memory, Sequential Thinking and Time. Each one has its own folder under src/, so you can open a single folder and read a complete server without the rest. Pick by what you want to learn. Time has a narrow, single-purpose scope. Filesystem shows configurable access controls over a real side effect. Everything is a test server that exposes prompts, resources and tools in one place.
Read a server in five steps
- Clone the repository and open one folder, such as
src/time. Note the entry file and the package manifest. - Locate the tool declarations. In the Python tutorial, the function name becomes the tool name, the docstring documents the arguments, and the type hints define the parameters.
- Start the server the way its README says. Python servers use
uvx mcp-server-time; TypeScript servers usenpx -y @modelcontextprotocol/server-memory. Both default to stdio, where the client launches the process itself. - For manual inspection, switch to Streamable HTTP. The default endpoint is
http://127.0.0.1:3001/mcp. Change the port withPORT, change the host withHOST, or pass--transport streamable-http. - Register the server in an MCP host. Add an entry under
mcpServerswith acommandandargs. The README says that on Windows,npxshould be wrapped withcmd /c.
Check that it worked: the host lists the same tool names and descriptions you found in step 2. If a tool is missing, the process failed to start or the declaration was not registered.
Two shapes side by side
| Feature | Reference repository | Build tutorial (weather server) |
|---|---|---|
| Languages shown | TypeScript (npx), Python (uvx) | Python; TypeScript and Java variants also documented |
| Tool declaration | One folder per server | @mcp.tool() on an async function |
| Default transport | stdio | stdio via mcp.run(transport="stdio") |
| Start command | npx or uvx | uv run weather.py |
Choose the reference repository when you want breadth across several servers and different domains. Choose the tutorial when you are writing your first tool and want the smallest complete file.
Pitfalls
- Stdout output breaks stdio servers. A stray
print()orconsole.log()corrupts the message stream. Notice it when the host reports a parse error or disconnects right after launch. Send logs to stderr instead; the TypeScript tutorial usesconsole.error. - A hand-started stdio server looks hung. It waits for a client on standard input. Notice it when the only output is a single startup line. Launch it from a host, or switch to Streamable HTTP for manual requests.
- Copying a Unix config to Windows fails silently. The host cannot spawn
npxdirectly. Notice it as a server that never appears in the tool list. Wrap the command:"command": "cmd", "args": ["/c", "npx", "-y", "..."]. - Port collisions on HTTP. The default port is 3001. Notice a bind error at startup. Set
PORTto a free value and update the client URL to match. - Treating a reference server as a finished product. These are examples. Filesystem access rules, for instance, must be configured for your directories before you rely on them.
When to use a skill instead
Reading examples builds intuition, but a server that other people will connect to needs decisions the examples leave open: whether a capability should be a tool, a resource or a prompt, how errors should be shaped, and how transport and authentication fit together. The mcp-server-builder skill reviews a server design against those decisions, including input schemas, output size and transport choice. Use it after reading one example and before you commit to a design. For a throwaway script that no client will call, a skill adds little.
FAQ
What is an MCP server? Put simply, an MCP server is a program that offers tools, resources or prompts to a host application and speaks JSON-RPC with it. The host starts it or connects to it, then offers its tools to a model, which calls them with user approval.
Which reference server should I read first? Start with Time, whose job is limited to time and timezone conversion, so the code stays focused on the protocol. Read Filesystem next to see how access controls are configured.
Can I test an MCP server without a host app? Yes. Run it with Streamable HTTP and send requests to the endpoint, which defaults to http://127.0.0.1:3001/mcp. A stdio server expects a client on the other end, so a server started by hand only waits for input.
Related skills in this catalog
Platform Score is our assessment under a published method. It is not a safety guarantee.
Related guides
Sources
- https://github.com/modelcontextprotocol/servers (accessed 2026-11-21)
- https://modelcontextprotocol.io/docs/develop/build-server (accessed 2026-11-21)
This page is not offered to search engines yet: The content file does not mark this page indexable yet.