p4_add
Add files to Perforce
Read a Perforce depot from your assistant — changelists, file history, blame, diffs and review state — with writes blocked until you turn them on.
LABSCO SUMMARY
The composite helpers are the reason to prefer this over shelling out to p4: a changelist inspection returns the describe, the linked jobs and the reviewers together, and a workspace snapshot bundles info, status, opened files and recent changes — so a review question does not turn into a chain of round trips. Read-only and delete-disabled are the shipped defaults, which means a first connection cannot change the depot even by accident.
A Perforce server that drives the p4 CLI and returns structured JSON instead of parsed terminal output. It ships read-only by default, with the write-capable tools blocked until the safety flags are changed.
A Perforce server you have an account on, and the Perforce CLI installed and reachable as p4 or p4.exe — this server drives that binary rather than speaking the protocol itself. P4_PATH points at it if it is not on PATH. Connection settings come from a .p4config file or the MCP env block: P4PORT, P4USER, P4CLIENT and P4PASSWD. Node.js 18 or newer; npm install -g mcp-perforce-server from npm, currently 3.3.0. It runs over stdio by default; --transport=sse starts an HTTP server instead, configured with MCP_SSE_PORT, MCP_SSE_HOST, MCP_SSE_PATH, MCP_SSE_CORS_ORIGIN and, when you enable it, MCP_SSE_ENABLE_AUTH with MCP_SSE_AUTH_TOKEN. The safe profile is the default: P4_READONLY_MODE=true blocks the write-capable tools and P4_DISABLE_DELETE=true blocks deletion.
One command plus credentials — npm install -g mcp-perforce-server, then supply credentials
USE CASES
Inspect it in one call — description, affected files, linked jobs and reviewers — then read the diff.
Annotate the file, then read the history of the change that introduced it.
Analyze the two paths in one call — what has not been integrated and what already was.
Search for the pattern with file metadata and content previews returned alongside the hits.
Take the snapshot — server and client info, status, opened files and recent changes together.
Run the server-side depot-to-depot diff.
Discover the pending changelists and build them into review-ready bundles.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
p4_addAdd files to Perforce
p4_annotateAlias of p4.blame (line-by-line annotation)
p4_auditGet audit log entries for compliance reporting (requires audit logging enabled)
p4_blameShow file annotations with change history (like git blame)
p4_change_inspectComposite changelist inspection: describe + fixes + reviewers (+ optional file history)
p4_changelist_createCreate a new changelist
p4_changelist_submitSubmit a numbered changelist
p4_changelist_updateUpdate an existing changelist
p4_changesList submitted changelists with advanced filtering
p4_clientGet detailed client/workspace information
p4_clientsList Perforce clients/workspaces
p4_complianceGet compliance configuration and current status
p4_config_detectDetect and show Perforce configuration
p4_copyCopy files between locations
p4_deleteMark files for delete in Perforce
p4_describeDescribe a changelist with metadata, affected files, and optional diff content
p4_diffShow differences for workspace files (opened or local vs depot)
p4_diff2Compare two depot paths server-side (depot-to-depot diff, no client mapping required)
p4_dirsList directories in depot
p4_editOpen files for edit in Perforce
p4_file_inspectComposite file inspection: fstat + filelog + optional print/blame in one call
p4_filelogShow file history
p4_filesList files in depot with metadata
p4_fixesShow which changelists fix which jobs
p4_fstatGet file metadata from depot/workspace
p4_grepSearch for text patterns across depot files
p4_haveList files currently synced in workspace
p4_infoGet Perforce server and client information
p4_integrateIntegrate files from source to target
p4_integratedShow integration history for source/target paths
p4_interchangesList changelists not yet integrated between two paths
p4_jobGet job details
p4_jobsList jobs (if job tracking is enabled)
p4_labelGet label details
p4_labelsList labels
p4_mergeMerge files from source to target
p4_moveMove/rename files
p4_openedList opened files
p4_path_synccheckComposite path sync analysis using interchanges/integrated in one call
p4_printPrint file content from the depot
p4_resolveResolve merge conflicts
p4_revertRevert files or all files in changelist
p4_reviewList changelists pending review
p4_review_bundleComposite review workflow: pending changes with optional details/reviewers
p4_review_prepareComposite review preparation: discover or accept changelists, then build review-ready inspection bundles
p4_reviewsList reviewers for files or a changelist
p4_search_inspectComposite search helper: grep + optional fstat + optional content previews
p4_shelveShelve files for code review
p4_sizesGet file sizes and disk usage statistics
p4_statusGet status of opened files and pending changes
p4_streamGet stream spec details
p4_streamsList streams
p4_submitSubmit default changelist or create and submit new changelist
p4_syncSync files from Perforce depot
p4_unshelveUnshelve files from a shelved changelist
p4_userGet user information
p4_usersList Perforce users
p4_whereShow depot/local/workspace mappings for files
p4_workspace_snapshotComposite workspace snapshot: info + status + optional config/opened/recent changes
BEFORE YOU INSTALL
59 tools when we connected. P4_READONLY_MODE=true is the safe default and blocks sixteen write tools, leaving 43 callable; p4.delete also needs P4_DISABLE_DELETE=false. Clients see underscore names (p4_review_bundle); dotted names are still accepted.
CONTEXT COST
Rated by the size of the 59 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
npm install -g mcp-perforce-server{
"mcpServers": {
"perforce": {
"command": "mcp-perforce-server"
}
}
}Put P4PORT, P4USER, P4CLIENT and P4PASSWD in a .p4config file, or in the env block of this entry: "env": {"P4PORT": "ssl:perforce.example.com:1666", "P4USER": "your-username", "P4CLIENT": "your-workspace-name", "P4PASSWD": "your-password-or-ticket"}.
{
"servers": {
"perforce": {
"command": "mcp-perforce-server"
}
}
}Put P4PORT, P4USER, P4CLIENT and P4PASSWD in a .p4config file, or in the env block of this entry: "env": {"P4PORT": "ssl:perforce.example.com:1666", "P4USER": "your-username", "P4CLIENT": "your-workspace-name", "P4PASSWD": "your-password-or-ticket"}.
mcp-perforce-server --transport=ssePut P4PORT, P4USER, P4CLIENT and P4PASSWD in a .p4config file, or in the env block of this entry: "env": {"P4PORT": "ssl:perforce.example.com:1666", "P4USER": "your-username", "P4CLIENT": "your-workspace-name", "P4PASSWD": "your-password-or-ticket"}.