About Mcpbuilderprompts
Mcpbuilderprompts is an MCP server published by guangxiangdebizi in the Developer Tools category: 这是一个专门帮助AI快速构建一个可以运行的nodejs技术栈实现的SSE/Stdio协议的mcp提示词,只需要复制粘贴到ai的起始对话聊天里面然后再加上你需要让它干的活他就可以帮你快速构建出来这个mcp. It has been installed 0 times through Conduid.
The repository has 2 stars and 0 forks, with the last commit a year ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues (0) before depending on it in production.
Install
npx mcpbuilderpromptsThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about Mcpbuilderprompts
Powered by Claude · Grounded in docs
Security checks
- ·README presentNot checked yet.
- ·License declaredNot checked yet.
- ·Tests presentNot checked yet.
- ·Dependencies pinnedNot checked yet.
- ·No dynamic code executionNot checked yet.
- !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.
README
你是一个专门帮助用户构建MCP的小助手
MCP业务层构建指南
📁 核心结构
src/
├── index.ts # MCP服务器主入口
└── tools/ # 业务工具模块
├── tool1.ts # 业务工具1
└── tool2.ts # 业务工具2
🔧 关键模块实现
1. MCP服务器入口 (index.ts)
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
// 导入业务工具
import { tool1 } from "./tools/tool1.js";
import { tool2 } from "./tools/tool2.js";
// 创建MCP服务器
const server = new Server({
name: "YourMCP",
version: "1.0.0",
}, {
capabilities: { tools: {} }
});
// 🔸 工具注册
server.setRequestHandler(ListToolsRequestSchema, async () => {
return {
tools: [
{
name: tool1.name,
description: tool1.description,
inputSchema: tool1.parameters
},
{
name: tool2.name,
description: tool2.description,
inputSchema: tool2.parameters
}
]
};
});
// 🔸 工具调用处理
server.setRequestHandler(CallToolRequestSchema, async (request) => {
switch (request.params.name) {
case "tool1":
return await tool1.run(request.params.arguments);
case "tool2":
return await tool2.run(request.params.arguments);
default:
throw new Error("Unknown tool");
}
});
// 启动服务器
async function main() {
const transport = new StdioServerTransport();
await server.connect(transport);
}
main().catch(console.error);
2. 业务工具模板 (tools/tool1.ts)
export const tool1 = {
name: "your_tool_name",
description: "工具功能描述",
parameters: {
type: "object",
properties: {
param1: {
type: "string",
description: "参数1描述"
},
param2: {
type: "string",
description: "参数2描述"
}
},
required: ["param1"]
},
async run(args: { param1: string; param2?: string }) {
try {
// 1️⃣ 参数验证
if (!args.param1) {
throw new Error("参数param1不能为空");
}
// 2️⃣ 业务逻辑处理
const result = await processBusiness(args.param1, args.param2);
// 3️⃣ 格式化返回
return {
content: [{
type: "text",
text: `# ${args.param1} 处理结果\n\n${result}`
}]
};
} catch (error) {
return {
content: [{
type: "text",
text: `❌ 处理失败: ${error.message}`
}],
isError: true
};
}
}
};
// 业务处理函数
async function processBusiness(param1: string, param2?: string) {
// 你的业务逻辑
return "处理结果";
}
🚀 关键要点
✅ 工具注册流程
- 定义工具 → 导出工具对象 (name, description, parameters, run)
- 导入工具 → 在index.ts中导入
- 注册工具 → ListToolsRequestSchema中添加工具信息
- 处理调用 → CallToolRequestSchema中添加case分支
✅ 工具设计模式
- 统一结构: name + description + parameters + run方法
- 参数验证: 在run方法开头进行验证
- 错误处理: 统一的try-catch和错误返回格式
- 返回格式: content数组包含text类型对象
✅ 项目配置
基础配置 (package.json)
{
"dependencies": {
"@modelcontextprotocol/sdk": "0.6.0"
},
"devDependencies": {
"@types/node": "^20.11.24",
"typescript": "^5.3.3"
},
"scripts": {
"build": "tsc",
"start": "node build/index.js",
"dev": "tsc --watch",
"sse": "npx supergateway --stdio \"node build/index.js\" --port 3100"
}
}
SSE部署方式 (Supergateway)
# 安装supergateway (全局或项目中使用)
npm install -g supergateway
# 启动SSE服务器 (端口3100)
npx supergateway --stdio "node build/index.js" --port 3100
Claude配置方式
Stdio模式 (本地开发):
{
"mcpServers": {
"your-mcp-server": {
"command": "node",
"args": ["path/to/build/index.js"]
}
}
}
SSE模式 (Supergateway):
{
"mcpServers": {
"your-mcp-server": {
"type": "sse",
"url": "http://localhost:3100/sse",
"timeout": 600
}
}
}
这就是MCP业务层的核心构建模式!🎯
README mirrored from the source repository 4 months ago. The original is authoritative.