Initial commit
This commit is contained in:
53
.github/copilot-instructions.md
vendored
Normal file
53
.github/copilot-instructions.md
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# MCP Demo Server - Copilot Instructions
|
||||
|
||||
## 项目概述
|
||||
|
||||
这是一个 Model Context Protocol (MCP) 服务器示例项目,使用 TypeScript 编写。
|
||||
|
||||
## 技术栈
|
||||
|
||||
- **语言**: TypeScript
|
||||
- **运行时**: Node.js
|
||||
- **MCP SDK**: @modelcontextprotocol/sdk
|
||||
- **Schema 验证**: Zod
|
||||
|
||||
## 项目结构
|
||||
|
||||
- `src/index.ts` - MCP 服务器主入口文件
|
||||
- `build/` - 编译后的 JavaScript 文件
|
||||
- `.vscode/mcp.json` - VS Code MCP 服务器配置
|
||||
|
||||
## 开发指南
|
||||
|
||||
### 添加新工具
|
||||
|
||||
使用 `server.registerTool()` 方法注册新工具:
|
||||
|
||||
```typescript
|
||||
server.registerTool(
|
||||
"tool_name",
|
||||
{
|
||||
description: "工具描述",
|
||||
inputSchema: {
|
||||
// 使用 Zod schema 定义参数
|
||||
},
|
||||
},
|
||||
async (params) => {
|
||||
// 实现工具逻辑
|
||||
return {
|
||||
content: [{ type: "text", text: "结果" }],
|
||||
};
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
### 常用命令
|
||||
|
||||
- `npm run build` - 编译 TypeScript
|
||||
- `npm start` - 运行 MCP 服务器
|
||||
- `npm run dev` - 开发模式(监听文件变化)
|
||||
|
||||
## MCP 参考文档
|
||||
|
||||
- SDK 文档: https://github.com/modelcontextprotocol/typescript-sdk
|
||||
- 协议规范: https://modelcontextprotocol.io/
|
||||
Reference in New Issue
Block a user