
DIY MCP
โ 1from mwpryer
A from-scratch implementation of the Model Context Protocol (MCP) for building servers and clients, using a Chinese tea collection as an example.
โ labsco summary โ our analysis, not the vendor's
What it is โ a from-scratch, educational MCP implementation (server + client) using a Chinese tea collection as the example dataset.
What you get โ
- A minimal stdio MCP server exposing tea resources (
tea://teas,tea://teas/{slug}) and tools (getTeasByType,getTeasByRegion) - A companion CLI client with three modes: ask the LLM, fetch a resource directly, or call a tool directly
- Example prompts to learn from ("Which teas come from Fujian?", "What is your favorite green tea?")
Requirements โ an Anthropic API key (ANTHROPIC_API_KEY) with credits for the LLM client; Node.js to build both halves.
Cost snapshot โ free to run; the client fronts the Anthropic API, so LLM usage is billed by Anthropic. License isn't stated in the metadata.
Setup effort โ self-host: build the server, npm install the client, copy .env.example to .env and add your key.
Our take โ a great learning reference for how MCP works under the hood. Caveat: the README itself says to use the official MCP SDKs for production โ this is a teaching example, not a library.
Source: the project README โ summarized 2026-07-08.
โ readme from github โ mirrored (latest on GitHub โ)
DIY MCP
A simple from-scratch implementation of the Model Context Protocol (MCP) for building MCP servers and clients using stdio. This example uses a simple Chinese tea collection with descriptions, origins, etc.
For production applications, check out the official MCP SDKs.
Project Structure
mcp/
โโโ server/ # MCP server for Chinese tea information
โ โโโ src/
โ โโโ index.ts
โ โโโ stdio.ts
โ โโโ teas.json
โโโ client/ # MCP client CLI with Claude as LLM
โโโ src/
โโโ index.ts
โโโ llm.tsMCP Server
The core of this implementation is a lightweight MCP server. It offers the following resources and tools:
- Resources:
tea://teas: List of all available teastea://teas/{slug}: Details of a specific tea
- Tools:
getTeasByType: Get all teas of a specific typegetTeasByRegion: Get all teas from a specific province or region
Setup
cd server
npm install
npm run buildRunning
You can test the MCP server with MCP Inspector, an interactive tool for testing and debugging MCP servers.
cd server
npm run inspectorMCP Client
You can interact with the MCP server through an MCP client like Claude Desktop, alternatively, you can use the included DIY MCP client. By adding your Anthropic API key, you can have Claude intelligently determine which tools to use based on your prompt.
The client provides three interaction modes:
- Ask LLM: Let Claude interact with the MCP server
- Get a resource: Directly access MCP server resources
- Use a tool: Directly call MCP server tools
Setup
cd client
npm installTo use Claude, first copy the example environment file and add your Anthropic API key with available credits to the ANTHROPIC_API_KEY variable:
cp .env.example .envRunning
The client will automatically start the MCP server, so ensure you've built it first.
cd server
npm run buildcd client
npm startUsage
Once running, you can interact with the MCP server through the MCP client CLI. Try asking the LLM some questions about Chinese tea:
- "What teas do you know about?"
- "Which teas come from Fujian?"
- "What is your favorite green tea?"
Resources
cd server
npm install
npm run buildBefore it works, you'll need: ANTHROPIC_API_KEY
No common issues documented yet. If you hit a problem, the repository's GitHub Issues page is the best place to look.