Skip to main content
Glama

nocobase-mcp-server

一个用于 NocoBase 的 MCP(模型上下文协议)服务器,使 Claude 等 AI 助手能够与您的 NocoBase 实例进行交互——读取集合、管理 UI 模式、构建 flowPage 区块,并通过 OpenAPI 运行动态 API 操作。

功能特性

  • 24 个手动构建的工具,涵盖集合、UI 模式、桌面路由、流程模型和 JS 区块

  • 动态工具,根据您的 NocoBase OpenAPI/Swagger 规范自动生成(需要 API 文档插件)

  • 适用于 NocoBase v2.x(已在 2.0.17-full 上测试)

要求

  • Node.js 18+

  • 正在运行的 NocoBase 实例

  • NocoBase API 令牌(root 或具有足够权限)

安装

1. 克隆并安装依赖

git clone https://github.com/your-username/nocobase-mcp-server.git
cd nocobase-mcp-server
pnpm install

2. 配置 Claude Code(或任何 MCP 客户端)

添加到 ~/.claude/mcp.json(Claude Code 全局 MCP 配置):

{
  "mcpServers": {
    "nocobase": {
      "type": "stdio",
      "command": "/absolute/path/to/nocobase-mcp-server/node_modules/.bin/tsx",
      "args": ["/absolute/path/to/nocobase-mcp-server/src/index.ts"],
      "env": {
        "NOCOBASE_URL": "http://localhost:13000",
        "NOCOBASE_API_TOKEN": "your-api-token-here"
      }
    }
  }
}

/absolute/path/to/nocobase-mcp-server 替换为您克隆仓库的实际路径(例如 /Users/yourname/Projects/nocobase-mcp-server)。

环境变量

变量

必需

默认值

描述

NOCOBASE_API_TOKEN

NocoBase API 令牌

NOCOBASE_URL

http://localhost:13000

NocoBase 实例基础 URL

获取 API 令牌

  1. 在 NocoBase UI 中:设置 → 插件 → 启用 API keys 插件

  2. 前往 设置 → API keys → 添加 API key

  3. 复制生成的令牌

启用动态工具(可选)

在 NocoBase 中启用 API 文档 插件(设置 → 插件)。一旦激活,服务器将在启动时自动加载所有额外的 API 端点作为工具。

工具参考

集合

工具

描述

list_collections

列出所有集合

get_collection

按名称获取集合

UI 模式(经典页面)

工具

描述

list_pages

列出所有 UI 模式节点

get_page

按 UID 获取完整的嵌套 UI 模式树

get_page_properties

获取 UI 模式节点的直接子属性

get_parent_schema

获取节点的父模式

create_page

创建一个新的根级 UI 模式节点

insert_new_schema

创建并插入一个新的 UI 模式节点

insert_adjacent_schema

相对于目标节点插入一个模式节点

update_ui_schema

修补现有的 UI 模式节点

batch_patch_ui_schema

在一个请求中修补多个 UI 模式节点

remove_ui_schema

移除 UI 模式节点及其后代 ⚠️

save_as_template

将 UI 模式节点保存为可重用的区块模板

桌面路由 / 导航

工具

描述

list_desktop_routes

列出所有桌面路由(页面、菜单、组、标签页)

流程模型 (flowPage 区块)

工具

描述

get_flow_model

按 UID 获取 flowPage 区块

get_flow_model_by_parent

按父 ID 和 subKey 获取 flowPage 区块

save_flow_model

创建或更新 flowPage 区块

attach_flow_model

将区块附加到 flowPage 容器

move_flow_model

将区块移动到不同位置

duplicate_flow_model

深度复制区块并自动附加

destroy_flow_model

删除区块及其子项 ⚠️

JS 区块

工具

描述

get_js_block

获取 JS 区块模式(经典页面)

update_js_block

更新 JS 区块代码(经典页面)

update_flow_js_block

更新 flowPage 内的 JS 区块代码 — 使用 ctx.render() 或通过 ctx.libs.React 使用 JSX

⚠️ 破坏性操作无法撤销。

JS 区块沙盒

flowPage JS 区块在 NocoBase 的沙盒中运行。可用 API:

// Render HTML
ctx.render(`<h1>Hello</h1>`);

// Render JSX with React + Ant Design
const { React, antd } = ctx.libs;
const { useState } = React;
const { Table, Tag } = antd;

function MyComponent() {
  const [tab, setTab] = useState('a');
  return <div>...</div>;
}

ctx.render(<MyComponent />);

贡献

欢迎贡献!要添加新工具:

  1. Fork 本仓库并创建一个功能分支

  2. 使用 server.registerTool()src/index.ts 中添加您的工具

  3. 遵循现有模式 — 使用 nocoFetch() 进行 API 调用,并使用 ok() 格式化响应

  4. 更新 README.md 中的工具列表

  5. 提交 Pull Request

如有错误报告或功能请求,请在 GitHub 上提交 Issue。

许可证

MIT — 详情请参阅 LICENSE

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - A tier

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/puguhsudarma/nocobase-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server