KatalockAi AcademyBack to KatalockAi
Phase project, required for the Phase 13 certificate

Stateless MCP Server for a Real Data Source

Wrap a real data source of your choice in a stdio MCP server that follows the 2026-07-28 stateless contract, with well-designed tools, resources, a prompt, and wire-level conformance tests.

about 7 h Reviewed against a 6-point rubric
Submit your project Get coached by Professor Katalock

Lessons this project uses

  1. 1Tool Schema Design - Naming, Descriptions, Parameter ConstraintsPhase 13: Tools and protocols
  2. 2MCP Fundamentals: Stateless Requests and JSON-RPCPhase 13: Tools and protocols
  3. 3Building an MCP Server: Stateless Python and TypeScriptPhase 13: Tools and protocols
  4. 4MCP Transports: stdio and Stateless Streamable HTTPPhase 13: Tools and protocols
  5. 5MCP Resources and Prompts: Addressable Context for Stateless ServersPhase 13: Tools and protocols
  6. 6MCP Tool Contracts and ContentPhase 13: Tools and protocols

What You'll Build

An MCP server that exposes a real data source you care about through the stateless MCP 2026-07-28 contract taught in lessons 06 and 07: every request carries its own metadata, server/discover is implemented, and there is no handshake or protocol session. Pick one source: a free no-key public HTTP API (weather, public transport, a library catalog, an open government dataset) or a local open dataset loaded into SQLite or CSV (your shop's product list, a city's bus stops, a public holiday calendar). You also write a small stdio client script and tests that check the wire, not just your Python functions.

Requirements

  1. Transport. Newline-delimited JSON-RPC 2.0 over stdio: only JSON-RPC messages on stdout, diagnostics on stderr, flush per response, exit promptly on stdin EOF, and no response to notifications (lesson 09).
  2. Per-request validation. Every request must carry io.modelcontextprotocol/protocolVersion and io.modelcontextprotocol/clientCapabilities in params._meta. Missing or malformed metadata returns -32602. An unsupported version returns -32022 with data.requested and data.supported. The server must never reuse metadata from an earlier request; prove it with a test.
  3. Discovery. server/discover returns resultType: "complete", supportedVersions, capabilities, short instructions, ttlMs, cacheScope, and server identity in result _meta. Every successful result carries resultType and server identity.
  4. Tools (at least 3, atomic). Follow lesson 05: snake_case verb-noun names with a namespace prefix, descriptions in the "Use when X. Do not use for Y." form under 1024 characters, additionalProperties: false, enums for closed sets, a pattern on any ID field, and annotations (readOnlyHint and friends) as hints only. At least one tool declares an outputSchema and returns matching structuredContent plus a serialized text block.
  5. Two error layers. Unknown tool or invalid arguments is a JSON-RPC error. A valid call whose execution fails (upstream down, date out of range, no match) returns isError: true with a message written to teach the model what to try next, still conforming to the output schema if one is declared (lesson 28).
  6. Resources and a prompt. resources/list (deterministic order, cache hints) and resources/read for at least two URIs in your own namespace (for example busstops://stop/1234); an unknown URI returns -32602. One prompt via prompts/list and prompts/get. Choose cacheScope deliberately and explain the choice.
  7. Offline determinism. If you use a live API, record fixtures so tests and the demo can run with no network (--offline). Lists must come back in the same order regardless of insertion order.
  8. Client script and tests. client.py launches the server as a subprocess and runs a scripted session: discover, list tools, call every tool once, read a resource, get the prompt, send one unsupported-version request. Save the full request and response transcript to results/transcript.jsonl. Write at least 12 tests covering requirements 1 to 6.

Constraints

  • Python 3 standard library is enough (the lesson servers use only stdlib); TypeScript is also fine. If you use an MCP SDK, it must produce the 2026-07-28 per-request behavior above, and your tests must still assert on raw JSON lines.
  • No paid API keys. Runs on any laptop CPU. No model is required to build or test the server.
  • Treat data from the source as untrusted content, not instructions; do not echo it into tool descriptions.
  • Bind nothing to a network port; this project is stdio only.

Stretch Goals

  • Add resources/templates/list and a cursor-paginated tools/list where an empty-string cursor is handled correctly.
  • Connect the server to a real MCP host or to a tool-calling loop backed by any OpenAI-compatible endpoint or local model, and show one real model-driven call.
  • Add the Streamable HTTP binding from lesson 09 on loopback only, with Origin validation.

How to Submit

Public GitHub repo with README.md, server.py, client.py, tests/, fixtures/ (if using a live API), and results/transcript.jsonl. The README must state the data source and why you chose it, how to run the server, the client and the tests (online and offline), a table of your tools with their annotations, your cache-scope choices, and a short reflection on one contract mistake your tests caught. Paste the client output and the test output when submitting.

How It's Reviewed

Professor Katalock reads your repository and the evidence you paste, and scores each criterion out of 100. You pass with a weighted total of 70 or more and no criterion below 40. A copied or padded submission is flagged and fails.

CriterionWeightHow it's checked
Stateless protocol conformance25Transcript and tests show per-request _meta validation, -32602 for missing metadata, -32022 with requested and supported, server/discover fields, resultType and serverInfo on every success, and a test proving metadata is not reused.
Tool contract and schema design20Tools follow lesson 05 naming and description rules with additionalProperties false, enums and ID patterns; at least one outputSchema with matching structuredContent; protocol errors and isError results are used for the right cases.
Resources, prompt and transport15resources/list and resources/read work with deterministic order and deliberate cache hints, unknown URI gives -32602, a prompt renders, stdout carries only JSON-RPC and the server exits on EOF.
Tests and reproducibility15At least 12 passing tests that assert on raw JSON lines; offline mode runs without network; one command reproduces the transcript.
Code quality10Validation, routing, handlers and data access are separated; a single result wrapper adds resultType and server identity; no secrets in the repo.
README and reflection15README explains the data source choice, tool table, cache-scope reasoning, limitations, and a specific contract bug the tests caught.

Submit

Push your work to a public GitHub repository with a README that explains how to run it, then paste the evidence below. Up to 3 reviews a day, free.

  • Full terminal output of python client.py (or the offline variant)
  • The first 20 lines of results/transcript.jsonl, including the discover request and the -32022 error
  • Full output of the test run
  • Your tools/list response showing names, descriptions and schemas
  • One paragraph naming the data source and a contract mistake your tests caught

Reviews are done by AI against the rubric above. They check the evidence in your repository; they are not a substitute for a human code review, and a review can be wrong. If you think it is, improve the README so the evidence is unmistakable and resubmit.