DIY MCP
A from-scratch implementation of the Model Context Protocol (MCP) for building servers and clients, using a Chinese tea collection as an example.
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.
<div align="center"> <img src="images/client.png" alt="MCP client CLI" /> </div>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.ts
MCP 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 build
Running
You can test the MCP server with MCP Inspector, an interactive tool for testing and debugging MCP servers.
cd server
npm run inspector
MCP 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 install
To 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 .env
Running
The client will automatically start the MCP server, so ensure you've built it first.
cd server
npm run build
cd client
npm start
Usage
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
Related Servers
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Modellix Docs
Search the Modellix knowledge base to quickly find relevant technical information, code examples, and API references. Retrieve implementation details and official guides to solve development queries efficiently. Access direct links to documentation for deeper context on specific features and tools.
MCP Android Agent
Automate Android devices using the uiautomator2 library, requiring adb and a connected device.
@shipsite/mcp
Deploy static websites
Script Generator Server
A simple note storage system with tools for adding notes and generating scripts from them.
Tailkits UI
Tailwind Components with Native MCP Support
Claude Project Coordinator
Manage and coordinate multiple Xcode/Swift projects with features like project tracking, smart search, and analytics.
MCP Jenkins Intelligence
AI-powered Jenkins pipeline intelligence platform with natural language interface. Provides comprehensive pipeline analysis, failure prediction, optimization suggestions, and automated Jenkinsfile reconstruction using Model Context Protocol (MCP) integration.
Locust MCP Server
An MCP server for running Locust load tests. Configure test parameters like host, users, and spawn rate via environment variables.
NodeMCU MCP
An MCP service for managing NodeMCU (ESP8266) IoT devices.
CodeSeeker
Graph-powered code intelligence MCP server with semantic search, knowledge graph, and dependency analysis for Claude Code, Cursor, and Copilot.