Use MCP servers with Claude Code
Connect your Claude Code client to the MCP servers behind the P0 AI Gateway, so your agent's tool calls are authenticated and governed by policy.
After an admin configures an MCP server behind the P0 AI Gateway, each developer connects their own Claude Code client to it with the P0 CLI. Connecting registers a per-user OAuth client and signs you in through P0, so your agent reaches the server through the gateway and every tool call is authenticated and checked against policy.
Prerequisites
The P0 CLI installed and logged in (
p0 login).Claude Code installed, with the
claudebinary on yourPATH.At least one MCP server configured behind the gateway.
List the available servers
List the MCP servers configured behind the gateway and available to you, and note the key of each one you want:
p0 claude mcp listThe output shows each server's key and gateway URL. See p0 claude mcp list for details.
Add each server
Connect Claude Code to a server by its key. Run the command once per server you want to use:
p0 claude mcp add aws
p0 claude mcp add gcsAfter adding a server, fully quit and reopen Claude Code so it reloads the MCP configuration. Starting a new conversation does not reload the configuration.
See p0 claude mcp add for all flags and options.
Choose a scope
The --scope flag maps to Claude Code's own configuration scopes, which control which of your projects can see the server. When you omit --scope, Claude Code applies its default, local.
local (default)
Only in the current project directory, and only to you.
user
Across all your projects on this machine, and only to you.
project
To everyone who works in this project, through a .mcp.json committed to the repository. Each user still authenticates through P0 individually.
To make a server available in every project on your machine, add it with --scope user:
Connect and authenticate
Open Claude Code.
Run
/mcp.Connect and authenticate to the server. You sign in through P0.
From then on, your agent's tool calls are enforced and audited by the gateway.
Verify
To confirm that the server was added successfully, run claude mcp get <server-name>. After reopening Claude Code, run /mcp and confirm the server shows as connected. Your agent can now call the server's tools; the gateway authenticates and checks each call against policy before it reaches the upstream server.
Switch to a different P0 user
The P0 CLI stores all your local state under ~/.p0: your identity and config, the credential cache, and the OAuth client it registered for MCP (~/.p0/claude/mcp-client.json). To operate as a different P0 user, delete this directory, then sign in and reconnect:
Related
p0 claude mcp list: list the servers available to you.p0 claude mcp add: connect Claude Code to a server.MCP server: configure a server behind the gateway (admin).
Last updated