Google开发者文档MCP搜索服务器

为AI辅助开发工具提供Google官方开发者文档搜索与获取能力的MCP服务器,支持在Claude Code和VS Code中查询Firebase、Google Cloud、Android、Maps等文档。

  • by ennywnad
  • HCL
  • 混合部署
  • 更新于
在 GitHub 查看 ennywnad/google-dev-knowledge-mcp

使用说明

Google Developer Knowledge MCP Server

Terraform-managed setup for the Google Developer Knowledge MCP server, which gives AI tools access to official Google developer documentation — Firebase, Google Cloud, Android, Maps, and more.

What this does

This repo creates a dedicated GCP project so you can isolate and track costs for the Developer Knowledge API. It uses OAuth / Application Default Credentials (ADC) for authentication and provides configuration for both Claude Code (CLI) and VS Code (Claude extension).

Tools provided by the MCP server

Tool Description
search_documents Search Google's developer documentation for relevant pages and snippets
get_documents Retrieve full page content using parent IDs from search results

Prerequisites

  • Terraform >= 1.5
  • gcloud CLI installed and authenticated
  • A GCP billing account (gcloud billing accounts list)
  • Claude Code and/or VS Code with the Claude extension

Quick Start

1. Clone this repo

git clone https://github.com/ennywnad/google-dev-knowledge-mcp.git
cd google-dev-knowledge-mcp

2. Configure Terraform

cd terraform
cp terraform.tfvars.example terraform.tfvars

Edit terraform.tfvars with your values:

project_id      = "dev-knowledge-mcp-yourname"  # Must be globally unique
billing_account = "XXXXXX-XXXXXX-XXXXXX"
support_email   = "you@example.com"              # Your Google account email

Note: The project_id must be globally unique across all of GCP. If dev-knowledge-mcp is taken, add a suffix like your initials or a number.

3. Deploy

terraform init
terraform plan
terraform apply

Terraform will output your project ID and direct links to the API dashboard and billing reports.

4. Create an OAuth client ID

Terraform outputs two URLs to guide you. Open them in order:

a) Configure the OAuth consent screen (oauth_consent_url output):

  • Click Get started, fill in App name (e.g. Developer Knowledge MCP) and your email
  • Set audience to External, add yourself as a test user, save

b) Create a Desktop app client ID (oauth_credentials_url output):

  • Click Create credentials → OAuth client ID
  • Choose Desktop app, name it (e.g. claude-code-mcp)
  • Copy the Client ID and Client Secret

Note: google_iap_brand (the Terraform resource for consent screens) requires a GCP organization — personal projects must configure the consent screen manually. It's a one-time, ~2 minute setup.

5. Configure your AI tools

Claude Code (CLI)

cd ..
./scripts/configure-claude-code.sh

The script reads your project ID from Terraform, opens the credentials URL, prompts for your Client ID and secret, then registers the server. Claude Code will open a browser for OAuth consent on first use and handles token refresh automatically.

Or manually:

claude mcp add google-dev-knowledge \
  --transport http \
  --client-id YOUR_CLIENT_ID \
  --client-secret \
  "https://developerknowledge.googleapis.com/mcp" \
  --header "X-goog-user-project: YOUR_PROJECT_ID"

VS Code (Claude Extension)

Copy .vscode/mcp.json into your project's .vscode/ directory (or your user settings), and replace YOUR_PROJECT_ID with your actual project ID.

A reference config is also available at mcp-configs/claude-code.json.

6. Verify it works

Open Claude Code or VS Code and try:

How do I list Cloud Storage buckets?

You should see a tool call to search_documents. If you do, it's working.

Monitoring Costs

Since this runs in a dedicated GCP project, tracking costs is straightforward:

  • API Dashboard: After terraform apply, check the api_console_url output for a direct link to API metrics (requests, errors, latency).
  • Billing Reports: Use the billing_url output to view costs filtered to this project.
  • Quota: Go to IAM & Admin > Quotas & System Limits in the Cloud Console, filter by Developer Knowledge API.

The Developer Knowledge API is currently in Preview ("Pre-GA"). Check Google's pricing page for the latest cost details.

Project Structure

.
├── README.md
├── .gitignore
├── .vscode/
│   └── mcp.json                  # VS Code MCP config (replace PROJECT_ID)
├── mcp-configs/
│   └── claude-code.json          # Reference config for Claude Code
├── scripts/
│   ├── setup-auth.sh             # ADC authentication setup
│   └── configure-claude-code.sh  # Add MCP server to Claude Code CLI
└── terraform/
    ├── main.tf                   # Project, API, and MCP server setup
    ├── variables.tf              # Input variables
    ├── versions.tf               # Provider version constraints
    └── terraform.tfvars.example  # Example variable values (copy to .tfvars)

Known Limitations

  • English-only results from the documentation search
  • Public docs only — no GitHub, blogs, YouTube, or OSS content
  • Network-dependent — requires live connection to Google Cloud services
  • Pre-GA — subject to the "Pre-GA Offerings Terms" in Google's Service Specific Terms

Cleanup

To tear down the project and stop all billing:

cd terraform
terraform destroy

This deletes the GCP project entirely, which removes the API, all credentials, and all associated resources.