Airtable MCP 服务器使用说明

项目简介

Airtable MCP 服务器是一个基于 Model Context Protocol (MCP) 的应用后端,旨在通过标准化的方式,让 LLM 客户端(如 Claude Desktop)能够安全、方便地与 Airtable 数据库进行交互。它将 Airtable 的 API 功能封装成一系列易于 LLM 调用的工具,使得用户可以通过自然语言指令,让 LLM 完成对 Airtable 数据库的各种操作,例如读取数据、创建表格、更新记录等。

主要功能点

  • 库 (Base) 管理:
    • 列出所有可访问的 Airtable 库及其权限。
  • 表 (Table) 操作:
    • 列出指定库中的所有表及其结构(字段、视图等)。
    • 在指定库中创建新表,可以定义表名、描述和初始字段。
    • 更新现有表的名称和描述。
  • 字段 (Field) 管理:
    • 在指定表中创建新的字段,支持多种字段类型(文本、数字、日期、选择等),并可设置字段选项。
    • 更新现有字段的名称、描述和选项。
  • 记录 (Record) 操作:
    • 列出指定表中的记录,支持设置最大返回记录数。
    • 在指定表中创建新记录,可以指定各字段的值。
    • 更新现有记录的字段值。
    • 删除指定记录。
    • 在指定表中搜索符合特定字段和值的记录。
  • 支持多种字段类型:
    • 文本类型: 'singleLineText', 'multilineText', 'email', 'phoneNumber'
    • 数字类型: 'number', 'currency'
    • 选择类型: 'singleSelect', 'multiSelect'
    • 日期类型: 'date'

安装步骤

  1. 安装 Node.js 和 npm (或 yarn): 确保你的电脑上已安装 Node.js (版本 16 或更高) 和 npm (或 yarn)。
  2. 克隆仓库: 打开终端或命令提示符,执行以下命令克隆仓库到本地:
    git clone https://github.com/MCP-Mirror/felores_airtable-mcp.git
    cd felores_airtable-mcp
  3. 安装依赖: 在仓库目录下,执行以下命令安装项目依赖:
    npm install
  4. 构建项目: 执行以下命令构建服务器代码:
    npm run build
  5. 获取 Airtable API Key:
    • 访问 Airtable's Builder Hub 并登录你的 Airtable 账号。
    • 创建一个新的 personal access token,并赋予以下 scopes:
      • 'data.records:read'
      • 'data.records:write'
      • 'schema.bases:read'
      • 'schema.bases:write'
    • 选择你需要授权的工作区或数据库。
    • 复制生成的 API Key,请妥善保管此密钥

服务器配置 (Claude Desktop)

要将此 MCP 服务器配置到 Claude Desktop 中,你需要编辑 Claude Desktop 的配置文件 'claude_desktop_config.json'。

对于 Windows 用户: 打开文件资源管理器,导航到 '%APPDATA%\Roaming\Claude' 目录,创建或编辑 'claude_desktop_config.json' 文件,并添加以下配置:

{
  "mcpServers": {
    "airtable": {
      "command": "node",
      "args": ["C:/path/to/airtable-mcp/build/index.js"],
      "env": {
        "AIRTABLE_API_KEY": "your_airtable_api_key"
      }
    }
  }
}

对于 macOS 用户: 打开终端,导航到 '~/Library/Application Support/Claude/' 目录,创建或编辑 'claude_desktop_config.json' 文件,并添加以下配置:

{
  "mcpServers": {
    "airtable": {
      "command": "node",
      "args": ["/path/to/airtable-mcp/build/index.js"],
      "env": {
        "AIRTABLE_API_KEY": "your_airtable_api_key"
      }
    }
  }
}

配置参数说明:

  • '"airtable"': 服务器名称,可以自定义,用于在 Claude Desktop 中识别。
  • '"command": "node"': 启动服务器的命令,这里使用 Node.js 运行 JavaScript 文件。
  • '"args": ["C:/path/to/airtable-mcp/build/index.js"]': 启动命令的参数,指向构建后的服务器入口文件 'index.js' 的路径。
    • 请务必将 '"C:/path/to/airtable-mcp/build/index.js"' (Windows) 或 '"/path/to/airtable-mcp/build/index.js"' (macOS) 替换为你本地 'airtable-mcp' 仓库中 'build/index.js' 文件的绝对路径**。**
  • '"env": { "AIRTABLE_API_KEY": "your_airtable_api_key" }': 设置环境变量,'AIRTABLE_API_KEY' 用于存储你的 Airtable API Key。
    • 请务必将 '"your_airtable_api_key"' 替换为你之前获取的 Airtable API Key。

基本使用方法

  1. 启动 Claude Desktop: 配置完成后,启动 Claude Desktop 应用程序。

  2. 验证连接: 在 Claude Desktop 的 "Connected MCP Servers" 部分,应该能看到名为 "airtable" 的服务器已连接。

  3. 使用指令与 Airtable 交互: 在 Claude Desktop 的聊天输入框中,可以使用自然语言指令,结合工具名称和参数,指示 LLM 调用 Airtable MCP 服务器的功能。例如:

    • 列出所有 Airtable 库:

      {
        "name": "list_bases"
      }

      或者直接使用自然语言描述: "列出所有数据库"

    • 列出指定库的表 (假设你的 Base ID 是 'appxxxxxxxxxxxxx'):

      {
        "name": "list_tables",
        "arguments": {
          "base_id": "appxxxxxxxxxxxxx"
        }
      }

      或者自然语言描述: "列出数据库 'appxxxxxxxxxxxxx' 中的所有表"

    • 创建新表 (在 Base ID 'appxxxxxxxxxxxxx' 中创建名为 "Projects" 的表):

      {
        "name": "create_table",
        "arguments": {
          "base_id": "appxxxxxxxxxxxxx",
          "table_name": "Projects",
          "description": "Track project progress",
          "fields": [
            {
              "name": "Project Name",
              "type": "singleLineText",
              "description": "Name of the project"
            },
            {
              "name": "Status",
              "type": "singleSelect",
              "description": "Project status",
              "options": {
                "choices": [
                  {"name": "Planning", "color": "blueBright"},
                  {"name": "In Progress", "color": "yellowBright"},
                  {"name": "Completed", "color": "greenBright"}
                ]
              }
            }
          ]
        }
      }

      或者自然语言描述,让 LLM 帮你构建 JSON。

    更多功能和详细参数,请参考仓库 'README.md' 文档中 "Features" 部分的说明。

信息

分类

数据库与文件