jsonbin mcp
一个基于Model Context Protocol (MCP)的JSONBin.io数据管理服务器,支持通过AI对话进行完整的CRUD操作。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"jsonbin-mcp-server": {
"args": [
"jsonbin-mcp-server"
],
"command": "npx",
"env": {
"JSONBIN_TOKEN": ""
}
}
}
}
该服务需要配置环境变量:JSONBIN_TOKEN
服务介绍
JSONBin MCP Server
一个基于Model Context Protocol (MCP)的JSONBin.io数据管理服务器,支持通过AI对话进行完整的CRUD操作。
功能特性
- ✅ 完整CRUD操作 - 创建、读取、更新、删除JSONBin数据
- ✅ Collections API - 创建、管理Collection,分组Bin
- ✅ Schema Docs API - 创建Schema Doc,为Collection附加校验(需Pro)
- ✅ Token管理 - 安全的API密钥配置
- ✅ 元数据管理 - 更新Bin名称和隐私设置
- ✅ AI友好 - 通过自然语言对话操作数据
可用工具
Bins
| 工具 | 描述 | 参数 |
|---|---|---|
setToken |
设置JSONBin.io的Master Key | token (必需) |
listBins |
获取所有Bins列表 | 无 |
createBin |
创建新Bin | data (必需), name, isPrivate, collectionId |
getBin |
获取指定Bin的数据 | binId (必需) |
updateBin |
更新Bin数据 | binId, data (必需) |
updateBinName |
更新Bin名称 | binId, name (必需) |
deleteBin |
删除Bin | binId (必需) |
updateBinPrivacy |
更新Bin隐私状态 | binId, isPrivate (必需) |
Collections
| 工具 | 描述 | 参数 |
|---|---|---|
createCollection |
创建Collection | name (必需) |
listCollections |
获取所有Collections | 无 |
fetchCollectionBins |
获取Collection下的Bins(分页) | collectionId (必需), lastBinId, sortOrder |
addSchemaToCollection |
为Collection附加Schema Doc | collectionId, schemaDocId (必需) |
removeSchemaFromCollection |
从Collection移除Schema Doc | collectionId (必需) |
Schema Docs
| 工具 | 描述 | 参数 |
|---|---|---|
createSchemaDoc |
创建Schema Doc | schema, name (必需) |
readSchemaDoc |
读取Schema Doc | schemaDocId (必需) |
updateSchemaDoc |
更新Schema Doc内容 | schemaDocId, schema (必需) |
安装
方式1:本地开发
# 克隆或下载项目
cd jsonbin-mcp-server
# 安装依赖
npm install
方式2:全局安装(可选)
npm install -g jsonbin-mcp-server
配置
在Cursor中配置
- 打开Cursor设置
- 找到MCP服务器配置部分
- 添加以下配置:
本地路径方式:
{
"mcpServers": {
"jsonbin-mcp-server": {
"command": "node",
"args": ["/path/to/jsonbin-mcp-server/index.js"],
"env": {
"JSONBIN_TOKEN": ""
}
}
}
}
全局安装方式:
{
"mcpServers": {
"jsonbin-mcp-server": {
"command": "npx",
"args": ["jsonbin-mcp-server"],
"env": {
"JSONBIN_TOKEN": ""
}
}
}
}
获取JSONBin Token
- 访问 JSONBin.io
- 登录或注册账户
- 进入 API Keys 页面
- 复制你的Master Key
- 在配置中设置
JSONBIN_TOKEN环境变量,或通过setToken工具设置
使用示例
配置完成后,在Cursor中可以通过自然语言与AI对话来操作JSONBin:
设置Token
帮我设置jsonbin token为$2a$10$xxxxx
创建Bin
创建一个名为user-data的bin,内容是:
{
"name": "张三",
"age": 25,
"email": "zhangsan@example.com"
}
查询Bins
列出我所有的bins
读取数据
获取bin id为 65f1a2b3c4d5e6f7g8h9i0j1 的数据
更新数据
更新bin 65f1a2b3c4d5e6f7g8h9i0j1 的数据,把年龄改为26
删除Bin
删除bin 65f1a2b3c4d5e6f7g8h9i0j1
使用Collections
创建一个名为users的Collection
列出我所有的Collections
获取Collection xxx下的所有bins
使用Schema校验(需Pro)
创建一个名为UserSchema的Schema Doc,规则是 {"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}
把Schema Doc附加到Collection xxx
系统要求
- Node.js >= 18.0.0
- npm >= 7.0.0
- JSONBin.io账户和API Token
项目结构
src/
├── api/ # API封装
│ ├── bins.js # Bins API
│ ├── collections.js # Collections API
│ └── schema.js # Schema Docs API
├── handlers/ # 工具处理器
│ ├── bins.js
│ ├── collections.js
│ ├── schema.js
│ └── tools.js # 路由聚合
├── schemas/ # MCP工具定义
│ ├── bins.js
│ ├── collections.js
│ ├── schema.js
│ └── tools.js # 合并导出
└── config.js
开发
# 启动服务器
npm start
# 或直接运行
node index.js
故障排除
Token错误
确保已正确设置Token:
- 环境变量方式:在配置文件的
env.JSONBIN_TOKEN中设置 - 运行时方式:通过
setToken工具设置
权限错误
确保Token是Master Key类型,而不是Access Key
Bin名称错误
JSONBin.io只支持ASCII字符作为Bin名称,不支持中文等特殊字符
Schema相关错误
创建Schema Doc、为Collection附加Schema需Pro计划,Free Trial用户仅可创建1个Collection
技术栈
- Model Context Protocol SDK - MCP协议实现
- node-fetch - HTTP请求库
- JSONBin.io API - 数据存储服务
许可证
MIT License
相关项目
- JSONBin.io - JSON数据存储服务
- Model Context Protocol - MCP协议规范
贡献
欢迎提交Issue和Pull Request!
支持
如有问题或建议,请提交Issue或联系作者。