targetprocess-mcp-server 2.2.3-a → 2.2.3
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/build/index.js +58 -2
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import { z } from "zod";
|
|
|
4
4
|
import { JSDOM } from "jsdom";
|
|
5
5
|
import { TpClient } from "./tp.js";
|
|
6
6
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
|
-
import { config } from "./config.js";
|
|
8
7
|
const server = new McpServer({
|
|
9
8
|
name: "tp",
|
|
10
9
|
version: "1.0.0"
|
|
@@ -375,7 +374,6 @@ server.registerTool('search_tp_cards', {
|
|
|
375
374
|
title: item.Name,
|
|
376
375
|
id: item.Id,
|
|
377
376
|
description: descriptionText,
|
|
378
|
-
url: `${config.tp.url}/entity/${item.Id}`,
|
|
379
377
|
};
|
|
380
378
|
});
|
|
381
379
|
return {
|
|
@@ -1240,6 +1238,64 @@ server.registerTool('add_test_cases_to_test_plan', {
|
|
|
1240
1238
|
}]
|
|
1241
1239
|
};
|
|
1242
1240
|
});
|
|
1241
|
+
server.registerTool('add_attached_file_to_card', {
|
|
1242
|
+
title: 'Attach a file to a TP card',
|
|
1243
|
+
description: `Upload and attach a file to a Targetprocess entity (UserStory, Bug, Feature, etc.) by its ID.
|
|
1244
|
+
1) fileContent + fileName — provide base64-encoded file content and a filename (use this when the file was uploaded directly into the chat)
|
|
1245
|
+
WORKFLOW for chat-uploaded files: run \`base64 <path>\` via Bash to get the encoded content, then call this tool with fileContent + fileName.`,
|
|
1246
|
+
inputSchema: {
|
|
1247
|
+
generalId: z.string()
|
|
1248
|
+
.min(5)
|
|
1249
|
+
.max(6)
|
|
1250
|
+
.describe('TP entity ID to attach the file to (e.g. 145789)'),
|
|
1251
|
+
filePath: z.string()
|
|
1252
|
+
.optional()
|
|
1253
|
+
.describe('Absolute path to a local file (mode 1). Mutually exclusive with fileContent/fileName.'),
|
|
1254
|
+
fileContent: z.string()
|
|
1255
|
+
.optional()
|
|
1256
|
+
.describe('Base64-encoded file content (mode 2). Must be paired with fileName.'),
|
|
1257
|
+
fileName: z.string()
|
|
1258
|
+
.optional()
|
|
1259
|
+
.describe('Filename including extension, required when using fileContent (e.g. screenshot.png).'),
|
|
1260
|
+
},
|
|
1261
|
+
}, async ({ generalId, filePath, fileContent, fileName }) => {
|
|
1262
|
+
try {
|
|
1263
|
+
if (!filePath && (!fileContent || !fileName)) {
|
|
1264
|
+
return {
|
|
1265
|
+
content: [{
|
|
1266
|
+
type: 'text',
|
|
1267
|
+
text: 'Provide either filePath, or both fileContent and fileName.'
|
|
1268
|
+
}]
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
const source = filePath
|
|
1272
|
+
? { filePath }
|
|
1273
|
+
: { fileContent: fileContent, fileName: fileName };
|
|
1274
|
+
const result = await tp.addAttachedFile(generalId, source);
|
|
1275
|
+
if (!result) {
|
|
1276
|
+
return {
|
|
1277
|
+
content: [{
|
|
1278
|
+
type: 'text',
|
|
1279
|
+
text: `Failed to attach file to card id: ${generalId}`
|
|
1280
|
+
}]
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
return {
|
|
1284
|
+
content: [{
|
|
1285
|
+
type: 'text',
|
|
1286
|
+
text: result
|
|
1287
|
+
}]
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1290
|
+
catch (error) {
|
|
1291
|
+
return {
|
|
1292
|
+
content: [{
|
|
1293
|
+
type: 'text',
|
|
1294
|
+
text: `Error attaching file to card ${generalId}: ${error}`
|
|
1295
|
+
}]
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
});
|
|
1243
1299
|
async function main() {
|
|
1244
1300
|
const transport = new StdioServerTransport();
|
|
1245
1301
|
await server.connect(transport);
|