Get the FREE Ultimate OpenClaw Setup Guide →

p4mcp

[Community Supported] Perforce P4MCP Server is a Model Context Protocol (MCP) server that integrates with the Perforce P4 version control system.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio perforce-p4mcp-server docker run -i --rm --hostname your-hostname -e P4PORT=ssl:perforce.example.com:1666 -e P4USER=your_username -e P4CLIENT=your_workspace -v /Users/your_username/.p4tickets:/root/.p4tickets:ro p4-mcp-server \
  --env P4PORT="ssl:perforce.example.com:1666" \
  --env P4USER="your_username" \
  --env P4CLIENT="your_workspace"

How to use

Perforce P4 MCP Server exposes a structured set of read/write tools for Perforce data via the MCP protocol. It integrates closely with a P4 server to expose changelists, files, shelves, workspaces, jobs, and reviews, along with server metadata. The server also supports code review workflows, voting, state transitions, commenting, and participant management, with safety features like a read-only mode by default and explicit confirmation required for destructive deletes. To use it, configure an MCP client to connect to the server (e.g., via a Docker deployment, pre-built binaries, or a local build) and select which tool categories you enable (files, changelists, shelves, workspaces, jobs, reviews). When using Docker, you’ll typically set environment variables to point to your P4 server, user, and workspace, and mount your P4 tickets if you use ticket-based authentication. The MCP client will then expose operations such as reading changelist details, listing files, managing reviews, and performing write operations within the safety constraints defined by the server.

How to install

Prerequisites:

  • A Perforce P4 server you can access (with valid credentials).
  • Optional: Docker installed if you plan to run the MCP server via Docker container.

Installation options:

  1. Run via pre-built binaries (recommended for quick start)
  • Download the appropriate binary for your OS from the release page.
  • Extract and run the binary directly. No Python/P4 bindings required at runtime.
  1. Build from source (requires Python 3.11+ for building)
  • Ensure Python 3.11+ is installed.
  • Install any required build dependencies listed in the repository (e.g., Tkinter for GUI-related builds).
  • Run the provided build script (e.g., build.sh package on macOS/Linux or build.bat package on Windows).
  • Locate the output package (e.g., p4-mcp-server-<version>.tgz or .zip) and extract it.
  1. Run from Docker (recommended for containerized deployments)
  • Build the Docker image as described in the README: docker build -t p4-mcp-server .
  • Run the container with the appropriate environment and volume mounts as shown in the example configuration above.

Additional notes

Tips and common considerations:

  • If you use a P4CONFIG file, you can rely on its settings; you may not need to define environment variables in the mcp.json env block.
  • When using Docker, ensure the container hostname matches any host restrictions required by your workspace to avoid sync issues.
  • If you use P4 tickets, mount your tickets file into the container at /root/.p4tickets (read-only) or provide a path compatible with the container setup.
  • For write operations in Docker, you may need to mount your client root to a matching path inside the container so Perforce can track files by absolute paths.
  • Telemetry is optional and opt-in; configure as needed if you require usage statistics.
  • If you encounter hostname-related issues in Docker, adjust --hostname to match your workspace host restriction and verify the Root/Host values via p4 client -o your_workspace.

Related MCP Servers

Sponsor this space

Reach thousands of developers