Are you the author? Sign in to claim
ask-google-mcp
ask-google-mcp is a stdio MCP server that exposes a single tool, ask_google.
That tool sends a question to Gemini with Google Search grounding enabled, then returns:
This is for agent workflows that need current web information inside an MCP client such as Claude Code.
ask_google is useful when the agent needs information that should not be answered from stale training data alone, for example:
The server is intentionally narrow:
ask_googleI checked the local Claude Code CLI help.
claude mcp --help shows that add supports scopes local, user, and project, and claude mcp add --help shows the default scope is local.
If you want this available across all projects, use --scope user.
npm install -g @gpriday/ask-google-mcp
Then add it to Claude Code at user scope and set the API key directly in the MCP config:
claude mcp add --scope user -e GOOGLE_API_KEY=your_api_key_here ask-google -- ask-google-mcp
Verify it:
claude mcp get ask-google
claude mcp list
This is better for development, not for normal usage.
git clone https://github.com/gpriday/ask-google-mcp.git
cd ask-google-mcp
npm install
Then register that checkout with Claude Code:
claude mcp add --scope user -e GOOGLE_API_KEY=your_api_key_here ask-google -- node /absolute/path/to/ask-google-mcp/src/index.js
>=20Get an API key here:
The server loads environment variables in this order:
process.cwd()/.env~/.envThat means:
~/.envclaude mcp add -e GOOGLE_API_KEY=... is the clearest and most reliable setupMinimum required variable for live tool calls:
GOOGLE_API_KEY=your_api_key_here
Optional variables:
ASK_GOOGLE_TIMEOUT_MS=300000
ASK_GOOGLE_MAX_RETRIES=3
ASK_GOOGLE_INITIAL_RETRY_DELAY_MS=1000
# Auto-routing (on by default)
# ASK_GOOGLE_ROUTER_ENABLED=true
# ASK_GOOGLE_ROUTER_MODEL=flash-lite
# ASK_GOOGLE_ROUTER_TIMEOUT_MS=10000
# ASK_GOOGLE_ROUTER_FALLBACK_MODEL=flash
# Optional model alias overrides
# ASK_GOOGLE_MODEL_FLASH=gemini-3.5-flash
# ASK_GOOGLE_MODEL_FLASH_LITE=gemini-3.1-flash-lite
GOOGLE_API_KEY is missing.ask_google tool itself returns an [AUTH_ERROR] if called without a key.ASK_GOOGLE_TIMEOUT_MS milliseconds unless you override it.ask_google
question - required string, 1 to 4,000 characters (also accepted as query alias; do not set both)model - optional: auto (default), flash, or flash-liteflash -> gemini-3.5-flashflash-lite -> gemini-3.1-flash-liteThose defaults can be overridden with environment variables if Google renames preview models. The legacy value pro is still accepted for backward compatibility and is routed to flash.
When model is auto (the default), the server runs a tiny classifier call on Flash-Lite to pick the downstream tier based on query complexity:
The router has a tight timeout (10s by default) and strict JSON enum output. If it times out, fails, or returns something unusable, the server falls back to flash (configurable via ASK_GOOGLE_ROUTER_FALLBACK_MODEL) and proceeds with the normal grounded call.
You can still pin a specific model (flash, flash-lite) to bypass the router. To disable auto-routing entirely and restore the old default-model behavior, set ASK_GOOGLE_ROUTER_ENABLED=false.
The routing decision is surfaced in the response's diagnostics.router block and in the diagnostics footer text (e.g., model=auto→flash · router=0.4s).
{
"name": "ask_google",
"arguments": {
"question": "Find the current Node.js LTS version and its release date"
}
}
flash{
"name": "ask_google",
"arguments": {
"question": "What is the latest stable TypeScript release?",
"model": "flash"
}
}
{
"name": "ask_google",
"arguments": {
"question": "React 19 vs React 18: current migration risks, breaking changes, and official upgrade guidance"
}
}
The tool returns text content that includes:
Sources section appended by the serverSearch queries performed section appended by the server when availableIf you installed the package globally:
ask-google-mcp
If you are running from a local checkout:
npm start
CLI flags:
ask-google-mcp --help
ask-google-mcp --version
For local development, validate configuration with:
npm run check-env
That script checks:
.env or ~/.env existsGOOGLE_API_KEY looks present and non-placeholderClaude Code is the primary recommended workflow, but Claude Desktop can also run the server.
Global install example:
{
"mcpServers": {
"ask-google": {
"command": "ask-google-mcp",
"env": {
"GOOGLE_API_KEY": "your_api_key_here"
}
}
}
}
Local checkout example:
{
"mcpServers": {
"ask-google": {
"command": "node",
"args": ["/absolute/path/to/ask-google-mcp/src/index.js"],
"env": {
"GOOGLE_API_KEY": "your_api_key_here"
}
}
}
}
Project structure:
src/
ask-google.js
config.js
errors.js
index.js
prompt.js
retry.js
router.js
router-prompt.txt
sanitize.js
server.js
system-prompt.txt
tool.js
scripts/
check-env.js
test/
integration/
support/
unit/
Scripts:
npm start - start the MCP servernpm test - run unit testsnpm run test:integration - run live integration tests when enablednpm run test:all - run both suitesnpm run dev - run with node --watchnpm run check-env - validate environment configLive integration tests only run when both are set:
RUN_LIVE_TESTS=1
GOOGLE_API_KEY=your_api_key_here
Tool failures are surfaced as MCP errors with categorized messages:
[AUTH_ERROR] - missing or invalid API key[QUOTA_ERROR] - quota or rate limit exceeded[TIMEOUT_ERROR] - request timed out[API_ERROR] - other Gemini/API failuresMIT
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots
Google's universal MCP server supporting PostgreSQL, MySQL, MongoDB, Redis, and 10+ databases
Official GitHub integration for repos, issues, PRs, and CI/CD workflows