MCP TypeScript Simple Template
MCP TypeScript 简单模板
一个用于构建模型上下文协议 (MCP) 服务器的简单 TypeScript 模板。该项目为创建可与 AI 系统集成的自定义 MCP 工具奠定了基础。
概述
此模板实现了一个基本的 MCP 服务器,其中包含一个示例 BMI 计算器工具。它演示了如何:
使用 TypeScript 设置 MCP 服务器
使用 Zod 定义并实现具有输入验证的 MCP 工具
将服务器连接到标准 I/O 进行通信
Related MCP server: MCP Server Python Template
先决条件
Node.js(建议使用 v20 或更高版本)
npm 或 yarn
安装
克隆此存储库
安装依赖项:
npm install项目结构
index.ts- 带有示例工具的主服务器实现package.json- 项目依赖项和脚本tsconfig.json- TypeScript 配置
用法
构建和运行
构建并启动服务器:
npm start这将编译 TypeScript 代码并启动 MCP 服务器。
发展
对于开发,您可以:
修改
index.ts以添加您自己的工具运行build命令进行编译:
npm run build创建自定义工具
要创建新工具,请在index.ts中遵循以下模式:
server.tool(
"your-tool-name",
{
// Define input schema using Zod
paramName: z.string(),
// Add more parameters as needed
},
async ({ paramName }) => ({
content: [{
type: "text",
text: "Your tool's response"
}]
})
);依赖项
@modelcontextprotocol/sdk- 核心 MCP SDKzod- 模式验证dotenv环境变量管理typescript- TypeScript 编译器
执照
国际学习中心
贡献
欢迎贡献代码!欢迎提交 Pull 请求。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA demonstration implementation of the Model Context Protocol server that facilitates communication between AI models and external tools while maintaining context awareness.
- -licenseNot gradedqualityNot gradedmaintenanceA streamlined foundation for building Model Context Protocol servers in Python, designed to make AI-assisted development of MCP tools easier and more efficient.12
- AlicenseDqualityDmaintenanceA foundation for building custom local Model Context Protocol (MCP) servers that provide tools accessible to AI assistants like Cursor or Claude Desktop.137MIT
- -licenseNot gradedqualityDmaintenanceA standardized foundation for building Model Context Protocol servers that integrate with VS Code, using Python with stdio transport for seamless AI tool integration.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to control Unreal E…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ChenReuven/mcp-ts-simple-template'
If you have feedback or need assistance with the MCP directory API, please join our Discord server