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.
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
Serveurs connexes
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Remote MCP Server (Authless)
An example of a remote MCP server deployable on Cloudflare Workers without authentication.
Scientific Computation MCP
Provides tools for scientific computation, including tensor storage, linear algebra, vector calculus, and visualization.
codesight
CLI token optimizer and AI context generator with built-in MCP server. Scans codebases to extract routes, schema, components, and dependencies 9x–13x token reduction for Claude Code, Cursor, Copilot, Codex, and Windsurf.
hivekit-mcp
MCP server for git-native agent swarm coordination, providing tools for heartbeat, state, task claiming, and logging across distributed AI agents.
OpenZipline MCP
Provides secure, standards-compliant smart contract templates for tokens, access control, finance, and governance.
Python Notebook MCP
Enables AI assistants to interact with local Jupyter notebooks (.ipynb).
Authless Remote MCP Server
An authentication-free, remote MCP server designed for deployment on Cloudflare Workers.
Remote MCP Server on Cloudflare
A remote MCP server deployable on Cloudflare Workers with OAuth login support and local development capabilities.
Inoyu Apache Unomi
Maintains user context and manages profiles using the Apache Unomi Customer Data Platform.
MCP HAR Server
Parses HAR (HTTP Archive) files and displays requests in a simplified format for AI assistants.