For the complete documentation index, see llms.txt. This page is also available as Markdown.

p0 claude mcp add

Overview

p0 claude mcp add connects a Claude Code client to an MCP server that is gated by the P0 AI Gateway. It registers (or reuses) a P0 OAuth client for this machine, resolves the server's gateway URL from your P0 tenant, and writes the server into your Claude Code MCP configuration, so Claude Code authenticates through P0, and every tool call it makes is governed by policy and recorded.


Prerequisites

  • Logged into the P0 CLI (p0 login).

  • Claude Code installed, with the claude binary on your PATH.

  • The MCP server configured behind the gateway and available to you. See the Agentic Gateway integration, and run p0 claude mcp list to see the servers you can add.


Syntax & Flags

p0 claude mcp add <server> [-s|--scope <local|user|project>] [--callbackPort <port>]
  • <server> (required): the MCP server key, as configured behind the gateway (for example, aws). Run p0 claude mcp list to see the available keys.

  • -s, --scope <local|user|project>: the Claude Code configuration scope to write the server into. Defaults to local (Claude Code's default) when omitted.

  • --callbackPort <port>: local port for the OAuth authentication callback. Default 52566.

  • --debug: emit debug logs.


What it does

  1. Authenticates you to P0.

  2. Registers a P0 OAuth client for this machine, or reuses the one cached under ~/.p0/claude/mcp-client.json.

  3. Resolves the server's gateway URL from your P0 tenant.

  4. Invokes Claude Code's own claude mcp add to write an HTTP MCP server entry (with OAuth) into your Claude configuration (~/.claude.json). The client secret is passed to Claude Code in memory. It is never written to that file.

After adding the server, open Claude Code, run /mcp, and connect and authenticate to the server. You sign in through P0, and from then on your agent's tool calls are enforced and audited by the gateway.


Examples


Last updated