Skip to content

DNS Resolution Error with Claude Code  #180

Description

@Sukhraj-Singh-2006

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions