MCP API Bridge MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
npm install -g https://github.com/marty5499/mcp-api-bridge.git
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add mcp-api-bridge -- node "<FULL_PATH_TO_MCP_API_BRIDGE>/dist/index.js"

Replace <FULL_PATH_TO_MCP_API_BRIDGE>/dist/index.js with the actual folder you prepared in step 1.

README.md

Bridge Google Sheets, Azure AI, and MQTT APIs for code generation and IoT.

MCP API Bridge Server

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

功能特色

🗃️ Google Sheets API

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

🤖 Azure AI API

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

📡 MQTT API

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

安裝與設定

前置需求

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

🚀 快速安裝 (推薦)

1. 全域安裝 MCP API Bridge
npm install -g https://github.com/marty5499/mcp-api-bridge.git
2. 在 Cursor 中設定 MCP

找到並編輯 Cursor 的 MCP 設定檔案:

macOS:

~/.cursor/mcp.json

Linux:

~/.config/cursor/mcp.json

Windows:

%APPDATA%\Cursor\mcp.json

在設定檔案中加入以下配置:

{
  "mcpServers": {
    "api-bridge": {
      "command": "mcp-api-bridge",
      "env": {}
    }
  }
}
3. 重啟 Cursor

重啟 Cursor IDE 使設定生效。

🔄 更新到最新版本

當有新版本發布時,使用以下命令更新:

npm update -g https://github.com/marty5499/mcp-api-bridge.git

🛠️ 開發者安裝 (本地開發)

如果您想要修改或開發此專案:

  1. 複製專案
git clone https://github.com/marty5499/mcp-api-bridge.git
cd mcp-api-bridge
  1. 安裝依賴套件
npm install
  1. 本地測試
# 測試工具列表
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 裝置管理功能

可用工具

Google Sheets API 工具
  1. google_sheet_append - 產生新增資料的程式碼範例
{
  "url": "https://docs.google.com/spreadsheets/d/your-sheet-id/edit",
  "values": ["張三", "25", "工程師", "2024-01-15"]
}
  1. google_sheet_get - 產生讀取資料的程式碼範例
{
  "url": "https://docs.google.com/spreadsheets/d/your-sheet-id/edit"
}
  1. google_sheet_update - 產生更新資料的程式碼範例
{
  "url": "https://docs.google.com/spreadsheets/d/your-sheet-id/edit",
  "rowIdx": 2,
  "cols": ["李四", "30", "設計師", "2024-01-16"]
}
  1. google_sheet_delete - 產生刪除資料的程式碼範例
{
  "url": "https://docs.google.com/spreadsheets/d/your-sheet-id/edit",
  "rowIdx": 3
}
  1. google_sheet_save - 產生覆蓋資料的程式碼範例
{
  "url": "https://docs.google.com/spreadsheets/d/your-sheet-id/edit",
  "rows": [
    ["姓名", "年齡", "職業", "日期"],
    ["王五", "28", "產品經理", "2024-01-17"]
  ]
}
Azure AI API 工具
  1. azure_ai_chat - 產生 Azure AI 程式碼範例
{
  "prompt": "我需要一個聊天機器人的程式碼範例",
  "streaming": false
}
MQTT API 工具
  1. mqtt_device_create - 建立裝置
{
  "deviceId": "sensor001"
}
  1. mqtt_publish - 發布訊息
{
  "deviceId": "sensor001",
  "topic": "server001.data",
  "payload": {
    "temperature": 25.5,
    "humidity": 60.2
  },
  "qos": 0
}
  1. mqtt_publish_sync - 同步發布
{
  "deviceId": "client001",
  "topic": "server001.getConfig",
  "payload": {
    "configType": "network"
  },
  "timeout": 10000,
  "qos": 1
}
  1. mqtt_register_handler - 註冊處理器
{
  "deviceId": "server001",
  "action": "data",
  "handlerCode": "const { payload } = message; console.log('處理資料:', payload); return { status: 'ok' };"
}
  1. mqtt_subscribe - 訂閱主題
{
  "deviceId": "monitor001",
  "topic": "alerts/+",
  "qos": 1
}

API 端點資訊

Google Sheets API

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

Azure AI API

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

MQTT API

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

實際應用範例

1. IoT 資料收集系統

// 步驟 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()
  }
});

2. AI 輔助資料分析

// 步驟 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

Tools (11)

google_sheet_appendGenerate code example for appending data to a Google Sheet.
google_sheet_getGenerate code example for reading data from a Google Sheet.
google_sheet_updateGenerate code example for updating specific row data in a Google Sheet.
google_sheet_deleteGenerate code example for deleting a row from a Google Sheet.
google_sheet_saveGenerate code example for overwriting a Google Sheet.
azure_ai_chatGenerate Azure AI chat code example.
mqtt_device_createCreate an IoT device connection.
mqtt_publishPublish an MQTT message.
mqtt_publish_syncSynchronously publish an MQTT message.
mqtt_register_handlerRegister a message handler for an IoT device.
mqtt_subscribeSubscribe to an MQTT topic.

Configuration

claude_desktop_config.json
{"mcpServers": {"api-bridge": {"command": "mcp-api-bridge", "env": {}}}}

Try it

Generate a code example for appending a new row with user data to my Google Sheet at [URL].
Create a code snippet for an Azure AI chat integration using GPT-4o-mini.
Register a handler for my 'data_server' device to log incoming MQTT messages to a database.
Publish a temperature reading of 25.5 to the 'server001.data' topic using my sensor device.

Frequently Asked Questions

What are the key features of MCP API Bridge?

Generate CRUD code examples for Google Sheets API. Generate Azure AI chat integration code including streaming support. Comprehensive MQTT IoT device management including publishing and subscribing. Support for registering custom message handlers for IoT devices.

What can I use MCP API Bridge for?

Automating data logging from IoT sensors directly into Google Sheets. Rapidly generating boilerplate code for Azure AI chat applications. Building real-time IoT monitoring systems with custom message handling. Integrating spreadsheet data management into AI-assisted development workflows.

How do I install MCP API Bridge?

Install MCP API Bridge by running: npm install -g https://github.com/marty5499/mcp-api-bridge.git

What MCP clients work with MCP API Bridge?

MCP API Bridge works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MCP API Bridge docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare