P4 Explorer
VS Code / Cursor extension that browses Perforce and ships an MCP server for GitHub Copilot and Cursor agents.
What you get
- Current Workspace — client, user, server, root, stream
- Depots — all depots on the server
- Workspaces — client workspaces (current highlighted)
- Pending Changelists — your open CLs
- Submitted Changelists — your recent submits (configurable max)
Click a changelist to open a describe view.
MCP server (agents)
Bundled stdio MCP server with tools:
| Tool |
Purpose |
p4_info |
Connection / current client |
p4_list_depots |
List depots |
p4_list_workspaces |
List clients |
p4_get_workspace |
Client details + view |
p4_list_changelists |
Filter pending/submitted/shelved |
p4_describe_changelist |
CL description + files |
p4_list_opened |
Opened files |
p4_dirs / p4_files |
Browse depot paths |
p4_print |
File contents at revision |
p4_fstat |
File metadata |
GitHub Copilot (VS Code)
On install, the extension registers the MCP server via mcpServerDefinitionProviders. Enable Agent mode and use the tools picker — no mcp.json required.
Cursor
Run P4 Explorer: Install MCP for Cursor (writes ~/.cursor/mcp.json), or Copy MCP Config and paste into your Cursor MCP settings. Reload MCP / restart the agent after installing.
Requirements
- VS Code / Cursor with VS Code engine 1.99+ (MCP APIs)
- Helix p4 CLI on
PATH (or set p4Explorer.p4Path)
- Working
P4PORT / P4USER / P4CLIENT (env, P4CONFIG, or extension settings)
- A valid login ticket (
p4 login) — unauthenticated commands will surface Perforce password errors in the tree / MCP tools
Settings
| Setting |
Description |
p4Explorer.p4Path |
Path to p4 (default p4) |
p4Explorer.port |
P4PORT override |
p4Explorer.user |
P4USER override |
p4Explorer.client |
P4CLIENT override |
p4Explorer.submittedMax |
Submitted CL tree limit |
Install from Marketplace
Once published: search P4 Explorer in the Extensions view, or install by id (<publisher>.p4-explorer).
Develop
npm install
npm run build
Then Run Extension from the debug launch config (F5), or:
code --extensionDevelopmentPath=d:\p4-vs
Watch mode:
npm run watch
Architecture
src/
p4/ Shared p4 CLI client (-ztag)
views/ TreeDataProviders for the sidebar
mcp/server.ts MCP stdio entry (bundled to dist/mcp/server.js)
mcpProvider.ts Registers MCP with VS Code / Copilot
cursorMcp.ts Installs MCP into ~/.cursor/mcp.json
extension.ts
UI and MCP share the same P4ClientApi. The MCP process is launched with connection env from extension settings.