Blockbench模型上下文协议插件

Blockbench MCP插件是一个用于扩展Blockbench功能的插件,支持通过MCP协议与外部工具和服务进行交互,适用于3D建模和插件开发。

  • by jasonjgardner
  • TypeScript
  • 本地部署
  • 585 星标
  • 更新于
在 GitHub 查看 jasonjgardner/blockbench-mcp-plugin

使用说明

Blockbench MCP

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"
      ]
    }
  }
}

VS代码

.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: "Tool description for the AI agent"
    parameters: z.object({
        // Parameters required to execute your tool:
        examples: z.array({
            // Zod schema to collect arguments.
            // Does not have to be 1:1 with Blockbench
        })
    }),
    async execute({ examples }, { reportProgress }) {
        return JSON.stringify(examples.map((example, idx) => {
            reportProgress({
                progress: idx,
                total: examples.length
            });

            // Do something with parameters within current context.
            // Has access to Blockbench, electron, FastMCP, and other API
            // Return stringified results to report to AI agent context.

            return myExampleTransformFunction(example);
        }));
    }
});

添加资源

尚未创建工厂函数。参见 FactMCP的资源示例文档.

将资源相关代码添加到 ./src/mcp/server/resources.ts

添加提示

尚未创建工厂函数。参见 FactMCP的Prompts示例文档.

添加提示相关代码 ./src/mcp/server/prompts.ts