使用说明
NocoDB MCP 服务器
MCP(模型上下文协议)服务器,用于与NocoDB API集成。
可用工具
1. nocodb_list_records
列出带有过滤器、排序和分页功能的表记录。
参数:
tableId(必填):表IDfields(可选):要包含的字段(例如:“字段1,字段2”)where(可选):过滤条件(例如:“(name,eq,João)~and(age,gt,18)”)sort(可选):排序(例如:“姓名,-年龄”)limit(可选):记录限制offset(可选):跳过N条记录
2. nocodb_get_record
按ID查找特定记录。
参数:
tableId(必填):表格IDrecordId(必填):记录IDfields(可选):要包含的字段
3. nocodb_create_records
创建一个或多个记录。
参数:
tableId(必填):表格IDdata(必填): 包含记录数据的对象数组
4. nocodb_update_records
更新一条或多条记录。
参数:
tableId(必填):表IDdata(必填):包含Id和待更新字段的对象数组
5. nocodb_delete_records
删除一条或多条记录。
参数:
tableId(必填):表IDrecordIds(必填):记录ID数组
6. nocodb_count_records
带有可选过滤器的记录计数。
参数:
tableId(必填):表IDwhere(可选):过滤条件
配置
环境变量
NOCODB_URL=https://seu-nocodb.com # URL da sua instância NocoDB
NOCODB_TOKEN=seu-token-aqui # Token de API do NocoDB
如何使用
1. 本地安装
cd mcp-nocodb
npm install
npm run build
2. 本地运行
export NOCODB_URL=https://seu-nocodb.com
export NOCODB_TOKEN=seu-token
npm start
3. 构建Docker镜像
docker build -t mcp-nocodb .
4. 使用 Docker 运行
docker run -i \
-e NOCODB_URL=https://seu-nocodb.com \
-e NOCODB_TOKEN=seu-token \
mcp-nocodb
5. 将MCP网关添加到Docker中
编辑 ~/.docker/mcp/registry.yaml:
registry:
nocodb:
ref: ""
编辑 ~/.docker/mcp/catalogs/custom-catalog.yaml:
version: 2
name: custom
registry:
nocodb:
description: NocoDB API integration
title: NocoDB
type: server
image: mcp-nocodb:latest
tools:
- name: nocodb_list_records
- name: nocodb_get_record
- name: nocodb_create_records
- name: nocodb_update_records
- name: nocodb_delete_records
- name: nocodb_count_records
env:
- name: NOCODB_URL
value: '{{nocodb.url}}'
- name: NOCODB_TOKEN
value: '{{nocodb.token}}'
config:
- name: nocodb
type: object
properties:
url:
type: string
token:
type: string
required:
- url
- token
6. 在Claude Code中进行配置
编辑 ~/.docker/mcp/config.yaml:
nocodb:
url: https://seu-nocodb.com
token: seu-token-aqui
7. 运行Docker MCP网关
docker mcp gateway run --catalog custom-catalog.yaml
通过聊天使用的示例
列出客户:
Me mostra os últimos 10 clientes da tabela tbl_xxx
创建客户:
Cria um novo cliente com nome "João Silva" e email "joao@email.com" na tabela tbl_xxx
寻找客户:
Me mostra o cliente com ID 5 da tabela tbl_xxx
计数记录:
Quantos clientes tem na tabela tbl_xxx?
许可证
麻省理工学院(MIT)