https://github.com/user-attachments/assets/ab1b7e63-b6f0-4d5b-85ab-79d328de31db
打开Blockbench,进入文件 > 插件,点击“从URL加载插件”,然后粘贴以下URL:
https://jasonjgardner.github.io/blockbench-mcp-plugin/plugins/mcp/mcp.js
在Blockbench设置中配置实验性的MCP服务器:设置 > 常规 > MCP服务器端口 和 MCP服务器端点
以下示例使用默认值 :3000/mcp
claude_desktop_config.json
{
"mcpServers": {
"blockbench": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:3000/mcp"
]
}
}
}
.vscode/mcp.json
{
"servers": {
"blockbench": {
"url": "http://localhost:3000/mcp"
},
}
}
欢迎添加或修改工具、提示和资源。对于Blockbench贡献者/插件作者来说,这应该是一个相对熟悉的流程;然而,需要进行TypeScript编译。推荐使用Bun来完成此任务。
bunx @modelcontextprotocol/inspector
可流式HTTP传输URL默认为 http://localhost:3000/mcp
cd ./src/mcp
bun install
bun run build
// ./src/mcp/server/tools.ts
import { z } from "zod";
import { createTool } from "@/lib/factories";
createTool({
name: "tool_name",
description: "AI代理的工具描述"
parameters: z.object({
// 执行您的工具所需的参数:
examples: z.array({
// 使用Zod模式收集参数。
// 不必与Blockbench一一对应
})
}),
async execute({ examples }, { reportProgress }) {
return JSON.stringify(examples.map((example, idx) => {
reportProgress({
progress: idx,
total: examples.length
});
// 在当前上下文中使用参数执行某些操作。
// 可以访问Blockbench、electron、FastMCP和其他API
// 返回字符串化的结果以报告给AI代理上下文。
return myExampleTransformFunction(example);
}));
}
});
尚未创建工厂函数。参考FactMCP的文档中的资源示例。
将与资源相关的代码添加到 ./src/mcp/server/resources.ts
尚未创建工厂函数。参考FactMCP的文档中的提示示例。
将与提示相关的代码添加到 ./src/mcp/server/prompts.ts