mcp-demo
A minimal MCP server example demonstrating Tools, Resources, and Prompts. It enables calculations, time queries, note management, and code review prompts via stdio transport.
README
mcp-demo
一个最小可用的 MCP (Model Context Protocol) Server 示例,使用 TypeScript SDK 编写,演示 MCP 的三大核心原语:
| 原语 | 示例 | 说明 |
|---|---|---|
| Tools | calculate / get_current_time / add_note |
由模型调用的动作 |
| Resources | info://server / note://{name} |
客户端可读取的数据(含动态资源模板) |
| Prompts | code_review / summarize_notes |
暴露给用户的提示词模板 |
通过 stdio 传输,可直接接入 Claude Desktop、Claude Code 或任何 MCP 客户端。
快速开始
npm install
npm run build
npm start # 启动编译后的 server
# 或开发模式
npm run dev
使用 MCP Inspector 调试
npm run inspect
会启动一个网页版调试器,可以交互式地调用 tools、读取 resources、预览 prompts。
接入 Claude Code
claude mcp add mcp-demo -- node /path/to/mcp-demo/dist/index.js
接入 Claude Desktop
在 claude_desktop_config.json 中添加:
{
"mcpServers": {
"mcp-demo": {
"command": "node",
"args": ["/path/to/mcp-demo/dist/index.js"]
}
}
}
项目结构
src/
index.ts # 全部 server 逻辑:tools / resources / prompts 注册 + stdio 启动
示例交互
接入后可以试试:
- “帮我算一下 123 × 456” → 触发
calculate工具 - “现在上海几点?” → 触发
get_current_time工具 - “记一条笔记 todo:明天写周报” → 触发
add_note,然后可通过note://todo资源读取
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.