HTTP 重发 MCP 服务器
一个使用(某种技术或框架)构建的模型上下文协议(MCP)服务器 xMCP(可能指某种特定技术、产品或缩写,具体含义需根据上下文确定) 以及TypeScript,旨在为HTTP操作和通过Resend发送电子邮件提供AI工具。
🚀 快速入门
先决条件
- Node.js 22+(兼容性所需)
- npm
安装
- 安装依赖项:
npm install- 构建项目:
npm run build- 启动开发服务器:
npm run dev📁 项目结构
http-resend-mcp/
├── src/
│ ├── tools/ # Tool files (auto-discovered)
│ │ └── greet.ts # Example greeting tool
│ ├── prompts/ # Prompt files (auto-discovered)
│ │ └── review-code.ts # Example code review prompt
│ └── middleware.ts # Middleware for HTTP transport (optional)
├── dist/ # Built output (generated)
├── .vscode/
│ └── mcp.json # MCP server configuration for VS Code
├── package.json
├── tsconfig.json
└── xmcp.config.ts # xMCP configuration🛠️ 可用脚本
npm run dev- 启动带有热重载功能的开发服务器npm run build- 为生产构建npm run start:stdio- 启动STDIO服务器npm run start:http- 启动内置HTTP服务器
🔧 配置
MCP服务器配置
MCP服务器可以配置为 .vscode/mcp.json:
{
"servers": {
"http-resend-mcp": {
"type": "stdio",
"command": "node",
"args": ["dist/stdio.js"]
}
}
}xMCP 配置
在(系统/设备中)配置xMCP设置 xmcp.config.ts:
import { XmcpConfig } from "xmcp";
const config: XmcpConfig = {
http: true, // Enable HTTP transport
stdio: true, // Enable STDIO transport
paths: {
tools: "src/tools",
prompts: "src/prompts",
resources: false, // Disabled for this project
},
};
export default config;🔌 与MCP客户端一起使用
Claude Desktop(可译为“克劳德桌面版”或根据具体语境简化为“克劳德桌面”,但通常直接保留原名以体现其品牌特性)
在您的Claude桌面配置中添加:
{
"mcpServers": {
"http-resend-mcp": {
"command": "node",
"args": ["/absolute/path/to/http-resend-mcp/dist/stdio.js"]
}
}
}光标
对于使用游标的HTTP传输:
{
"mcpServers": {
"http-resend-mcp": {
"url": "http://localhost:3001/mcp"
}
}
}🧪 开发
添加新工具
在(某个地方/系统中)创建一个新工具 src/tools/:
import { z } from "zod";
import { type InferSchema } from "xmcp";
export const schema = {
param: z.string().describe("Parameter description"),
};
export const metadata = {
name: "tool-name",
description: "Tool description",
annotations: {
title: "Tool Title",
readOnlyHint: true,
destructiveHint: false,
idempotentHint: true,
},
};
export default async function toolName({ param }: InferSchema) {
// Tool implementation
return `Result: ${param}`;
}添加新提示
在(某个地方)创建一个新的提示 src/prompts/:
import { z } from "zod";
import { type InferSchema, type PromptMetadata } from "xmcp";
export const schema = {
input: z.string().describe("Input description"),
};
export const metadata: PromptMetadata = {
name: "prompt-name",
title: "Prompt Title",
description: "Prompt description",
role: "user",
};
export default function promptName({ input }: InferSchema) {
return `Prompt text with ${input}`;
}🐛 调试
你可以使用VS Code来调试这个MCP服务器:
- 构建项目:
npm run build - MCP配置已经设置完毕
.vscode/mcp.json - 使用 VS Code 的调试器逐步执行你的代码
📝 笔记
- 此项目要求使用 Node.js 22+ 以确保与 xMCP 的兼容性
- 开发服务器可能会显示一些webpack警告,但构建成功
- 支持HTTP和STDIO两种传输方式
- 工具和提示会自动从各自的目录中发现
🤝 贡献(或:参与贡献)
- 为仓库创建分支
- 创建你的特性分支(
git checkout -b feature/amazing-feature) - 提交您的更改(
git commit -m 'Add amazing feature') - 推送到分支(
git push origin feature/amazing-feature) - 打开一个拉取请求
📄 许可证
此项目遵循ISC许可证授权。
