googleanalytics / googleanalytics/google-analytics-mcp

DNS Resolution Error with Claude Code

Open
#179 0 comments 0 reactions 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:

  1. Add analytics-mcp to Claude Code via claude mcp add
  2. Start a Claude Code session
  3. Ask Claude to call any analytics-mcp tool (e.g. get_account_summaries)
  4. 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

No repository file or test is identified in the issue. Start by reproducing the analytics-mcp launch through Claude Code on macOS and inspect how its subprocess environment reaches the gRPC client; done means an analytics tool such as get_account_summaries resolves the Google endpoint and returns account data without the DNS error.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, macos, python
Domain
backend, networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.