diy-mcp
From scratch Model Context Protocol implementation with example Chinese tea collection
Documentation
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 teas
- `tea://teas/{slug}`: Details of a specific tea
- Tools:
- `getTeasByType`: Get all teas of a specific type
- `getTeasByRegion`: 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:
1. "What teas do you know about?"
2. "Which teas come from Fujian?"
3. "What is your favorite green tea?"
Resources
Frequently asked questions
What is diy-mcp?
diy-mcp is From scratch Model Context Protocol implementation with example Chinese tea collection
How do I install diy-mcp?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is diy-mcp open source?
Yes — it is hosted on GitHub at https://github.com/mwpryer/diy-mcp and has 1 stars.
Related MCP tools
Model Context Protocol Servers
The Open-Source Multimodal AI Agent Stack: Connecting Cutting-Edge AI Models and Agent Infra
A MCP for Claude Desktop / Claude Code / Windsurf / Cursor to build n8n workflows for you
MCP server to provide Figma layout information to AI coding agents like Cursor
The world's best AI personal assistant for email. Open source app to help you reach inbox zero fast.
Instant is the best backend for AI-coded apps. You get auth, permissions, storage, presence, and streams — everything you need to ship apps your users will love.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP