google-dev-knowledge-mcp-bridge

google-dev-knowledge-mcp-bridge

A local stdio MCP bridge that forwards tool calls to the Google Developer Knowledge MCP endpoint and enhances search_documents with caching, result expansion, and concise markdown excerpts.

Category
访问服务器

README

google-dev-knowledge-mcp-bridge

Local stdio MCP bridge for the Google Developer Knowledge MCP endpoint. It forwards upstream tool calls and adds a higher-signal search_documents mode that:

  • caches semantically equivalent search requests
  • expands top search hits with batch_get_documents
  • extracts concise markdown sections for easier downstream citation and synthesis

The bridge does not embed credentials in tracked code. Authentication is resolved from Application Default Credentials plus service account impersonation configured through environment variables.

Requirements

  • Node.js 18+
  • gcloud installed and authenticated with gcloud auth application-default login
  • Permission to impersonate the target service account

Installation

  1. Install dependencies:

    npm install
    
  2. Copy the sample environment file:

    cp .env.example .env
    
  3. Fill in only the values required for your environment.

Environment Variables

Required

  • GOOGLE_IMPERSONATE_SERVICE_ACCOUNT

Optional

  • GOOGLE_QUOTA_PROJECT_ID
  • DEBUG_MCP=false
  • AUTO_EXPAND_SEARCH=true
  • EXPAND_TOP_N=4
  • EXPAND_MAX_CHARS=9000
  • EXPAND_PER_DOC_MAX_CHARS=2600
  • CACHE_TTL_MS=300000
  • REQUEST_TIMEOUT_MS=20000
  • MAX_RETRIES=2
  • BACKOFF_BASE_MS=400

Authentication Flow

The bridge uses this sequence:

  1. Loads Application Default Credentials from the local environment.
  2. Impersonates the service account named in GOOGLE_IMPERSONATE_SERVICE_ACCOUNT.
  3. Calls the Google Developer Knowledge MCP endpoint with an OAuth access token.

If GOOGLE_QUOTA_PROJECT_ID is set, the bridge also sends it as the quota project header.

MCP Server Launch

Run the bridge directly over stdio:

npm start

Equivalent direct command:

node server.js

Example Codex MCP launch configuration:

{
  "mcpServers": {
    "google-dev-knowledge-mcp-bridge": {
      "command": "node",
      "args": ["/absolute/path/to/google-dev-knowledge/server.js"],
      "cwd": "/absolute/path/to/google-dev-knowledge",
      "env": {
        "GOOGLE_IMPERSONATE_SERVICE_ACCOUNT": "service-account@your-project.iam.gserviceaccount.com",
        "GOOGLE_QUOTA_PROJECT_ID": "your-project-id",
        "AUTO_EXPAND_SEARCH": "true",
        "DEBUG_MCP": "false"
      }
    }
  }
}

Repository Layout

  • server.js: CLI entrypoint
  • src/config.js: environment parsing and validation
  • src/google-client.js: ADC + impersonation + HTTP retry logic
  • src/content-pack.js: search expansion and excerpt construction helpers
  • src/bridge.js: stdio JSON-RPC loop and caching

Upstream MCP Tools

The bridge forwards upstream Google Developer Knowledge MCP tool calls. Common tools include:

  • search_documents
  • get_document
  • batch_get_documents

When AUTO_EXPAND_SEARCH=true, search_documents responses are transformed into a context pack that includes:

  • canonical source links
  • top ranked search chunks
  • extracted document excerpts sized for model context windows

All other tool calls are passed through unchanged.

Sample MCP Tool Calls

Example search_documents input:

{
  "query": "Cloud Storage create bucket required permissions"
}

Example get_document input:

{
  "name": "documents/cloud-storage-create-buckets"
}

Example batch_get_documents input:

{
  "names": [
    "documents/cloud-storage-create-buckets",
    "documents/iam-roles-overview"
  ]
}

Smoke Tests

Syntax check the bridge:

npm run check

Troubleshooting

Missing required environment

  • The process exits immediately if GOOGLE_IMPERSONATE_SERVICE_ACCOUNT is unset.

Failed authentication

  • Re-run gcloud auth application-default login.
  • Confirm the authenticated principal can impersonate the configured service account.
  • If you use quota billing, confirm GOOGLE_QUOTA_PROJECT_ID is valid for the caller.

Request failures or timeouts

  • Increase REQUEST_TIMEOUT_MS in slower environments.
  • Leave MAX_RETRIES above 0 if you want automatic retry on 429 and 5xx responses.

Publishing hygiene

  • .env and node_modules/ are ignored by .gitignore.
  • Use .env.example as the only tracked environment template.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选