# MCP Server Examples: Learning From a Reference Server

> Canonical: https://skillalmanac.com/learn/mcp-server-examples | Updated: 2026-11-21 | Index status: not offered to search engines

Learn an MCP server's shape from the official reference servers: repo layout, tool declarations, transports, and the stdout mistake that breaks stdio.

## Facts

- 2026-11-21: The reference servers repo lists seven servers: Everything, Fetch, Filesystem, Git, Memory, Sequential Thinking and Time (https://github.com/modelcontextprotocol/servers)
- 2026-11-21: The README starts TypeScript reference servers with npx and Python ones with uvx (https://github.com/modelcontextprotocol/servers)
- 2026-11-21: Every reference server can also serve Streamable HTTP at http://127.0.0.1:3001/mcp, with the address set by PORT and HOST (https://github.com/modelcontextprotocol/servers)
- 2026-11-21: For stdio servers, writing to stdout corrupts JSON-RPC messages, so logs must go to stderr (https://modelcontextprotocol.io/docs/develop/build-server)
- 2026-11-21: The Python tutorial declares a tool with an @mcp.tool() decorator on an async function, and runs the server with mcp.run(transport="stdio") (https://modelcontextprotocol.io/docs/develop/build-server)

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

1. Clone the repository and open one folder, such as `src/time`. Note the entry file and the package manifest.
2. 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.
3. Start the server the way its README says. Python servers use `uvx mcp-server-time`; TypeScript servers use `npx -y @modelcontextprotocol/server-memory`. Both default to stdio, where the client launches the process itself.
4. For manual inspection, switch to Streamable HTTP. The default endpoint is `http://127.0.0.1:3001/mcp`. Change the port with `PORT`, change the host with `HOST`, or pass `--transport streamable-http`.
5. Register the server in an MCP host. Add an entry under `mcpServers` with a `command` and `args`. The README says that on Windows, `npx` should be wrapped with `cmd /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()` or `console.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 uses `console.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 `npx` directly. 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 `PORT` to 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](/skills/skill-almanac/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

- [mcp-server-builder](https://skillalmanac.com/skills/skill-almanac/mcp-server-builder.md): Platform Score 56/100 (provisional)

## Related guides

- [Debug an MCP Server with MCP Inspector](https://skillalmanac.com/learn/debug-an-mcp-server-with-inspector.md)
- [MCP Client vs MCP Server: Who Starts Calls and Holds Keys](https://skillalmanac.com/learn/mcp-client-vs-mcp-server.md)
- [Python MCP server quickstart: build and connect one locally](https://skillalmanac.com/learn/python-mcp-server-quickstart.md)
- [MCP Tools, Resources, and Prompts: Which to Use](https://skillalmanac.com/learn/mcp-tools-resources-prompts.md)
- [What Are MCP Apps? Interactive UI in AI Chats](https://skillalmanac.com/learn/what-are-mcp-apps.md)
- [How MCP Servers Work: Message Flow and Transports](https://skillalmanac.com/learn/how-mcp-servers-work.md)

## Sources

- https://github.com/modelcontextprotocol/servers
- https://modelcontextprotocol.io/docs/develop/build-server

Platform Scores report our assessment under a published method. They are not a safety guarantee.
