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

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.

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.

Prerequisites

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 list

The 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 gcs

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.

Scope
Where the server is available

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

  1. Open Claude Code.

  2. Run /mcp.

  3. 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

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.

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:

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.

Last updated