mcp-perforce-server
Provides tools for interacting with the Perforce version control system, enabling management of files, changelists, reviews, streams, labels, jobs, and more via p4 commands.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-perforce-server Show me my pending changelists"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Perforce Server
mcp-perforce-server is a Model Context Protocol server for Perforce (p4) with safe defaults, structured JSON responses, and both native-style and MCP-optimized workflows.
It is designed for AI assistants and IDE integrations that need Perforce access without relying on brittle shell scripting.
What It Provides
59 MCP tools across repository inspection, file operations, changelists, reviews, jobs, labels, streams, analytics, and compliance.
Dual transport support: stdio (IDE/CLI) and SSE (HTTP server for web clients).
Safe-by-default runtime behavior:
P4_READONLY_MODE=trueP4_DISABLE_DELETE=true
Batch-capable inputs for the tool surface where native
p4supports multi-target usage.MCP-specific composite helpers that reduce round trips for common review and search workflows.
Structured responses with
ok,result, optionalerror, optionalwarnings, andconfigUsed.MCP clients see underscore-safe tool names, for example
p4_changes.Incoming calls also accept the historical dotted names, for example
p4.changes.
Related MCP server: Aurea Orchestrator MCP
Highlighted Workflows
The server includes higher-level helpers on top of raw p4 commands.
p4.review.bundle: pending review changelists with optional details and reviewersp4.change.inspect:describe+fixes+reviews+ optional diff + optional file historyp4.path.synccheck: drift and sync-state analysis between two depot pathsp4.file.inspect: per-file metadata, history, optional content, and optional blamep4.workspace.snapshot: workspace info, status, optional config, opened files, and recent changesp4.search.inspect: grouped search results with optional file metadata and content previewsp4.review.prepare: explicit or discovered changelists prepared into review-ready bundles
Install
npm install -g mcp-perforce-serverRequirements:
Node.js 18+
Perforce CLI available as
p4orp4.exeValid Perforce environment via
.p4configor MCPenv
Quick Start
Install the Perforce CLI and ensure
p4is onPATH.Configure Perforce credentials in
.p4configor via MCPenv.Add the server to your MCP client.
Start in the default safe profile before enabling any write-capable tools.
Example .p4config:
P4PORT=ssl:perforce.example.com:1666
P4USER=your-username
P4CLIENT=your-workspace-name
P4PASSWD=your-password-or-ticketExample MCP config using the globally installed server:
{
"mcpServers": {
"perforce": {
"command": "mcp-perforce-server"
}
}
}Example MCP config with explicit credentials:
{
"mcpServers": {
"perforce": {
"command": "mcp-perforce-server",
"env": {
"P4PORT": "ssl:perforce.example.com:1666",
"P4USER": "your-username",
"P4CLIENT": "your-workspace-name",
"P4PASSWD": "your-password-or-ticket",
"P4_READONLY_MODE": "true",
"P4_DISABLE_DELETE": "true"
}
}
}
}Windows local-repo example:
{
"mcpServers": {
"perforce": {
"command": "node",
"args": ["C:\\Tools\\git-projects\\mcp-perforce-server\\dist\\server.js"]
}
}
}Transport Modes
The server supports two transport modes:
Stdio Transport (Default)
Standard input/output transport for IDE and CLI integration. Each MCP client spawns its own server process.
Best for:
VS Code, Cursor, Claude Desktop integration
CLI tools and local automation
Single-user workflows
Process-isolated security model
# Default mode (no flag needed)
mcp-perforce-serverSSE Transport (HTTP Server)
Server-Sent Events transport runs an HTTP server for web-based clients.
Best for:
Web dashboards and analytics UIs
Team collaboration tools
Centralized deployments
Multi-user environments
API integrations
# Start SSE server
mcp-perforce-server --transport=sse
# With custom configuration
MCP_SSE_PORT=8080 MCP_SSE_ENABLE_AUTH=true mcp-perforce-server --transport=sseSSE Configuration:
Variable | Default | Description |
|
| HTTP server port |
|
| Server bind address |
|
| SSE endpoint path |
|
| CORS allowed origins |
|
| Enable token authentication |
| (empty) | Bearer token for auth |
SSE Endpoints:
Main:
GET http://localhost:3000/mcpHealth:
GET http://localhost:3000/healthPost:
POST http://localhost:3000/mcp
Production SSE Example:
export MCP_SSE_ENABLE_AUTH=true
export MCP_SSE_AUTH_TOKEN="your-secret-token"
export MCP_SSE_CORS_ORIGIN="https://your-dashboard.com"
export P4_READONLY_MODE=true
mcp-perforce-server --transport=sse📘 For complete SSE deployment guide, see SSE_SETUP_GUIDE.md
Quick references:
MCP Configuration Examples - Quick config snippets
SSE Setup Guide - Comprehensive deployment guide with Docker, Kubernetes, and production examples
Safety Model
The default runtime profile is conservative.
Setting | Default | Effect |
|
| Blocks write-capable tools. |
|
| Blocks |
Write-capable tools include:
p4.add,p4.edit,p4.delete,p4.revert,p4.syncp4.changelist.create,p4.changelist.update,p4.changelist.submit,p4.submitp4.resolve,p4.shelve,p4.unshelvep4.copy,p4.move,p4.integrate,p4.merge
Tool Surface
Major categories:
Repository and workspace inspection
File operations and diffing
Changelists and submissions
Merge, shelving, and resolve flows
Search and discovery
Review and workflow composites
Users, clients, streams, labels, jobs, and fixes
Compliance, audit, and operational diagnostics
Notable native parity improvements:
Batch-style inputs for commands such as
sync,opened,filelog,annotate,grep,files,dirs,print,fstat,sizes,have,users,streams,jobs, andfixesExpanded native flag coverage for tools such as
sync,interchanges,fstat,files,dirs,streams,clients,labels,jobs, andsizesSupport for both workspace-facing and depot-to-depot diffing via
p4.diffandp4.diff2
Configuration
Most installations only need a small set of variables.
Variable | Default | Purpose |
|
| Keep the server read-only by default. |
|
| Prevent delete operations unless explicitly enabled. |
|
| Config file name used during upward discovery. |
|
| Custom path to the Perforce CLI. |
|
| Preset: |
|
| Max concurrent subcalls for composite tools. |
|
| Enable read-response caching. |
| unset | Per-tool cache TTL overrides. |
|
| Server log level. |
Perforce connection variables:
P4PORTP4USERP4CLIENTP4PASSWDP4CHARSETP4COMMANDCHARSETP4LANGUAGE
For full configuration tables and examples, see:
Development
npm install
npm run build
npm test
npm run test:integrationCurrent verification baseline:
npm run buildnpm testnpm run test:integration
Documentation
SSE Transport Setup: SSE_SETUP_GUIDE.md - Complete guide for HTTP/web deployments
Tool catalog and descriptions: AGENTS.md
Docs index: docs/README.md
Perforce setup: PERFORCE_SETUP.md
MCP client config examples: MCP_CONFIG_EXAMPLES.md
Publishing workflow: PUBLISHING.md
Release notes draft: RELEASE_NOTES.md
License
MIT
Available Tools
59 toolsp4_addC
Add files to Perforce
Inputs: files (required), changelist, workspacePath.
p4_annotateC
Alias of p4.blame (line-by-line annotation)
Inputs: file, files, workspacePath.
p4_auditB
Get audit log entries for compliance reporting (requires audit logging enabled)
Inputs: tool, user, since, format, +2 more.
p4_blameB
Show file annotations with change history (like git blame)
Inputs: file, files, workspacePath.
p4_change_inspectA
Composite changelist inspection: describe + fixes + reviewers (+ optional file history)
Inputs: changelist (required), diffFormat, includeDiff, maxRevisions, +3 more.
p4_changelist_createC
Create a new changelist
Inputs: description (required), files, workspacePath.
p4_changelist_submitC
Submit a numbered changelist
Inputs: changelist (required), workspacePath.
p4_changelist_updateC
Update an existing changelist
Inputs: changelist (required), files, description, workspacePath.
p4_changesB
List submitted changelists with advanced filtering
Inputs: max, user, client, status, +3 more.
p4_clientC
Get detailed client/workspace information
Inputs: client, workspacePath.
p4_clientsB
List Perforce clients/workspaces
Inputs: max, user, stream, serverId, +5 more.
p4_complianceB
Get compliance configuration and current status
Inputs: workspacePath.
p4_config_detectC
Detect and show Perforce configuration
Inputs: workspacePath.
p4_copyC
Copy files between locations
Inputs: source (required), destination (required), changelist, workspacePath.
p4_deleteB
Mark files for delete in Perforce
Inputs: files (required), changelist, workspacePath.
p4_describeA
Describe a changelist with metadata, affected files, and optional diff content
Inputs: changelist (required), diffFormat, includeDiff, workspacePath.
p4_diffA
Show differences for workspace files (opened or local vs depot)
Inputs: files, summary, workspacePath.
p4_diff2A
Compare two depot paths server-side (depot-to-depot diff, no client mapping required)
Inputs: sourcePath (required), targetPath (required), summaryOnly, workspacePath.
p4_dirsB
List directories in depot
Inputs: stream, filespec, onlyHave, filespecs, +4 more.
p4_editB
Open files for edit in Perforce
Inputs: files (required), changelist, workspacePath.
p4_file_inspectA
Composite file inspection: fstat + filelog + optional print/blame in one call
Inputs: filespec, maxFiles, filespecs, includeBlame, +5 more.
p4_filelogC
Show file history
Inputs: filespec, filespecs, maxRevisions, workspacePath.
p4_filesB
List files in depot with metadata
Inputs: max, filespec, filespecs, ignoreCase, +4 more.
p4_fixesB
Show which changelists fix which jobs
Inputs: job, files, changelist, workspacePath.
p4_fstatC
Get file metadata from depot/workspace
Inputs: max, fields, filter, filespec, +9 more.
p4_grepC
Search for text patterns across depot files
Inputs: pattern (required), filespec, filespecs, workspacePath, +1 more.
p4_haveA
List files currently synced in workspace
Inputs: filespec, filespecs, workspacePath.
p4_infoB
Get Perforce server and client information
Inputs: workspacePath.
p4_integrateC
Integrate files from source to target
Inputs: source (required), target (required), changelist, workspacePath.
p4_integratedB
Show integration history for source/target paths
Inputs: files, sourcePath, targetPath, workspacePath.
p4_interchangesC
List changelists not yet integrated between two paths
Inputs: max, time, user, branch, +10 more.
p4_jobC
Get job details
Inputs: job (required), workspacePath.
p4_jobsC
List jobs (if job tracking is enabled)
Inputs: job, max, files, jobView, +3 more.
p4_labelB
Get label details
Inputs: label (required), workspacePath.
p4_labelsD
List labels
Inputs: max, user, label, filespec, +8 more.
p4_mergeC
Merge files from source to target
Inputs: source (required), target (required), changelist, workspacePath.
p4_moveC
Move/rename files
Inputs: source (required), destination (required), changelist, workspacePath.
p4_openedC
List opened files
Inputs: files, changelist, workspacePath.
p4_path_synccheckC
Composite path sync analysis using interchanges/integrated in one call
Inputs: sourcePath (required), targetPath (required), workspacePath, maxInterchanges, +2 more.
p4_printA
Print file content from the depot
Inputs: quiet, filespec, filespecs, workspacePath.
p4_resolveC
Resolve merge conflicts
Inputs: files, strategy, changelist, workspacePath.
p4_revertC
Revert files or all files in changelist
Inputs: files, changelist, workspacePath.
p4_reviewB
List changelists pending review
Inputs: counter, filespec, workspacePath.
p4_review_bundleC
Composite review workflow: pending changes with optional details/reviewers
Inputs: counter, filespec, maxChanges, workspacePath, +2 more.
p4_review_prepareC
Composite review preparation: discover or accept changelists, then build review-ready inspection bundles
Inputs: user, client, status, filespec, +10 more.
p4_reviewsA
List reviewers for files or a changelist
Inputs: files, changelist, workspacePath.
p4_search_inspectC
Composite search helper: grep + optional fstat + optional content previews
Inputs: pattern (required), filespec, maxFiles, filespecs, +6 more.
p4_shelveC
Shelve files for code review
Inputs: changelist (required), files, delete, workspacePath.
p4_sizesC
Get file sizes and disk usage statistics
Inputs: max, filespec, blockSize, filespecs, +4 more.
p4_statusB
Get status of opened files and pending changes
Inputs: workspacePath.
p4_streamC
Get stream spec details
Inputs: stream (required), workspacePath.
p4_streamsC
List streams
Inputs: max, filter, stream, streams, +3 more.
p4_submitC
Submit default changelist or create and submit new changelist
Inputs: description (required), files, workspacePath.
p4_syncC
Sync files from Perforce depot
Inputs: max, force, quiet, preview, +10 more.
p4_unshelveB
Unshelve files from a shelved changelist
Inputs: changelist (required), files, force, workspacePath.
p4_userB
Get user information
Inputs: user, workspacePath.
p4_usersC
List Perforce users
Inputs: max, user, users, workspacePath, +1 more.
p4_whereA
Show depot/local/workspace mappings for files
Inputs: files (required), workspacePath.
p4_workspace_snapshotB
Composite workspace snapshot: info + status + optional config/opened/recent changes
Inputs: includeConfig, includeOpened, workspacePath, recentChangesMax, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 59 tools
Several tools have ambiguous boundaries: p4_annotate is an alias of p4_blame, p4_submit and p4_changelist_submit overlap, and p4_review/p4_reviews/p4_review_prepare/p4_review_bundle are easy to mix up. The singular/plural pairs and composite inspect helpers also require careful reading to select correctly.
The p4_ prefix creates an apparent uniform convention, but the suffixes mix raw verbs, plural nouns, reversed noun_verb forms like changelist_create, and composite names like workspace_snapshot. There is no single predictable pattern beyond the prefix.
At 59 tools, the server exposes a very large surface for an MCP agent. While Perforce is complex, many calls could be consolidated or omitted without hurting typical workflows, making the count clearly exceed a manageable scope.
Core Perforce workflows are thoroughly covered: file lifecycle, changelists, sync, shelving, resolving, integrating, labeling, streaming, job tracking, and review tooling. Minor gaps like branch-spec management and some administrative commands keep this from being perfect.
Maintenance
Related MCP Connectors
One MCP server for all your MCP servers: code mode, per-tool permissions, approvals and audit.
A MCP server built for developers enabling Git based project management with project and personal…
MCP Server for JFrog, providing tools for development and artifact management.
Independent trust scores, tool surfaces and change history for MCP servers.
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server for developer workflow automation — smart commits, secret scanning, PR descriptions, and more.5MIT
- AlicenseNot gradedqualityDmaintenanceProduction-ready MCP server for enforcing git/PR/Jira workflows with atomic, composable tools. Enables automated branch creation, conventional commits, PR generation, and Jira ticket operations with safety guardrails.MIT
- AlicenseBqualityDmaintenanceMCP Server for Git operations, agent templates, and project utilities.953 npmMIT
- AlicenseAqualityDmaintenanceA local MCP server that provides a safe, explicit set of Git operations for version control tasks like status, diff, branching, staging, committing, fetching, merging, and pushing.138 npmMIT