MCP API Bridge

by marty5499

Not rated
GitHub

About

A server that bridges Google Sheets, Azure AI, and MQTT APIs.

Details

Author
marty5499
Categories
Developer Tools, Other, API, Automation

Setup

Install MCP API Bridge in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/marty5499/mcp-api-bridge

Follow the installation instructions in the repository README, then restart your MCP client.

一個 Model Context Protocol (MCP) 伺服器,用於串接 Google Sheets API、Azure AI API 和 MQTT API。

- 產生新增資料到試算表的程式碼範例
- 產生讀取試算表所有資料的程式碼範例
- 產生更新指定列資料的程式碼範例
- 產生刪除指定列資料的程式碼範例
- 產生覆蓋整張試算表的程式碼範例

- 產生使用 Azure AI (GPT-4o-mini) 的程式碼範例
- 支援同步和串流模式的程式碼範例
- WebSocket 程式碼實作範例

- 建立 IoT 裝置連線
- 發布 MQTT 訊息 (同步/非同步)
- 訂閱 MQTT 主題
- 註冊訊息處理器
- 支援 QoS 等級設定

- Node.js 18.0.0 或更高版本
- npm 或 yarn
- Cursor IDE(如果要在 Cursor 中使用)

npm install -g https://github.com/marty5499/mcp-api-bridge.git
{ "mcpServers": { "api-bridge": { "command": "mcp-api-bridge", "env": {} } } }
npm update -g https://github.com/marty5499/mcp-api-bridge.git
git clone https://github.com/marty5499/mcp-api-bridge.git cd mcp-api-bridge
# 測試工具列表 echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | node mcp-api-bridge.js # 啟動開發模式(檔案監控) npm run dev

安裝完成後,您可以在 Cursor 中看到 MCP API Bridge 伺服器已連線,並可使用以下 11 個工具:

- Google Sheets API (5個工具):產生 API 操作程式碼範例
- Azure AI API (1個工具):產生 AI 對話程式碼範例
- MQTT API (5個工具):完整的 IoT 裝置管理功能

{ "url": "https://docs.google.com/spreadsheets/d/your-sheet-id/edit", "values": ["張三", "25", "工程師", "2024-01-15"] }
{ "url": "https://docs.google.com/spreadsheets/d/your-sheet-id/edit" }
{ "url": "https://docs.google.com/spreadsheets/d/your-sheet-id/edit", "rowIdx": 2, "cols": ["李四", "30", "設計師", "2024-01-16"] }
{ "url": "https://docs.google.com/spreadsheets/d/your-sheet-id/edit", "rowIdx": 3 }
{ "url": "https://docs.google.com/spreadsheets/d/your-sheet-id/edit", "rows": [ ["姓名", "年齡", "職業", "日期"], ["王五", "28", "產品經理", "2024-01-17"] ] }
{ "prompt": "我需要一個聊天機器人的程式碼範例", "streaming": false }
{ "deviceId": "sensor001" }
{ "deviceId": "sensor001", "topic": "server001.data", "payload": { "temperature": 25.5, "humidity": 60.2 }, "qos": 0 }
{ "deviceId": "client001", "topic": "server001.getConfig", "payload": { "configType": "network" }, "timeout": 10000, "qos": 1 }
{ "deviceId": "server001", "action": "data", "handlerCode": "const { payload } = message; console.log('處理資料:', payload); return { status: 'ok' };" }
{ "deviceId": "monitor001", "topic": "alerts/+", "qos": 1 }

- 基礎 URL:https://hshgpt.webduino.tw/api/sheets/
- 支援操作: append, get, update, del, save

- WebSocket URL:wss://hshgpt.webduino.tw
- 協定: WebSocket 串流通訊

- Broker URL:wss://mqtt-edu.webduino.io/mqtt
- 認證: username:hsh2025, password:hsh2025

// 步驟 1: 建立感測器裝置 await mcp.call('mqtt_device_create', { deviceId: 'temperature_sensor' }); // 步驟 2: 建立資料伺服器 await mcp.call('mqtt_device_create', { deviceId: 'data_server' }); // 步驟 3: 註冊處理器,將資料記錄到 Google Sheets await mcp.call('mqtt_register_handler', { deviceId: 'data_server', action: 'logData', handlerCode:  const { payload } = message; // 這裡可以調用 Google Sheets API 記錄資料 console.log('記錄資料:', payload); return { status: 'logged' };  }); // 步驟 4: 感測器發送資料 await mcp.call('mqtt_publish', { deviceId: 'temperature_sensor', topic: 'data_server.logData', payload: { temperature: 23.5, location: '會議室A', timestamp: new Date().toISOString() } });
// 步驟 1: 讀取試算表資料 const data = await mcp.call('google_sheet_get', { url: 'https://docs.google.com/spreadsheets/d/sales-data/edit' }); // 步驟 2: 產生 Azure AI 分析程式碼 const aiCodeExample = await mcp.call('azure_ai_chat', { prompt: '我需要一個分析銷售資料的 AI 程式碼範例', streaming: false }); // 步驟 3: 根據產生的程式碼範例,實作 AI 分析功能 // (這裡需要開發者根據範例程式碼進行實作) console.log('產生的 AI 程式碼範例:', aiCodeExample.content[0].text);

- Google Sheets API: 檢查 URL 格式和 API 回應
- Azure AI API: WebSocket 連線錯誤和逾時處理
- MQTT API: 連線狀態檢查和裝置管理

mcp-api-bridge/ ├── mcp-api-bridge.js # 主要 MCP 伺服器檔案 ├── lib/ │ └── iotDevice.js # MQTT IoT 裝置類別 ├── examples/ │ └── usage-examples.js # 使用範例 ├── docs/ │ └── changelog.md # 變更日誌 ├── package.json # 專案設定 ├── .gitignore # Git 忽略設定 └── README.md # 專案說明

- 儲存庫 URL:https://github.com/marty5499/mcp-api-bridge
- 授權: MIT License
- 語言: JavaScript (Node.js)
- 在setupToolHandlers()中定義工具 schema
- 實作對應的處理函數
- 新增到CallToolRequestSchema的 switch 語句中

# 執行範例 node examples/usage-examples.js # 測試 MCP 伺服器連線 echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | node mcp-api-bridge.js # 測試特定工具 (Google Sheets) echo '{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "google_sheet_get", "arguments": {"url": "https://docs.google.com/spreadsheets/d/test/edit"}}}' | node mcp-api-bridge.js # 測試全域安裝版本 echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | mcp-api-bridge

- 檢查~/.cursor/mcp.json設定檔案格式是否正確
- 確認已重啟 Cursor IDE
- 檢查終端機中是否能執行mcp-api-bridge命令

# 清除 npm 快取並重新安裝 npm cache clean --force npm uninstall -g mcp-api-bridge npm install -g https://github.com/marty5499/mcp-api-bridge.git

- 🔧 修正 Google Sheets API 工具功能 - 產生程式碼範例而非直接調用 API
- 🚀 支援全域安裝和 Cursor MCP 配置
- 📖 完整的安裝和配置指南
- 🛠️ 疑難排解和測試指南

- 初始版本發布
- 支援 Google Sheets、Azure AI、MQTT API
- 完整的 MCP 工具實作
- 提供使用範例和文件

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

The MCP server for Bitrix24 provides AI assistants with structured access to the Bitrix24 API. It delivers up-to-date method descriptions, parameters, and valid values, allowing assistants to work with precise data instead of guesswork. This reduces code errors and accelerates Bitrix24 integration development.

One remote MCP server for 500+ production APIs — Stripe, HubSpot, Postgres, Gmail, and more. OAuth and API key auth, credential management, and a CLI.

Single tool to control all 100+ API integrations, and UI components

Agent-native developer Q&A API with MCP + A2A endpoints for citations, job pickup, and answer submission.

Self-hosted MCP gateway: convert REST/SOAP/GraphQL/SQL APIs into MCP tools with 29 pre-built adapters, OAuth2, RBAC and audit log.

A universal bridge to convert any web API into an MCP server, supporting multiple transport types.

Dynamically creates MCP servers from web API configurations, integrating any REST API, GraphQL endpoint, or web service into MCP-compatible tools.

Hosted MCP server and coordination layer for AI coding agents — live API contracts, database schema, frontend/backend mismatch detection, and shared handoff tickets for Claude Code, Cursor, Codex, and Lovable.

An MCP server that dynamically loads tools from an external JSON file configured via an environment variable.

A lightweight server exposing Axone's capabilities through the Model-Context Protocol.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.