Connect to the PMA MCP Server from Claude Code
Last updated
Note: This article walks you through connecting your PMA Hub to Claude Code, Anthropic's command-line interface for Claude, so you can ask questions about your marketing data in plain language directly from the CLI. For a full overview of the PMA MCP server, including the available tools and worked examples, see the Power My Analytics MCP Server Guide.
Note: MCP usage is included with your PMA plan and draws from the same shared per-plan limit pool as the Power My Analytics API (each plan includes an API rate limit, a request quota, and a row quota per billing cycle; on the Custom plan the request and row quotas are negotiated with your sales representative). See Get Started with Power My Analytics API for the current per-plan limits.
Requirements
Before you begin, confirm the following on both sides of the connection.
Claude Code:
- Claude Code installed on your machine. (Refer to Anthropic's Claude Code installation documentation if you have not installed it yet.)
- A Claude plan tier that supports custom MCP connectors (e.g., Claude Pro or Team).
Power My Analytics:
- At least one data source connected and actively syncing in your PMA Hub.
Step 1: Register the PMA MCP Server
In a terminal where Claude Code is already installed, run the following command to register the PMA MCP server with your Claude Code configuration:
claude mcp add pma-mcp --transport http https://mcp.powermyanalytics.com/
You only need to do this once. The MCP registration persists across Claude Code sessions.
Step 2: Authorize Your PMA Account
Open the Claude Code CLI by running
claude.Type
/mcpto view the list of registered MCP servers. The PMA MCP appears as unauthenticated at this point.Select pma-mcp from the list. Claude Code displays a one-time authorization link.
Open the link in your browser. The PMA OAuth flow runs the same way as in Claude Desktop:
- Sign in to PMA using your existing credentials. Sign in with Google, Sign in with Microsoft, and email + password are all supported.
- When prompted, select the hub you want to authorize.
- Click Continue when the "Authorization Successful" page loads. (The button is disabled until the OAuth callback completes, so clicking too early is no longer possible; the page also auto-redirects after a few seconds.)
Return to the Claude Code CLI. The PMA MCP now appears as authorized, and Claude will use its tools automatically when you ask data-related questions.
Reconnect or Reauthenticate
MCP access tokens last 1 year. Refresh tokens are not yet implemented; when a token expires (or if your hub access is revoked or your PMA login changes), reauthorize from the CLI:
- Run
claudeto open Claude Code. - Type
/mcpto view the registered MCP servers. - Select pma-mcp and complete the authorization flow again, following Step 2 above.
To remove the PMA MCP from your Claude Code configuration entirely, run:
claude mcp remove pma-mcp
Troubleshooting
PMA MCP shows as unauthenticated even after completing the OAuth flow
Cause: The OAuth callback may not have completed before the CLI was queried, or the authorization handshake was interrupted. Solution: Wait a few seconds, then run /mcp again. If the status still shows unauthenticated, retry the authorization by selecting pma-mcp in /mcp and re-running the flow.
Token expired or sudden loss of tool access
Cause: Access tokens are valid for 1 year, but they can expire earlier if your hub access is revoked or your PMA login changes. Solution: Reauthorize from the Claude Code CLI by running claude, typing /mcp, and re-running the authorization flow for pma-mcp. See Reconnect or Reauthenticate above.
Connection fails completely with no clear error
Cause: The server URL in your registration command may be incorrect. Solution: Re-run the registration command from Step 1 with the exact server URL, then retry the authorization. If the issue persists, submit a ticket.
The CLI cannot find the claude mcp command
Cause: Claude Code is not installed, or the binary is not on your shell PATH. Solution: Confirm Claude Code is installed by running claude --version. If the command is unrecognized, follow Anthropic's Claude Code installation documentation, then retry Step 1.