my-mcp-server
my-mcp-server
一个使用 TypeScript 构建 MCP (Model Context Protocol) 服务器的游乐场和实验项目。它演示了如何通过 stdio 传输向 AI 代理和语言模型暴露 工具 和 资源。
该服务器管理一个简单的用户数据库(以本地 JSON 文件为后端),并暴露 AI 代理可以调用以读取或创建用户记录的端点。
功能特性
工具 —
my-create-tool:通过接受name、address、email和phone字段创建新用户,并将记录持久化到src/users.json。资源 —
users://all:以 JSON 形式返回模拟数据库中的完整用户列表。资源 —
users://{userId}/profile:返回由userId标识的单个用户的个人资料。
Related MCP server: FastMCP Example Server
先决条件
安装
npm install运行服务器
开发模式(使用 tsx,无需构建步骤)
npm run server:dev构建并运行编译输出
npm run server:build # compiles TypeScript → JavaScript
node dist/server.js # run the compiled server监视模式(更改时自动重新编译)
npm run server:build:watch使用 MCP Inspector UI 进行检查
MCP Inspector 允许您在浏览器 UI 中交互式调用工具并浏览资源:
npm run server:inspect注意:
server:inspect设置DANGEROUSLY_OMIT_AUTH=true— 仅用于本地开发。
在代理环境中加载 MCP 服务器
代理 CLI(例如 Claude Code CLI)
代理应能检测到 .mcp.json 的存在并提示加载服务器。否则,它是一个简单的 MCP 服务器配置,需要与其他服务器一起添加到配置中。
项目结构
my-mcp-server/
├── src/
│ ├── server.ts # MCP server entry point (tools & resources)
│ └── users.json # Mock user database (read/written at runtime)
├── package.json
└── tsconfig.json技术栈
包 | 角色 |
| MCP 服务器 SDK(工具、资源、stdio 传输) |
| 工具输入模式验证 |
| 无需构建步骤直接运行 TypeScript |
| TypeScript 编译器 |
| 基于浏览器的 MCP 调试 UI |
许可证
ISC
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
An MCP server that provides agents access to the KeldynAI platform
Hosted MCP server for live public-data APIs and Skills for AI agents.
MCP server for building and testing AI agents with multi-model experimentation and insights.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceA lightweight MCP server that connects a local AI model (Ollama) with custom CRUD tools for an in-memory database, enabling natural language database management.-
- FlicenseNot gradedqualityDmaintenanceEducational example of an MCP server built with FastMCP, demonstrating how to expose tools, resources, and prompts for AI clients.-
- FlicenseNot gradedqualityDmaintenanceExample MCP server built with FastMCP, demonstrating tools, resources, and prompts for AI integration.14-
- AlicenseNot gradedqualityDmaintenanceA demonstrative MCP server that exposes a query-user tool for retrieving user info by ID, integrated with LangChain for agent-driven model reasoning and tool calls.ISC