google-developer-knowledge-api
npx skills add https://github.com/jarmen423/skills --skill google-developer-knowledge-api
Agent 安装分布
Skill 文档
Google Developer Knowledge API
Direct REST API access to Google’s public developer documentation without needing the MCP server.
Overview
The Developer Knowledge API provides machine-readable access to Google’s developer docs. It offers:
- SearchDocumentChunks: Find relevant page URIs and content snippets
- GetDocument: Fetch full content of a single document
- BatchGetDocuments: Fetch multiple documents at once
Authentication
IMPORTANT: Despite official documentation suggesting API keys work, the API actually requires OAuth2 authentication (access tokens or ADC).
Option 1: Application Default Credentials (Recommended)
- Install gcloud CLI if not already installed
- Run:
gcloud auth application-default login - Enable the API in your project:
- Open Developer Knowledge API page
- Select your project and click Enable
Option 2: Service Account
- Create a service account in Google Cloud Console
- Download the JSON key file
- Set the environment variable:
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
Option 3: Access Token
Get a token manually:
gcloud auth application-default print-access-token
API Reference
Base URL: https://developerknowledge.googleapis.com/v1alpha
All requests require an Authorization: Bearer <token> header.
Search for Document Chunks
GET /documents:searchDocumentChunks?query={query}
Parameters:
query(required): Search query stringpageSize(optional): Number of results per pagepageToken(optional): Token for pagination
Response includes:
documentChunks[]: Array of matching chunksparent: Document identifier (use for GetDocument)content: Snippet of matching contenturi: Original documentation URL
Get Single Document
GET /{document_name}
Parameters:
document_name: Theparentvalue from search results (e.g.,documents/developers.google.com/...)
Response: Full Markdown content of the document
Batch Get Documents
POST /documents:batchGet
Body (JSON):
{
"names": [
"documents/developers.google.com/path/to/doc1",
"documents/developers.google.com/path/to/doc2"
]
}
Retrieves up to 100 documents in a single call.
Python Client
See scripts/developer_knowledge_client.py for a ready-to-use Python client with automatic OAuth2 handling.
Installation Requirements
pip install google-auth google-auth-httplib2
Or use the gcloud CLI fallback (no extra dependencies).
Quick Usage
from developer_knowledge_client import DeveloperKnowledgeClient
# Uses Application Default Credentials automatically
client = DeveloperKnowledgeClient()
# Search for documentation
results = client.search("Cloud Storage buckets")
for chunk in results.get("documentChunks", []):
print(f"URL: {chunk.get('uri')}")
print(f"Content: {chunk.get('content')[:200]}...")
# Get full document
doc = client.get_document(chunk["parent"])
print(doc.get("content"))
Explicit Authentication
# Using service account
client = DeveloperKnowledgeClient(service_account_file="/path/to/sa.json")
# Using explicit access token
client = DeveloperKnowledgeClient(access_token="ya29.xxxx")
Convenience Method
# Search and fetch full documents in one call
docs = client.search_and_get("Firebase authentication", max_results=3)
for doc in docs:
print(doc["content"])
cURL Examples
Get Access Token
export TOKEN=$(gcloud auth application-default print-access-token)
Search
curl -H "Authorization: Bearer $TOKEN" \
"https://developerknowledge.googleapis.com/v1alpha/documents:searchDocumentChunks?query=BigQuery"
Get Document
curl -H "Authorization: Bearer $TOKEN" \
"https://developerknowledge.googleapis.com/v1alpha/documents/developers.google.com/path/to/doc"
Covered Documentation
The API indexes these Google developer sites:
- developer.android.com (Android)
- firebase.google.com (Firebase)
- docs.cloud.google.com (Google Cloud)
- ai.google.dev (Gemini API / Google AI)
- developers.google.com (Ads, Maps, YouTube, etc.)
- developer.chrome.com (Chrome)
- developers.home.google.com (Google Home)
- www.tensorflow.org (TensorFlow)
- web.dev (Web)
- fuchsia.dev (Fuchsia)
Limitations
- Authentication: Requires OAuth2 (API keys do NOT work despite documentation)
- Markdown Quality: Generated from HTML, may have formatting issues
- Content Scope: Only public documentation pages, no GitHub/OSS/blogs/YouTube
- Data Freshness: Re-indexed within 24 hours of publication
When to Use This Instead of MCP
Use direct API calls when:
- MCP authentication is failing or not configured
- You need more control over request/response handling
- You’re integrating into a pipeline that doesn’t support MCP
- You want to use the API in a standalone script
- You need to handle OAuth2 tokens explicitly