mcp-perforce-server 1.0.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/LICENSE +21 -0
- package/MCP_CONFIG_EXAMPLES.md +205 -0
- package/README.md +224 -0
- package/dist/p4/config.d.ts +67 -0
- package/dist/p4/config.d.ts.map +1 -0
- package/dist/p4/config.js +259 -0
- package/dist/p4/config.js.map +1 -0
- package/dist/p4/parse.d.ts +39 -0
- package/dist/p4/parse.d.ts.map +1 -0
- package/dist/p4/parse.js +286 -0
- package/dist/p4/parse.js.map +1 -0
- package/dist/p4/runner.d.ts +45 -0
- package/dist/p4/runner.d.ts.map +1 -0
- package/dist/p4/runner.js +303 -0
- package/dist/p4/runner.js.map +1 -0
- package/dist/server.d.ts +11 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +562 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/basic.d.ts +79 -0
- package/dist/tools/basic.d.ts.map +1 -0
- package/dist/tools/basic.js +401 -0
- package/dist/tools/basic.js.map +1 -0
- package/dist/tools/changelist.d.ts +50 -0
- package/dist/tools/changelist.d.ts.map +1 -0
- package/dist/tools/changelist.js +469 -0
- package/dist/tools/changelist.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +28 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/utils.d.ts +32 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +164 -0
- package/dist/tools/utils.js.map +1 -0
- package/package.json +87 -0
package/dist/server.js
ADDED
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.MCPPerforceServer = void 0;
|
|
38
|
+
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
39
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
40
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
41
|
+
const runner_js_1 = require("./p4/runner.js");
|
|
42
|
+
const config_js_1 = require("./p4/config.js");
|
|
43
|
+
const tools = __importStar(require("./tools/index.js"));
|
|
44
|
+
// Environment-based logging
|
|
45
|
+
const LOG_LEVEL = process.env.LOG_LEVEL || 'warn';
|
|
46
|
+
const shouldLog = (level) => {
|
|
47
|
+
const levels = ['error', 'warn', 'info', 'debug'];
|
|
48
|
+
return levels.indexOf(level) <= levels.indexOf(LOG_LEVEL);
|
|
49
|
+
};
|
|
50
|
+
const log = {
|
|
51
|
+
error: (...args) => shouldLog('error') && console.error('[ERROR]', ...args),
|
|
52
|
+
warn: (...args) => shouldLog('warn') && console.error('[WARN]', ...args),
|
|
53
|
+
info: (...args) => shouldLog('info') && console.error('[INFO]', ...args),
|
|
54
|
+
debug: (...args) => shouldLog('debug') && console.error('[DEBUG]', ...args),
|
|
55
|
+
};
|
|
56
|
+
class MCPPerforceServer {
|
|
57
|
+
constructor() {
|
|
58
|
+
this.server = new index_js_1.Server({
|
|
59
|
+
name: 'mcp-perforce-server',
|
|
60
|
+
version: '1.0.0',
|
|
61
|
+
}, {
|
|
62
|
+
capabilities: {
|
|
63
|
+
tools: {},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
this.context = {
|
|
67
|
+
runner: new runner_js_1.P4Runner(),
|
|
68
|
+
config: new config_js_1.P4Config(),
|
|
69
|
+
serverConfig: new config_js_1.P4Config().getServerConfig(),
|
|
70
|
+
};
|
|
71
|
+
this.setupToolHandlers();
|
|
72
|
+
this.setupErrorHandling();
|
|
73
|
+
}
|
|
74
|
+
setupErrorHandling() {
|
|
75
|
+
this.server.onerror = (error) => {
|
|
76
|
+
log.error('MCP Server error:', error);
|
|
77
|
+
};
|
|
78
|
+
process.on('SIGINT', async () => {
|
|
79
|
+
log.info('Shutting down MCP Perforce server...');
|
|
80
|
+
await this.server.close();
|
|
81
|
+
process.exit(0);
|
|
82
|
+
});
|
|
83
|
+
process.on('SIGTERM', async () => {
|
|
84
|
+
log.info('Shutting down MCP Perforce server...');
|
|
85
|
+
await this.server.close();
|
|
86
|
+
process.exit(0);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
setupToolHandlers() {
|
|
90
|
+
this.server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
|
|
91
|
+
log.debug('Listing available tools');
|
|
92
|
+
return {
|
|
93
|
+
tools: [
|
|
94
|
+
{
|
|
95
|
+
name: 'p4.info',
|
|
96
|
+
description: 'Get Perforce server and client information',
|
|
97
|
+
inputSchema: {
|
|
98
|
+
type: 'object',
|
|
99
|
+
properties: {
|
|
100
|
+
workspacePath: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
additionalProperties: false,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'p4.status',
|
|
110
|
+
description: 'Get status of opened files and pending changes',
|
|
111
|
+
inputSchema: {
|
|
112
|
+
type: 'object',
|
|
113
|
+
properties: {
|
|
114
|
+
workspacePath: {
|
|
115
|
+
type: 'string',
|
|
116
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
additionalProperties: false,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'p4.add',
|
|
124
|
+
description: 'Add files to Perforce',
|
|
125
|
+
inputSchema: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
properties: {
|
|
128
|
+
files: {
|
|
129
|
+
type: 'array',
|
|
130
|
+
items: { type: 'string' },
|
|
131
|
+
description: 'Files to add (required)',
|
|
132
|
+
minItems: 1,
|
|
133
|
+
},
|
|
134
|
+
changelist: {
|
|
135
|
+
type: 'string',
|
|
136
|
+
description: 'Changelist number (optional, defaults to default changelist)',
|
|
137
|
+
},
|
|
138
|
+
workspacePath: {
|
|
139
|
+
type: 'string',
|
|
140
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
required: ['files'],
|
|
144
|
+
additionalProperties: false,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'p4.edit',
|
|
149
|
+
description: 'Open files for edit in Perforce',
|
|
150
|
+
inputSchema: {
|
|
151
|
+
type: 'object',
|
|
152
|
+
properties: {
|
|
153
|
+
files: {
|
|
154
|
+
type: 'array',
|
|
155
|
+
items: { type: 'string' },
|
|
156
|
+
description: 'Files to edit (required)',
|
|
157
|
+
minItems: 1,
|
|
158
|
+
},
|
|
159
|
+
changelist: {
|
|
160
|
+
type: 'string',
|
|
161
|
+
description: 'Changelist number (optional, defaults to default changelist)',
|
|
162
|
+
},
|
|
163
|
+
workspacePath: {
|
|
164
|
+
type: 'string',
|
|
165
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
required: ['files'],
|
|
169
|
+
additionalProperties: false,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: 'p4.delete',
|
|
174
|
+
description: 'Mark files for delete in Perforce',
|
|
175
|
+
inputSchema: {
|
|
176
|
+
type: 'object',
|
|
177
|
+
properties: {
|
|
178
|
+
files: {
|
|
179
|
+
type: 'array',
|
|
180
|
+
items: { type: 'string' },
|
|
181
|
+
description: 'Files to delete (required)',
|
|
182
|
+
minItems: 1,
|
|
183
|
+
},
|
|
184
|
+
changelist: {
|
|
185
|
+
type: 'string',
|
|
186
|
+
description: 'Changelist number (optional, defaults to default changelist)',
|
|
187
|
+
},
|
|
188
|
+
workspacePath: {
|
|
189
|
+
type: 'string',
|
|
190
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
required: ['files'],
|
|
194
|
+
additionalProperties: false,
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: 'p4.revert',
|
|
199
|
+
description: 'Revert files or all files in changelist',
|
|
200
|
+
inputSchema: {
|
|
201
|
+
type: 'object',
|
|
202
|
+
properties: {
|
|
203
|
+
files: {
|
|
204
|
+
type: 'array',
|
|
205
|
+
items: { type: 'string' },
|
|
206
|
+
description: 'Files to revert (optional, if not provided reverts all files)',
|
|
207
|
+
},
|
|
208
|
+
changelist: {
|
|
209
|
+
type: 'string',
|
|
210
|
+
description: 'Changelist number (optional, defaults to default changelist)',
|
|
211
|
+
},
|
|
212
|
+
workspacePath: {
|
|
213
|
+
type: 'string',
|
|
214
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
additionalProperties: false,
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: 'p4.sync',
|
|
222
|
+
description: 'Sync files from Perforce depot',
|
|
223
|
+
inputSchema: {
|
|
224
|
+
type: 'object',
|
|
225
|
+
properties: {
|
|
226
|
+
filespec: {
|
|
227
|
+
type: 'string',
|
|
228
|
+
description: 'Filespec to sync (optional, defaults to current directory)',
|
|
229
|
+
},
|
|
230
|
+
force: {
|
|
231
|
+
type: 'boolean',
|
|
232
|
+
description: 'Force sync (optional, defaults to false)',
|
|
233
|
+
},
|
|
234
|
+
preview: {
|
|
235
|
+
type: 'boolean',
|
|
236
|
+
description: 'Preview sync without executing (optional, defaults to false)',
|
|
237
|
+
},
|
|
238
|
+
workspacePath: {
|
|
239
|
+
type: 'string',
|
|
240
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
additionalProperties: false,
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: 'p4.opened',
|
|
248
|
+
description: 'List opened files',
|
|
249
|
+
inputSchema: {
|
|
250
|
+
type: 'object',
|
|
251
|
+
properties: {
|
|
252
|
+
changelist: {
|
|
253
|
+
type: 'string',
|
|
254
|
+
description: 'Changelist number (optional, shows all opened files if not specified)',
|
|
255
|
+
},
|
|
256
|
+
workspacePath: {
|
|
257
|
+
type: 'string',
|
|
258
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
additionalProperties: false,
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: 'p4.diff',
|
|
266
|
+
description: 'Show differences for files',
|
|
267
|
+
inputSchema: {
|
|
268
|
+
type: 'object',
|
|
269
|
+
properties: {
|
|
270
|
+
files: {
|
|
271
|
+
type: 'array',
|
|
272
|
+
items: { type: 'string' },
|
|
273
|
+
description: 'Files to diff (optional, defaults to all opened files)',
|
|
274
|
+
},
|
|
275
|
+
summary: {
|
|
276
|
+
type: 'boolean',
|
|
277
|
+
description: 'Show summary only (optional, defaults to false)',
|
|
278
|
+
},
|
|
279
|
+
workspacePath: {
|
|
280
|
+
type: 'string',
|
|
281
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
additionalProperties: false,
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: 'p4.changelist.create',
|
|
289
|
+
description: 'Create a new changelist',
|
|
290
|
+
inputSchema: {
|
|
291
|
+
type: 'object',
|
|
292
|
+
properties: {
|
|
293
|
+
description: {
|
|
294
|
+
type: 'string',
|
|
295
|
+
description: 'Changelist description (required)',
|
|
296
|
+
},
|
|
297
|
+
files: {
|
|
298
|
+
type: 'array',
|
|
299
|
+
items: { type: 'string' },
|
|
300
|
+
description: 'Files to include in changelist (optional)',
|
|
301
|
+
},
|
|
302
|
+
workspacePath: {
|
|
303
|
+
type: 'string',
|
|
304
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
required: ['description'],
|
|
308
|
+
additionalProperties: false,
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
name: 'p4.changelist.update',
|
|
313
|
+
description: 'Update an existing changelist',
|
|
314
|
+
inputSchema: {
|
|
315
|
+
type: 'object',
|
|
316
|
+
properties: {
|
|
317
|
+
changelist: {
|
|
318
|
+
type: 'string',
|
|
319
|
+
description: 'Changelist number (required)',
|
|
320
|
+
},
|
|
321
|
+
description: {
|
|
322
|
+
type: 'string',
|
|
323
|
+
description: 'New description (optional)',
|
|
324
|
+
},
|
|
325
|
+
files: {
|
|
326
|
+
type: 'array',
|
|
327
|
+
items: { type: 'string' },
|
|
328
|
+
description: 'Files to include in changelist (optional)',
|
|
329
|
+
},
|
|
330
|
+
workspacePath: {
|
|
331
|
+
type: 'string',
|
|
332
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
required: ['changelist'],
|
|
336
|
+
additionalProperties: false,
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
name: 'p4.changelist.submit',
|
|
341
|
+
description: 'Submit a numbered changelist',
|
|
342
|
+
inputSchema: {
|
|
343
|
+
type: 'object',
|
|
344
|
+
properties: {
|
|
345
|
+
changelist: {
|
|
346
|
+
type: 'string',
|
|
347
|
+
description: 'Changelist number to submit (required)',
|
|
348
|
+
},
|
|
349
|
+
workspacePath: {
|
|
350
|
+
type: 'string',
|
|
351
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
required: ['changelist'],
|
|
355
|
+
additionalProperties: false,
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
name: 'p4.submit',
|
|
360
|
+
description: 'Submit default changelist or create and submit new changelist',
|
|
361
|
+
inputSchema: {
|
|
362
|
+
type: 'object',
|
|
363
|
+
properties: {
|
|
364
|
+
description: {
|
|
365
|
+
type: 'string',
|
|
366
|
+
description: 'Submit description (required for default changelist)',
|
|
367
|
+
},
|
|
368
|
+
files: {
|
|
369
|
+
type: 'array',
|
|
370
|
+
items: { type: 'string' },
|
|
371
|
+
description: 'Files to submit (optional, defaults to all files in default changelist)',
|
|
372
|
+
},
|
|
373
|
+
workspacePath: {
|
|
374
|
+
type: 'string',
|
|
375
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
required: ['description'],
|
|
379
|
+
additionalProperties: false,
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
name: 'p4.describe',
|
|
384
|
+
description: 'Describe a changelist',
|
|
385
|
+
inputSchema: {
|
|
386
|
+
type: 'object',
|
|
387
|
+
properties: {
|
|
388
|
+
changelist: {
|
|
389
|
+
type: 'string',
|
|
390
|
+
description: 'Changelist number (required)',
|
|
391
|
+
},
|
|
392
|
+
workspacePath: {
|
|
393
|
+
type: 'string',
|
|
394
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
required: ['changelist'],
|
|
398
|
+
additionalProperties: false,
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
name: 'p4.filelog',
|
|
403
|
+
description: 'Show file history',
|
|
404
|
+
inputSchema: {
|
|
405
|
+
type: 'object',
|
|
406
|
+
properties: {
|
|
407
|
+
filespec: {
|
|
408
|
+
type: 'string',
|
|
409
|
+
description: 'Filespec to show history for (required)',
|
|
410
|
+
},
|
|
411
|
+
maxRevisions: {
|
|
412
|
+
type: 'number',
|
|
413
|
+
description: 'Maximum number of revisions to show (optional)',
|
|
414
|
+
},
|
|
415
|
+
workspacePath: {
|
|
416
|
+
type: 'string',
|
|
417
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
required: ['filespec'],
|
|
421
|
+
additionalProperties: false,
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
name: 'p4.clients',
|
|
426
|
+
description: 'List Perforce clients/workspaces',
|
|
427
|
+
inputSchema: {
|
|
428
|
+
type: 'object',
|
|
429
|
+
properties: {
|
|
430
|
+
user: {
|
|
431
|
+
type: 'string',
|
|
432
|
+
description: 'Filter by user (optional)',
|
|
433
|
+
},
|
|
434
|
+
workspacePath: {
|
|
435
|
+
type: 'string',
|
|
436
|
+
description: 'Path to workspace directory (optional, defaults to current directory)',
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
additionalProperties: false,
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
name: 'p4.config.detect',
|
|
444
|
+
description: 'Detect and show Perforce configuration',
|
|
445
|
+
inputSchema: {
|
|
446
|
+
type: 'object',
|
|
447
|
+
properties: {
|
|
448
|
+
workspacePath: {
|
|
449
|
+
type: 'string',
|
|
450
|
+
description: 'Path to start config search from (optional, defaults to current directory)',
|
|
451
|
+
},
|
|
452
|
+
},
|
|
453
|
+
additionalProperties: false,
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
],
|
|
457
|
+
};
|
|
458
|
+
});
|
|
459
|
+
this.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
460
|
+
try {
|
|
461
|
+
log.debug(`Calling tool: ${request.params.name}`);
|
|
462
|
+
const { name, arguments: args } = request.params;
|
|
463
|
+
// Route to appropriate tool implementation
|
|
464
|
+
switch (name) {
|
|
465
|
+
case 'p4.info':
|
|
466
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4Info(this.context, args), null, 2) }] };
|
|
467
|
+
case 'p4.status':
|
|
468
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4Status(this.context, args), null, 2) }] };
|
|
469
|
+
case 'p4.add':
|
|
470
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4Add(this.context, args), null, 2) }] };
|
|
471
|
+
case 'p4.edit':
|
|
472
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4Edit(this.context, args), null, 2) }] };
|
|
473
|
+
case 'p4.delete':
|
|
474
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4Delete(this.context, args), null, 2) }] };
|
|
475
|
+
case 'p4.revert':
|
|
476
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4Revert(this.context, args), null, 2) }] };
|
|
477
|
+
case 'p4.sync':
|
|
478
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4Sync(this.context, args), null, 2) }] };
|
|
479
|
+
case 'p4.opened':
|
|
480
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4Opened(this.context, args), null, 2) }] };
|
|
481
|
+
case 'p4.diff':
|
|
482
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4Diff(this.context, args), null, 2) }] };
|
|
483
|
+
case 'p4.changelist.create':
|
|
484
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4ChangelistCreate(this.context, args), null, 2) }] };
|
|
485
|
+
case 'p4.changelist.update':
|
|
486
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4ChangelistUpdate(this.context, args), null, 2) }] };
|
|
487
|
+
case 'p4.changelist.submit':
|
|
488
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4ChangelistSubmit(this.context, args), null, 2) }] };
|
|
489
|
+
case 'p4.submit':
|
|
490
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4Submit(this.context, args), null, 2) }] };
|
|
491
|
+
case 'p4.describe':
|
|
492
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4Describe(this.context, args), null, 2) }] };
|
|
493
|
+
case 'p4.filelog':
|
|
494
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4Filelog(this.context, args), null, 2) }] };
|
|
495
|
+
case 'p4.clients':
|
|
496
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4Clients(this.context, args), null, 2) }] };
|
|
497
|
+
case 'p4.config.detect':
|
|
498
|
+
return { content: [{ type: 'text', text: JSON.stringify(await tools.p4ConfigDetect(this.context, args), null, 2) }] };
|
|
499
|
+
default:
|
|
500
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
catch (error) {
|
|
504
|
+
log.error('Tool execution error:', error);
|
|
505
|
+
if (error instanceof types_js_1.McpError) {
|
|
506
|
+
throw error;
|
|
507
|
+
}
|
|
508
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Tool execution failed: ${error}`);
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
async run() {
|
|
513
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
514
|
+
log.info('Starting MCP Perforce server...');
|
|
515
|
+
await this.server.connect(transport);
|
|
516
|
+
log.info('MCP Perforce server running');
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
exports.MCPPerforceServer = MCPPerforceServer;
|
|
520
|
+
// Start the server
|
|
521
|
+
if (require.main === module) {
|
|
522
|
+
// Handle help flag
|
|
523
|
+
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
524
|
+
console.log(`
|
|
525
|
+
MCP Perforce Server v1.0.0
|
|
526
|
+
===========================
|
|
527
|
+
|
|
528
|
+
A production-ready MCP (Model Context Protocol) server for Perforce operations.
|
|
529
|
+
|
|
530
|
+
Usage:
|
|
531
|
+
mcp-perforce-server Start the MCP server (stdio transport)
|
|
532
|
+
mcp-perforce-server --help Show this help message
|
|
533
|
+
|
|
534
|
+
Environment Variables:
|
|
535
|
+
P4_READONLY_MODE=false Enable write operations (default: true)
|
|
536
|
+
P4_DISABLE_DELETE=false Enable delete operations (default: true)
|
|
537
|
+
P4_PATH=/path/to/p4 Custom p4 executable path
|
|
538
|
+
P4CONFIG=.p4config Config file name (default: .p4config)
|
|
539
|
+
LOG_LEVEL=info Logging level: error,warn,info,debug
|
|
540
|
+
|
|
541
|
+
Configuration:
|
|
542
|
+
Place a .p4config file in your project root or parent directories:
|
|
543
|
+
|
|
544
|
+
P4PORT=your-server:1666
|
|
545
|
+
P4USER=your-username
|
|
546
|
+
P4CLIENT=your-workspace-name
|
|
547
|
+
|
|
548
|
+
IDE Integration:
|
|
549
|
+
Configure your IDE's MCP client to use this server.
|
|
550
|
+
See README.md for VS Code and Cursor setup instructions.
|
|
551
|
+
|
|
552
|
+
For more information: https://github.com/iPraBhu/mcp-perforce-server
|
|
553
|
+
`);
|
|
554
|
+
process.exit(0);
|
|
555
|
+
}
|
|
556
|
+
const server = new MCPPerforceServer();
|
|
557
|
+
server.run().catch((error) => {
|
|
558
|
+
log.error('Failed to start server:', error);
|
|
559
|
+
process.exit(1);
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wEAAmE;AACnE,wEAAiF;AACjF,iEAK4C;AAE5C,8CAA0C;AAC1C,8CAA0D;AAC1D,wDAA0C;AAE1C,4BAA4B;AAC5B,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM,CAAC;AAClD,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE;IAClC,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAC5D,CAAC,CAAC;AAEF,MAAM,GAAG,GAAG;IACV,KAAK,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC;IACtF,IAAI,EAAE,CAAC,GAAG,IA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BAAS,CAAC,aAAa,EAAE,0BAA0B,KAAK,EAAE,CAAC,CAAC;YACjF,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,GAAG;QACP,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;QAC7C,GAAG,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAC5C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACrC,GAAG,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IAC1C,CAAC;CACF;AA8CQ,8CAAiB;AA5C1B,mBAAmB;AACnB,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,mBAAmB;IACnB,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACnE,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Bf,CAAC,CAAC;QACC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,iBAAiB,EAAE,CAAC;IACvC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAC3B,GAAG,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool implementations for MCP Perforce server
|
|
3
|
+
*/
|
|
4
|
+
import { P4Runner, P4RunResult } from '../p4/runner.js';
|
|
5
|
+
import { P4Config, P4ServerConfig } from '../p4/config.js';
|
|
6
|
+
export interface ToolContext {
|
|
7
|
+
runner: P4Runner;
|
|
8
|
+
config: P4Config;
|
|
9
|
+
serverConfig: P4ServerConfig;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* p4 info - Get Perforce server and client information
|
|
13
|
+
*/
|
|
14
|
+
export declare function p4Info(context: ToolContext, args?: {
|
|
15
|
+
workspacePath?: string;
|
|
16
|
+
}): Promise<P4RunResult>;
|
|
17
|
+
/**
|
|
18
|
+
* p4 opened - List opened files
|
|
19
|
+
*/
|
|
20
|
+
export declare function p4Opened(context: ToolContext, args?: {
|
|
21
|
+
changelist?: string;
|
|
22
|
+
workspacePath?: string;
|
|
23
|
+
}): Promise<P4RunResult>;
|
|
24
|
+
/**
|
|
25
|
+
* p4 status - Get status of opened files and pending changes
|
|
26
|
+
*/
|
|
27
|
+
export declare function p4Status(context: ToolContext, args?: {
|
|
28
|
+
workspacePath?: string;
|
|
29
|
+
}): Promise<P4RunResult>;
|
|
30
|
+
/**
|
|
31
|
+
* p4 add - Add files to Perforce
|
|
32
|
+
*/
|
|
33
|
+
export declare function p4Add(context: ToolContext, args: {
|
|
34
|
+
files: string[];
|
|
35
|
+
changelist?: string;
|
|
36
|
+
workspacePath?: string;
|
|
37
|
+
}): Promise<P4RunResult>;
|
|
38
|
+
/**
|
|
39
|
+
* p4 edit - Open files for edit
|
|
40
|
+
*/
|
|
41
|
+
export declare function p4Edit(context: ToolContext, args: {
|
|
42
|
+
files: string[];
|
|
43
|
+
changelist?: string;
|
|
44
|
+
workspacePath?: string;
|
|
45
|
+
}): Promise<P4RunResult>;
|
|
46
|
+
/**
|
|
47
|
+
* p4 delete - Mark files for delete
|
|
48
|
+
*/
|
|
49
|
+
export declare function p4Delete(context: ToolContext, args: {
|
|
50
|
+
files: string[];
|
|
51
|
+
changelist?: string;
|
|
52
|
+
workspacePath?: string;
|
|
53
|
+
}): Promise<P4RunResult>;
|
|
54
|
+
/**
|
|
55
|
+
* p4 revert - Revert files
|
|
56
|
+
*/
|
|
57
|
+
export declare function p4Revert(context: ToolContext, args?: {
|
|
58
|
+
files?: string[];
|
|
59
|
+
changelist?: string;
|
|
60
|
+
workspacePath?: string;
|
|
61
|
+
}): Promise<P4RunResult>;
|
|
62
|
+
/**
|
|
63
|
+
* p4 sync - Sync files from depot
|
|
64
|
+
*/
|
|
65
|
+
export declare function p4Sync(context: ToolContext, args?: {
|
|
66
|
+
filespec?: string;
|
|
67
|
+
force?: boolean;
|
|
68
|
+
preview?: boolean;
|
|
69
|
+
workspacePath?: string;
|
|
70
|
+
}): Promise<P4RunResult>;
|
|
71
|
+
/**
|
|
72
|
+
* p4 diff - Show differences
|
|
73
|
+
*/
|
|
74
|
+
export declare function p4Diff(context: ToolContext, args?: {
|
|
75
|
+
files?: string[];
|
|
76
|
+
summary?: boolean;
|
|
77
|
+
workspacePath?: string;
|
|
78
|
+
}): Promise<P4RunResult>;
|
|
79
|
+
//# sourceMappingURL=basic.d.ts.map
|