Google Forms API 服务器

该MCP服务器利用Google Forms API提供创建、编辑和检索表单响应的功能。

  • by matteoantoci
  • JavaScript
  • 本地部署
  • 19 星标
  • 更新于
在 GitHub 查看 matteoantoci/google-forms-mcp

使用说明

谷歌表单MCP服务器

此MCP服务器使用Google Forms API来提供创建、编辑和检索表单响应等功能。

构建方法

初始设置

克隆存储库后,安装依赖项

cd google-forms-mcp

构建服务器

# Build the main MCP server
npm run build

构建刷新令牌获取脚本

# Build the refresh token acquisition script
npm run build:token

开发环境中的执行

# Run the server directly
node build/index.js

# Or, use npm script
npm run start

设置方法

  1. 在Google云控制台中创建一个项目,并启用Google Forms API。

    • https://console.cloud.google.com/
    • 从API和服务>库中搜索“Google Forms API”并启用它。
  2. 获取OAuth 2.0客户端ID和密钥。

    • API和服务>凭据>创建凭据>OAuth客户端ID
    • 选择应用程序类型:“桌面应用程序”
  3. 设置环境变量并获取刷新令牌。

    export GOOGLE_CLIENT_ID="YOUR_CLIENT_ID"
    export GOOGLE_CLIENT_SECRET="YOUR_CLIENT_SECRET"
    cd google-forms-mcp
    npm run build
    node build/get-refresh-token.js
    

    注意:如果在运行get_fresh-token.js时发生错误,请执行以下命令:

    cd google-forms-mcp
    npm run build:token
    node build/get-refresh-token.js
    
  4. 复制显示的刷新令牌。

  5. 更新Claude桌面应用程序的配置文件。

    • 打开 ~/Library/Application Support/Claude/claude_desktop_config.json.
    • 将环境变量添加到 google-forms-mcp 在 mcpServers 章节:
    "google-forms-mcp": {
      "command": "node",
      "args": [
        "/path/to/your/google-forms-mcp/build/index.js" # Update this path
      ],
      "env": {
        "GOOGLE_CLIENT_ID": "YOUR_CLIENT_ID",
        "GOOGLE_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
        "GOOGLE_REFRESH_TOKEN": "YOUR_REFRESH_TOKEN"
      }
    }
    
  6. 重新启动Claude桌面应用程序。

可用工具

此MCP服务器提供以下工具:

  1. create_form -创建新的Google表单
  2. add_text_question -在表单中添加文本问题
  3. add_multiple_choice_question -在表格中添加多项选择题
  4. get_form -获取表单详细信息
  5. get_form_responses -获取表单响应

用法示例

Create a form and add some questions.

Claude使用以下MCP工具创建表单:

  1. 使用 create_form 创建新表单的工具
  2. 使用 add_text_question 或 add_multiple_choice_question 添加问题的工具
  3. 显示创建的表单的URL