mcp-perforce-server 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +203 -217
- package/dist/p4/parse.js +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +586 -7
- package/dist/server.js.map +1 -1
- package/dist/tools/advanced.d.ts +28 -0
- package/dist/tools/advanced.d.ts.map +1 -1
- package/dist/tools/advanced.js +223 -6
- package/dist/tools/advanced.js.map +1 -1
- package/dist/tools/arg-utils.d.ts +13 -0
- package/dist/tools/arg-utils.d.ts.map +1 -0
- package/dist/tools/arg-utils.js +57 -0
- package/dist/tools/arg-utils.js.map +1 -0
- package/dist/tools/basic.d.ts +58 -7
- package/dist/tools/basic.d.ts.map +1 -1
- package/dist/tools/basic.js +460 -70
- package/dist/tools/basic.js.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +6 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/utils.d.ts +2 -1
- package/dist/tools/utils.d.ts.map +1 -1
- package/dist/tools/utils.js +19 -3
- package/dist/tools/utils.js.map +1 -1
- package/dist/tools/workflows.d.ts +58 -0
- package/dist/tools/workflows.d.ts.map +1 -1
- package/dist/tools/workflows.js +547 -0
- package/dist/tools/workflows.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,217 +1,203 @@
|
|
|
1
|
-
# MCP Perforce Server
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/mcp-perforce-server)
|
|
4
|
-
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
[](https://nodejs.org/)
|
|
6
|
-
[](https://www.typescriptlang.org/)
|
|
7
|
-
[](https://mcpampel.com/repo/iPraBhu/mcp-perforce-server)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
|
151
|
-
|
|
152
|
-
| `
|
|
153
|
-
| `
|
|
154
|
-
| `
|
|
155
|
-
| `
|
|
156
|
-
| `
|
|
157
|
-
| `
|
|
158
|
-
| `
|
|
159
|
-
| `
|
|
160
|
-
| `
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
- Perforce setup notes: [PERFORCE_SETUP.md](PERFORCE_SETUP.md)
|
|
205
|
-
|
|
206
|
-
## Development
|
|
207
|
-
|
|
208
|
-
```bash
|
|
209
|
-
npm install
|
|
210
|
-
npm run build
|
|
211
|
-
npm test
|
|
212
|
-
npm run test:integration
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
## License
|
|
216
|
-
|
|
217
|
-
MIT
|
|
1
|
+
# MCP Perforce Server
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/mcp-perforce-server)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://nodejs.org/)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://mcpampel.com/repo/iPraBhu/mcp-perforce-server)
|
|
8
|
+
|
|
9
|
+
`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.
|
|
10
|
+
|
|
11
|
+
It is designed for AI assistants and IDE integrations that need Perforce access without relying on brittle shell scripting.
|
|
12
|
+
|
|
13
|
+
## What It Provides
|
|
14
|
+
|
|
15
|
+
- 59 MCP tools across repository inspection, file operations, changelists, reviews, jobs, labels, streams, analytics, and compliance.
|
|
16
|
+
- Safe-by-default runtime behavior:
|
|
17
|
+
- `P4_READONLY_MODE=true`
|
|
18
|
+
- `P4_DISABLE_DELETE=true`
|
|
19
|
+
- Batch-capable inputs for the tool surface where native `p4` supports multi-target usage.
|
|
20
|
+
- MCP-specific composite helpers that reduce round trips for common review and search workflows.
|
|
21
|
+
- Structured responses with `ok`, `result`, optional `error`, optional `warnings`, and `configUsed`.
|
|
22
|
+
- Compatibility with both dot and underscore tool naming:
|
|
23
|
+
- `p4.changes`
|
|
24
|
+
- `p4_changes`
|
|
25
|
+
|
|
26
|
+
## Highlighted Workflows
|
|
27
|
+
|
|
28
|
+
The server includes higher-level helpers on top of raw `p4` commands.
|
|
29
|
+
|
|
30
|
+
- `p4.review.bundle`: pending review changelists with optional details and reviewers
|
|
31
|
+
- `p4.change.inspect`: `describe` + `fixes` + `reviews` + optional diff + optional file history
|
|
32
|
+
- `p4.path.synccheck`: drift and sync-state analysis between two depot paths
|
|
33
|
+
- `p4.file.inspect`: per-file metadata, history, optional content, and optional blame
|
|
34
|
+
- `p4.workspace.snapshot`: workspace info, status, optional config, opened files, and recent changes
|
|
35
|
+
- `p4.search.inspect`: grouped search results with optional file metadata and content previews
|
|
36
|
+
- `p4.review.prepare`: explicit or discovered changelists prepared into review-ready bundles
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install -g mcp-perforce-server
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Requirements:
|
|
45
|
+
|
|
46
|
+
- Node.js 18+
|
|
47
|
+
- Perforce CLI available as `p4` or `p4.exe`
|
|
48
|
+
- Valid Perforce environment via `.p4config` or MCP `env`
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
1. Install the Perforce CLI and ensure `p4` is on `PATH`.
|
|
53
|
+
2. Configure Perforce credentials in `.p4config` or via MCP `env`.
|
|
54
|
+
3. Add the server to your MCP client.
|
|
55
|
+
4. Start in the default safe profile before enabling any write-capable tools.
|
|
56
|
+
|
|
57
|
+
Example `.p4config`:
|
|
58
|
+
|
|
59
|
+
```ini
|
|
60
|
+
P4PORT=ssl:perforce.example.com:1666
|
|
61
|
+
P4USER=your-username
|
|
62
|
+
P4CLIENT=your-workspace-name
|
|
63
|
+
P4PASSWD=your-password-or-ticket
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Example MCP config using the globally installed server:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"perforce": {
|
|
72
|
+
"command": "mcp-perforce-server"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Example MCP config with explicit credentials:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"perforce": {
|
|
84
|
+
"command": "mcp-perforce-server",
|
|
85
|
+
"env": {
|
|
86
|
+
"P4PORT": "ssl:perforce.example.com:1666",
|
|
87
|
+
"P4USER": "your-username",
|
|
88
|
+
"P4CLIENT": "your-workspace-name",
|
|
89
|
+
"P4PASSWD": "your-password-or-ticket",
|
|
90
|
+
"P4_READONLY_MODE": "true",
|
|
91
|
+
"P4_DISABLE_DELETE": "true"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Windows local-repo example:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"mcpServers": {
|
|
103
|
+
"perforce": {
|
|
104
|
+
"command": "node",
|
|
105
|
+
"args": ["C:\\Tools\\git-projects\\mcp-perforce-server\\dist\\server.js"]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Safety Model
|
|
112
|
+
|
|
113
|
+
The default runtime profile is conservative.
|
|
114
|
+
|
|
115
|
+
| Setting | Default | Effect |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| `P4_READONLY_MODE` | `true` | Blocks write-capable tools. |
|
|
118
|
+
| `P4_DISABLE_DELETE` | `true` | Blocks `p4.delete` even when write mode is enabled. |
|
|
119
|
+
|
|
120
|
+
Write-capable tools include:
|
|
121
|
+
|
|
122
|
+
- `p4.add`, `p4.edit`, `p4.delete`, `p4.revert`, `p4.sync`
|
|
123
|
+
- `p4.changelist.create`, `p4.changelist.update`, `p4.changelist.submit`, `p4.submit`
|
|
124
|
+
- `p4.resolve`, `p4.shelve`, `p4.unshelve`
|
|
125
|
+
- `p4.copy`, `p4.move`, `p4.integrate`, `p4.merge`
|
|
126
|
+
|
|
127
|
+
## Tool Surface
|
|
128
|
+
|
|
129
|
+
Major categories:
|
|
130
|
+
|
|
131
|
+
- Repository and workspace inspection
|
|
132
|
+
- File operations and diffing
|
|
133
|
+
- Changelists and submissions
|
|
134
|
+
- Merge, shelving, and resolve flows
|
|
135
|
+
- Search and discovery
|
|
136
|
+
- Review and workflow composites
|
|
137
|
+
- Users, clients, streams, labels, jobs, and fixes
|
|
138
|
+
- Compliance, audit, and operational diagnostics
|
|
139
|
+
|
|
140
|
+
Notable native parity improvements:
|
|
141
|
+
|
|
142
|
+
- Batch-style inputs for commands such as `sync`, `opened`, `filelog`, `annotate`, `grep`, `files`, `dirs`, `print`, `fstat`, `sizes`, `have`, `users`, `streams`, `jobs`, and `fixes`
|
|
143
|
+
- Expanded native flag coverage for tools such as `sync`, `interchanges`, `fstat`, `files`, `dirs`, `streams`, `clients`, `labels`, `jobs`, and `sizes`
|
|
144
|
+
- Support for both workspace-facing and depot-to-depot diffing via `p4.diff` and `p4.diff2`
|
|
145
|
+
|
|
146
|
+
## Configuration
|
|
147
|
+
|
|
148
|
+
Most installations only need a small set of variables.
|
|
149
|
+
|
|
150
|
+
| Variable | Default | Purpose |
|
|
151
|
+
|---|---|---|
|
|
152
|
+
| `P4_READONLY_MODE` | `true` | Keep the server read-only by default. |
|
|
153
|
+
| `P4_DISABLE_DELETE` | `true` | Prevent delete operations unless explicitly enabled. |
|
|
154
|
+
| `P4CONFIG` | `.p4config` | Config file name used during upward discovery. |
|
|
155
|
+
| `P4_PATH` | `p4` / `p4.exe` | Custom path to the Perforce CLI. |
|
|
156
|
+
| `P4_PERFORMANCE_MODE` | `fast` | Preset: `fast`, `balanced`, `secure`. |
|
|
157
|
+
| `P4_WORKFLOW_CONCURRENCY` | `6` | Max concurrent subcalls for composite tools. |
|
|
158
|
+
| `P4_RESPONSE_CACHE` | `true` | Enable read-response caching. |
|
|
159
|
+
| `P4_RESPONSE_CACHE_TTL_MAP` | unset | Per-tool cache TTL overrides. |
|
|
160
|
+
| `LOG_LEVEL` | `warn` | Server log level. |
|
|
161
|
+
|
|
162
|
+
Perforce connection variables:
|
|
163
|
+
|
|
164
|
+
- `P4PORT`
|
|
165
|
+
- `P4USER`
|
|
166
|
+
- `P4CLIENT`
|
|
167
|
+
- `P4PASSWD`
|
|
168
|
+
- `P4CHARSET`
|
|
169
|
+
- `P4COMMANDCHARSET`
|
|
170
|
+
- `P4LANGUAGE`
|
|
171
|
+
|
|
172
|
+
For full configuration tables and examples, see:
|
|
173
|
+
|
|
174
|
+
- [PERFORCE_SETUP.md](PERFORCE_SETUP.md)
|
|
175
|
+
- [MCP_CONFIG_EXAMPLES.md](MCP_CONFIG_EXAMPLES.md)
|
|
176
|
+
|
|
177
|
+
## Development
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npm install
|
|
181
|
+
npm run build
|
|
182
|
+
npm test
|
|
183
|
+
npm run test:integration
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Current verification baseline:
|
|
187
|
+
|
|
188
|
+
- `npm run build`
|
|
189
|
+
- `npm test`
|
|
190
|
+
- `npm run test:integration`
|
|
191
|
+
|
|
192
|
+
## Documentation
|
|
193
|
+
|
|
194
|
+
- Tool catalog and descriptions: [AGENTS.md](AGENTS.md)
|
|
195
|
+
- Docs index: [docs/README.md](docs/README.md)
|
|
196
|
+
- Perforce setup: [PERFORCE_SETUP.md](PERFORCE_SETUP.md)
|
|
197
|
+
- MCP client config examples: [MCP_CONFIG_EXAMPLES.md](MCP_CONFIG_EXAMPLES.md)
|
|
198
|
+
- Publishing workflow: [PUBLISHING.md](PUBLISHING.md)
|
|
199
|
+
- Release notes draft: [RELEASE_NOTES.md](RELEASE_NOTES.md)
|
|
200
|
+
|
|
201
|
+
## License
|
|
202
|
+
|
|
203
|
+
MIT
|
package/dist/p4/parse.js
CHANGED
|
@@ -249,7 +249,7 @@ function parseInterchangesOutput(output) {
|
|
|
249
249
|
}
|
|
250
250
|
continue;
|
|
251
251
|
}
|
|
252
|
-
const headerMatch = line.match(/^Change\s+(\d+)\s+on\s+(
|
|
252
|
+
const headerMatch = line.match(/^Change\s+(\d+)\s+on\s+(.+?)\s+by\s+(.+?)@(.+?)(?:\s+'(.*)')?$/);
|
|
253
253
|
if (headerMatch) {
|
|
254
254
|
finalizeCurrent();
|
|
255
255
|
const [, change, date, user, client, description] = headerMatch;
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAoPA,cAAM,iBAAiB;IACrB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAyC;IACpE,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA6C;IAClF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAyE;IAC5G,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAGtC;IACF,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAqE;IAC/G,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA6C;IAClF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAGjC;IACF,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAMzC;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiC;IAC/D,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAuC;IAC5E,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA2C;IAC3E,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAwD;IAC9F,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA8C;IACjF,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAgE;IACtG,OAAO,CAAC,gBAAgB,CAA+B;IACvD,OAAO,CAAC,UAAU,CAAK;;IA2BvB,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,uBAAuB;IAc/B,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,eAAe;IAqBvB,OAAO,CAAC,eAAe;IAyBvB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,yBAAyB;IAcjC,OAAO,CAAC,qBAAqB;IAiE7B,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,oBAAoB;IAe5B,OAAO,CAAC,sBAAsB;YAwBhB,WAAW;YAWX,sBAAsB;IA6CpC,OAAO,CAAC,iBAAiB;IAu8DnB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAM3B;AA+ED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|