googleanalytics / googleanalytics/google-analytics-mcp

DNS Resolution Error with Claude Code

Open Beginner friendly
#180 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
3.2k
Forks
693
PR merge metrics
No merged PRs in 30d

Description

Describe the bug:
When using the analytics-mcp server with Claude Code, all API calls fail with a DNS resolution error: Failed to resolve analyticsadmin.googleapis.com. This occurs regardless of network connectivity (DNS resolves fine in the shell).

Steps to Reproduce:

Add analytics-mcp to Claude Code via claude mcp add
Start a Claude Code session
Ask Claude to call any analytics-mcp tool (e.g. get_account_summaries)
Observe DNS resolution failure
Expected behavior:
Successfully retrieve Google Analytics account data

Root cause:
gRPC's c-ares DNS resolver (used by this package) fails to resolve Google API endpoints when spawned as a subprocess by Claude Code on macOS. This is a known gRPC/macOS compatibility issue.

Fix:
Add GRPC_DNS_RESOLVER=native to the MCP server environment config to force gRPC to use the system's native DNS resolver.

For Claude Code, add it to your ~/.claude.json MCP config:

"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS",
"GOOGLE_PROJECT_ID": "YOUR_PROJECT_ID",
"GRPC_DNS_RESOLVER": "native"
}
Or via CLI:

claude mcp add analytics-mcp
--scope user
-e "GOOGLE_APPLICATION_CREDENTIALS=PATH_TO_CREDENTIALS"
-e "GOOGLE_PROJECT_ID=YOUR_PROJECT_ID"
-e "GRPC_DNS_RESOLVER=native"
-- pipx run analytics-mcp
Environment:

macOS (Apple Silicon)
Python 3.12
Claude Code v2.1.175

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the analytics-mcp entry point and reproduce the failure by calling get_account_summaries from Claude Code on macOS. Review how the MCP server environment is configured alongside ~/.claude.json, then verify that setting GRPC_DNS_RESOLVER=native allows Google Analytics API calls to resolve successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, python
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.