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.
Last updated
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.
Connecting is per user and per machine. Everyone who wants to use a server must run these steps on their own machine. Configuring a server behind the gateway is an admin task. It doesn't connect anyone's client.
The P0 CLI installed and logged in (p0 login).
Claude Code installed, with the claude binary on your PATH.
At least one MCP server configured behind the gateway.
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.
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 gcsSee p0 claude mcp add for all flags and options.
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:
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.
Run /mcp in Claude Code 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.
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:
p0 logout clears your credentials but keeps the cached MCP OAuth client, so the next p0 claude mcp add reuses the previous client. Delete ~/.p0 to force the CLI to register a fresh client for the new user.
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
p0 claude mcp add aws --scope userrm -rf ~/.p0
p0 login
p0 claude mcp add <server> --scope user