内容
# Airtable MCP 服务器
一个遵循模型上下文协议(MCP)的服务器,提供与 Airtable API 交互的工具。此服务器通过 Claude Desktop 或其他 MCP 客户端实现对 Airtable 数据库、表格、字段和记录的程序化管理。
该 MCP 服务器具有特殊的实现,允许它分阶段构建表格,利用 Claude 的代理功能,并最小化在构建复杂表格时通常在其他 Airtable MCP 服务器中看到的失败率。它还包括[系统提示](https://github.com/felores/airtable-mcp/blob/main/prompts/system-prompt.md)和[项目知识](https://github.com/felores/airtable-mcp/blob/main/prompts/project-knowledge.md) Markdown 文件,为在 Claude Desktop 中利用项目时为 LLM 提供额外的指导。
## 要求:Node.js
1. 从 [nodejs.org](https://nodejs.org/) 安装 Node.js(版本 18 或更高)和 npm。
2. 验证安装:
```bash
node --version
npm --version
```
⚠️ **重要**: 在运行之前,请确保设置您的 Airtable API 密钥。
## 获取 Airtable API 密钥
1. 在 [airtable.com](https://airtable.com) 登录您的 Airtable 账户。
2. 在 [Airtable 的生成器中心](https://airtable.com/create/tokens) 创建个人访问令牌。
3. 在个人访问令牌部分,选择以下范围:
- data.records:read
- data.records:write
- schema.bases:read
- schema.bases:write
4. 选择您要授予个人访问令牌访问权限的工作区或数据库。
5. 保留此密钥的安全性 - 您将需要它来进行配置。
## 安装
### 方法 1:使用 npx(推荐)
1. 导航到 Claude 配置目录:
- Windows: `C:\Users\NAME\AppData\Roaming\Claude`
- macOS: `~/Library/Application Support/Claude/`
您也可以在 Claude Desktop 应用程序中找到这些目录:Claude Desktop > 设置 > 开发者 > 编辑配置
2. 创建或编辑 `claude_desktop_config.json`:
```json
{
"mcpServers": {
"airtable": {
"command": "npx",
"args": ["@felores/airtable-mcp-server"],
"env": {
"AIRTABLE_API_KEY": "your_api_key_here"
}
}
}
}
```
注意:对于 Windows 路径,请使用双反斜杠(\\)或正斜杠(/)。
### 方法 2:使用 mcp-installer:
mcp-installer 是一个用于安装其他 MCP 服务器的 MCP 服务器。
1. 安装 [mcp-installer](https://github.com/anaisbetts/mcp-installer)
2. 通过提示 Claude Desktop 安装 Airtable MCP 服务器:
```bash
Install @felores/airtable-mcp-server set the environment variable AIRTABLE_API_KEY to 'your_api_key'
```
Claude 将安装服务器,修改配置文件,并将环境变量 AIRTABLE_API_KEY 设置为您的 Airtable API 密钥。
### 方法 3:本地开发安装
如果您想贡献或修改代码,请在终端中运行:
```bash
# 克隆仓库
git clone https://github.com/felores/airtable-mcp.git
cd airtable-mcp
# 安装依赖项
npm install
# 构建服务器
npm run build
# 在本地运行
node build/index.js
```
然后修改 Claude Desktop 配置文件以使用本地安装:
```json
{
"mcpServers": {
"airtable": {
"command": "node",
"args": ["path/to/airtable-mcp/build/index.js"],
"env": {
"AIRTABLE_API_KEY": "your_api_key_here"
}
}
}
}
```
### 验证安装
1. 启动 Claude Desktop
2. Airtable MCP 服务器应该在“已连接的 MCP 服务器”部分列出
3. 使用简单命令进行测试:
```
列出所有数据库
```
## 功能
### 可用操作
#### 数据库管理
- `list_bases`: 列出所有可访问的 Airtable 数据库
- `list_tables`: 列出数据库中的所有表格
- `create_table`: 创建具有字段的新表格
- `update_table`: 更新表格的名称或描述
#### 字段管理
- `create_field`: 在表格中添加新字段
- `update_field`: 修改现有字段
#### 记录操作
- `list_records`: 从表格中检索记录
- `create_record`: 添加新记录
- `update_record`: 修改现有记录
- `delete_record`: 删除记录
- `search_records`: 查找匹配条件的记录
- `get_record`: 通过 ID 获取单个记录
### 字段类型
- `singleLineText`: 单行文本字段
- `multilineText`: 多行文本区域
- `email`: 电子邮件地址字段
- `phoneNumber`: 电话号码字段
- `number`: 带可选精度的数字字段
- `currency`: 带有货币符号的货币字段
- `date`: 带格式选项的日期字段
- `singleSelect`: 从选项中选择单个
- `multiSelect`: 从选项中选择多个
### 字段颜色
可用于选择字段的颜色:
- `blueBright`, `redBright`, `greenBright`
- `yellowBright`, `purpleBright`, `pinkBright`
- `grayBright`, `cyanBright`, `orangeBright`
- `blueDark1`, `greenDark1`
## 贡献
我们欢迎贡献以改进 Airtable MCP 服务器!以下是您可以贡献的方式:
1. 分叉仓库
- 访问 https://github.com/felores/airtable-mcp
- 点击右上角的“分叉”按钮
- 在本地克隆您的分叉:
```bash
git clone https://github.com/your-username/airtable-mcp.git
```
2. 创建功能分支
```bash
git checkout -b feature/your-feature-name
```
3. 进行更改
- 遵循现有的代码风格
- 如适用,请添加测试
- 根据需要更新文档
4. 提交更改
```bash
git add .
git commit -m "feat: add your feature description"
```
5. 推送到您的分叉
```bash
git push origin feature/your-feature-name
```
6. 创建拉取请求
- 访问您在 GitHub 上的分叉
- 点击“新拉取请求”
- 选择您的功能分支
- 详细描述您的更改
### 开发指南
- 新代码使用 TypeScript
- 遵循语义提交消息
- 为新功能更新文档
- 为新功能添加示例
- 彻底测试您的更改
### 获取帮助
- 为错误或功能请求打开问题
- 加入现有问题的讨论
- 在拉取请求中提问
您的贡献有助于使此工具对每个人都更好。无论是:
- 添加新功能
- 修复错误
- 改进文档
- 建议增强功能
我们感谢您在使 Airtable MCP 服务器更强大、更用户友好方面的帮助!
## 许可证
[MIT](LICENSE)
---
由 Airtable MCP 社区 ❤️ 制作