@qase/mcp-server 1.0.0-beta.1
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/CHANGELOG.md +165 -0
- package/README.md +450 -0
- package/build/client/index.d.ts +23 -0
- package/build/client/index.d.ts.map +1 -0
- package/build/client/index.js +55 -0
- package/build/client/index.js.map +1 -0
- package/build/index.d.ts +32 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +125 -0
- package/build/index.js.map +1 -0
- package/build/operations/attachments.d.ts +8 -0
- package/build/operations/attachments.d.ts.map +1 -0
- package/build/operations/attachments.js +123 -0
- package/build/operations/attachments.js.map +1 -0
- package/build/operations/authors.d.ts +8 -0
- package/build/operations/authors.d.ts.map +1 -0
- package/build/operations/authors.js +68 -0
- package/build/operations/authors.js.map +1 -0
- package/build/operations/cases.d.ts +8 -0
- package/build/operations/cases.d.ts.map +1 -0
- package/build/operations/cases.js +278 -0
- package/build/operations/cases.js.map +1 -0
- package/build/operations/configurations.d.ts +8 -0
- package/build/operations/configurations.d.ts.map +1 -0
- package/build/operations/configurations.js +102 -0
- package/build/operations/configurations.js.map +1 -0
- package/build/operations/custom-fields.d.ts +8 -0
- package/build/operations/custom-fields.d.ts.map +1 -0
- package/build/operations/custom-fields.js +167 -0
- package/build/operations/custom-fields.js.map +1 -0
- package/build/operations/defects.d.ts +8 -0
- package/build/operations/defects.d.ts.map +1 -0
- package/build/operations/defects.js +219 -0
- package/build/operations/defects.js.map +1 -0
- package/build/operations/environments.d.ts +8 -0
- package/build/operations/environments.d.ts.map +1 -0
- package/build/operations/environments.js +149 -0
- package/build/operations/environments.js.map +1 -0
- package/build/operations/milestones.d.ts +8 -0
- package/build/operations/milestones.d.ts.map +1 -0
- package/build/operations/milestones.js +150 -0
- package/build/operations/milestones.js.map +1 -0
- package/build/operations/plans.d.ts +8 -0
- package/build/operations/plans.d.ts.map +1 -0
- package/build/operations/plans.js +153 -0
- package/build/operations/plans.js.map +1 -0
- package/build/operations/projects.d.ts +8 -0
- package/build/operations/projects.d.ts.map +1 -0
- package/build/operations/projects.js +186 -0
- package/build/operations/projects.js.map +1 -0
- package/build/operations/results.d.ts +8 -0
- package/build/operations/results.d.ts.map +1 -0
- package/build/operations/results.js +208 -0
- package/build/operations/results.js.map +1 -0
- package/build/operations/runs.d.ts +8 -0
- package/build/operations/runs.d.ts.map +1 -0
- package/build/operations/runs.js +211 -0
- package/build/operations/runs.js.map +1 -0
- package/build/operations/search.d.ts +8 -0
- package/build/operations/search.d.ts.map +1 -0
- package/build/operations/search.js +138 -0
- package/build/operations/search.js.map +1 -0
- package/build/operations/shared-parameters.d.ts +8 -0
- package/build/operations/shared-parameters.d.ts.map +1 -0
- package/build/operations/shared-parameters.js +139 -0
- package/build/operations/shared-parameters.js.map +1 -0
- package/build/operations/shared-steps.d.ts +8 -0
- package/build/operations/shared-steps.d.ts.map +1 -0
- package/build/operations/shared-steps.js +155 -0
- package/build/operations/shared-steps.js.map +1 -0
- package/build/operations/suites.d.ts +8 -0
- package/build/operations/suites.d.ts.map +1 -0
- package/build/operations/suites.js +164 -0
- package/build/operations/suites.js.map +1 -0
- package/build/operations/system-fields.d.ts +8 -0
- package/build/operations/system-fields.d.ts.map +1 -0
- package/build/operations/system-fields.js +40 -0
- package/build/operations/system-fields.js.map +1 -0
- package/build/operations/users.d.ts +8 -0
- package/build/operations/users.d.ts.map +1 -0
- package/build/operations/users.js +68 -0
- package/build/operations/users.js.map +1 -0
- package/build/types/index.d.ts +49 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +13 -0
- package/build/types/index.js.map +1 -0
- package/build/utils/errors.d.ts +73 -0
- package/build/utils/errors.d.ts.map +1 -0
- package/build/utils/errors.js +136 -0
- package/build/utils/errors.js.map +1 -0
- package/build/utils/qql-helpers.d.ts +59 -0
- package/build/utils/qql-helpers.d.ts.map +1 -0
- package/build/utils/qql-helpers.js +85 -0
- package/build/utils/qql-helpers.js.map +1 -0
- package/build/utils/registry.d.ts +97 -0
- package/build/utils/registry.d.ts.map +1 -0
- package/build/utils/registry.js +132 -0
- package/build/utils/registry.js.map +1 -0
- package/build/utils/test-helpers.d.ts +32 -0
- package/build/utils/test-helpers.d.ts.map +1 -0
- package/build/utils/test-helpers.js +81 -0
- package/build/utils/test-helpers.js.map +1 -0
- package/build/utils/validation.d.ts +107 -0
- package/build/utils/validation.d.ts.map +1 -0
- package/build/utils/validation.js +104 -0
- package/build/utils/validation.js.map +1 -0
- package/package.json +84 -0
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Qase MCP Server - Main Entry Point
|
|
4
|
+
*
|
|
5
|
+
* This MCP server provides comprehensive integration with the Qase Test Management Platform.
|
|
6
|
+
* It exposes 90+ tools for managing projects, test cases, runs, results, defects, and more.
|
|
7
|
+
*
|
|
8
|
+
* Architecture:
|
|
9
|
+
* - Uses stdio transport for communication with MCP clients
|
|
10
|
+
* - Tools are registered via the global tool registry
|
|
11
|
+
* - Operation modules self-register their tools on import
|
|
12
|
+
* - All API errors are handled gracefully with user-friendly messages
|
|
13
|
+
*/
|
|
14
|
+
import './operations/projects.js';
|
|
15
|
+
import './operations/cases.js';
|
|
16
|
+
import './operations/suites.js';
|
|
17
|
+
import './operations/runs.js';
|
|
18
|
+
import './operations/results.js';
|
|
19
|
+
import './operations/plans.js';
|
|
20
|
+
import './operations/shared-steps.js';
|
|
21
|
+
import './operations/shared-parameters.js';
|
|
22
|
+
import './operations/milestones.js';
|
|
23
|
+
import './operations/defects.js';
|
|
24
|
+
import './operations/environments.js';
|
|
25
|
+
import './operations/attachments.js';
|
|
26
|
+
import './operations/authors.js';
|
|
27
|
+
import './operations/custom-fields.js';
|
|
28
|
+
import './operations/system-fields.js';
|
|
29
|
+
import './operations/configurations.js';
|
|
30
|
+
import './operations/users.js';
|
|
31
|
+
import './operations/search.js';
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;GAWG;AASH,OAAO,0BAA0B,CAAC;AAClC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,wBAAwB,CAAC;AAChC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,yBAAyB,CAAC;AACjC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,8BAA8B,CAAC;AACtC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,4BAA4B,CAAC;AACpC,OAAO,yBAAyB,CAAC;AACjC,OAAO,8BAA8B,CAAC;AACtC,OAAO,6BAA6B,CAAC;AACrC,OAAO,yBAAyB,CAAC;AACjC,OAAO,+BAA+B,CAAC;AACvC,OAAO,+BAA+B,CAAC;AACvC,OAAO,gCAAgC,CAAC;AACxC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,wBAAwB,CAAC"}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Qase MCP Server - Main Entry Point
|
|
4
|
+
*
|
|
5
|
+
* This MCP server provides comprehensive integration with the Qase Test Management Platform.
|
|
6
|
+
* It exposes 90+ tools for managing projects, test cases, runs, results, defects, and more.
|
|
7
|
+
*
|
|
8
|
+
* Architecture:
|
|
9
|
+
* - Uses stdio transport for communication with MCP clients
|
|
10
|
+
* - Tools are registered via the global tool registry
|
|
11
|
+
* - Operation modules self-register their tools on import
|
|
12
|
+
* - All API errors are handled gracefully with user-friendly messages
|
|
13
|
+
*/
|
|
14
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
15
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
16
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
17
|
+
import { toolRegistry } from './utils/registry.js';
|
|
18
|
+
import { formatApiError } from './utils/errors.js';
|
|
19
|
+
// Import operation modules - each module registers its tools on import
|
|
20
|
+
import './operations/projects.js';
|
|
21
|
+
import './operations/cases.js';
|
|
22
|
+
import './operations/suites.js';
|
|
23
|
+
import './operations/runs.js';
|
|
24
|
+
import './operations/results.js';
|
|
25
|
+
import './operations/plans.js';
|
|
26
|
+
import './operations/shared-steps.js';
|
|
27
|
+
import './operations/shared-parameters.js';
|
|
28
|
+
import './operations/milestones.js';
|
|
29
|
+
import './operations/defects.js';
|
|
30
|
+
import './operations/environments.js';
|
|
31
|
+
import './operations/attachments.js';
|
|
32
|
+
import './operations/authors.js';
|
|
33
|
+
import './operations/custom-fields.js';
|
|
34
|
+
import './operations/system-fields.js';
|
|
35
|
+
import './operations/configurations.js';
|
|
36
|
+
import './operations/users.js';
|
|
37
|
+
import './operations/search.js';
|
|
38
|
+
/**
|
|
39
|
+
* Create the MCP server instance
|
|
40
|
+
*/
|
|
41
|
+
const server = new Server({
|
|
42
|
+
name: 'qase-mcp-server',
|
|
43
|
+
version: '1.0.0',
|
|
44
|
+
}, {
|
|
45
|
+
capabilities: {
|
|
46
|
+
tools: {},
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Handler: List all available tools
|
|
51
|
+
*
|
|
52
|
+
* Returns all tools registered in the tool registry.
|
|
53
|
+
* Called when the MCP client wants to discover available tools.
|
|
54
|
+
*/
|
|
55
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
56
|
+
const tools = toolRegistry.getTools();
|
|
57
|
+
console.error(`[Server] Listing ${tools.length} tools`);
|
|
58
|
+
return { tools };
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* Handler: Execute a tool
|
|
62
|
+
*
|
|
63
|
+
* Executes the specified tool with provided arguments.
|
|
64
|
+
* Arguments are validated against the tool's schema before execution.
|
|
65
|
+
*/
|
|
66
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
67
|
+
const { name, arguments: args } = request.params;
|
|
68
|
+
console.error(`[Server] Executing tool: ${name}`);
|
|
69
|
+
// Get tool handler from registry
|
|
70
|
+
const handler = toolRegistry.getHandler(name);
|
|
71
|
+
if (!handler) {
|
|
72
|
+
throw new Error(`Unknown tool: ${name}. Use list_tools to see available tools.`);
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
// Execute the tool handler with provided arguments
|
|
76
|
+
const result = await handler(args || {});
|
|
77
|
+
// Return result in MCP format
|
|
78
|
+
return {
|
|
79
|
+
content: [
|
|
80
|
+
{
|
|
81
|
+
type: 'text',
|
|
82
|
+
text: JSON.stringify(result, null, 2),
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
// Format error message using our error utilities
|
|
89
|
+
const errorMessage = formatApiError(error);
|
|
90
|
+
console.error(`[Server] Tool '${name}' failed:`, errorMessage);
|
|
91
|
+
throw new Error(`Tool '${name}' execution failed: ${errorMessage}`);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
/**
|
|
95
|
+
* Main function - Start the MCP server
|
|
96
|
+
*/
|
|
97
|
+
async function main() {
|
|
98
|
+
// Create stdio transport for communication
|
|
99
|
+
const transport = new StdioServerTransport();
|
|
100
|
+
// Connect server to transport
|
|
101
|
+
await server.connect(transport);
|
|
102
|
+
// Log server information to stderr (stdout is used for MCP protocol)
|
|
103
|
+
console.error('╔════════════════════════════════════════════════════════════════╗');
|
|
104
|
+
console.error('║ Qase MCP Server v1.0.0 ║');
|
|
105
|
+
console.error('╚════════════════════════════════════════════════════════════════╝');
|
|
106
|
+
console.error('');
|
|
107
|
+
console.error(`✓ Server started successfully`);
|
|
108
|
+
console.error(`✓ Registered ${toolRegistry.getToolCount()} tools`);
|
|
109
|
+
console.error(`✓ Ready to receive requests`);
|
|
110
|
+
console.error('');
|
|
111
|
+
console.error('Note: This server uses stdio transport for communication.');
|
|
112
|
+
console.error(' It is designed to be run by MCP clients (Claude, Cursor, etc.)');
|
|
113
|
+
console.error('');
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Run the server and handle errors
|
|
117
|
+
*/
|
|
118
|
+
main().catch((error) => {
|
|
119
|
+
console.error('═══════════════════════════════════════════════════════════════');
|
|
120
|
+
console.error('FATAL ERROR: Server failed to start');
|
|
121
|
+
console.error('═══════════════════════════════════════════════════════════════');
|
|
122
|
+
console.error(error);
|
|
123
|
+
process.exit(1);
|
|
124
|
+
});
|
|
125
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,uEAAuE;AACvE,OAAO,0BAA0B,CAAC;AAClC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,wBAAwB,CAAC;AAChC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,yBAAyB,CAAC;AACjC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,8BAA8B,CAAC;AACtC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,4BAA4B,CAAC;AACpC,OAAO,yBAAyB,CAAC;AACjC,OAAO,8BAA8B,CAAC;AACtC,OAAO,6BAA6B,CAAC;AACrC,OAAO,yBAAyB,CAAC;AACjC,OAAO,+BAA+B,CAAC;AACvC,OAAO,+BAA+B,CAAC;AACvC,OAAO,gCAAgC,CAAC;AACxC,OAAO,uBAAuB,CAAC;AAC/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CAAC,iEAAiE,CAAC,CAAC;IACjF,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../src/operations/attachments.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attachments Operations
|
|
3
|
+
*
|
|
4
|
+
* Implements all MCP tools for managing attachments in Qase.
|
|
5
|
+
* Attachments are files associated with test cases, steps, and results.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { getApiClient } from '../client/index.js';
|
|
9
|
+
import { toolRegistry } from '../utils/registry.js';
|
|
10
|
+
import { toResultAsync } from '../utils/errors.js';
|
|
11
|
+
import { ProjectCodeSchema, HashSchema } from '../utils/validation.js';
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// SCHEMAS
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Schema for listing attachments
|
|
17
|
+
*/
|
|
18
|
+
const ListAttachmentsSchema = z.object({
|
|
19
|
+
limit: z.number().int().positive().max(100).optional().describe('Maximum number of items'),
|
|
20
|
+
offset: z.number().int().nonnegative().optional().describe('Number of items to skip'),
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Schema for getting a specific attachment
|
|
24
|
+
*/
|
|
25
|
+
const GetAttachmentSchema = z.object({
|
|
26
|
+
hash: HashSchema.describe('Attachment hash identifier'),
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Schema for uploading an attachment
|
|
30
|
+
*/
|
|
31
|
+
const UploadAttachmentSchema = z.object({
|
|
32
|
+
code: ProjectCodeSchema.optional().describe('Project code (optional, for project-specific attachments)'),
|
|
33
|
+
file: z.string().describe('File content as base64 encoded string or file path'),
|
|
34
|
+
filename: z.string().describe('Original filename with extension'),
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* Schema for deleting an attachment
|
|
38
|
+
*/
|
|
39
|
+
const DeleteAttachmentSchema = z.object({
|
|
40
|
+
hash: HashSchema.describe('Attachment hash identifier'),
|
|
41
|
+
});
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// HANDLERS
|
|
44
|
+
// ============================================================================
|
|
45
|
+
/**
|
|
46
|
+
* List all attachments
|
|
47
|
+
*/
|
|
48
|
+
async function listAttachments(args) {
|
|
49
|
+
const client = getApiClient();
|
|
50
|
+
const { limit, offset } = args;
|
|
51
|
+
const result = await toResultAsync(client.attachments.getAttachments(limit, offset));
|
|
52
|
+
return result.match((response) => response.data.result, (error) => {
|
|
53
|
+
throw new Error(error);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get a specific attachment by hash
|
|
58
|
+
*/
|
|
59
|
+
async function getAttachment(args) {
|
|
60
|
+
const client = getApiClient();
|
|
61
|
+
const { hash } = args;
|
|
62
|
+
const result = await toResultAsync(client.attachments.getAttachment(hash));
|
|
63
|
+
return result.match((response) => response.data.result, (error) => {
|
|
64
|
+
throw new Error(error);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Upload a new attachment
|
|
69
|
+
*/
|
|
70
|
+
async function uploadAttachment(args) {
|
|
71
|
+
const client = getApiClient();
|
|
72
|
+
const { code, file, filename } = args;
|
|
73
|
+
// Create upload data with file content
|
|
74
|
+
const uploadData = {
|
|
75
|
+
file,
|
|
76
|
+
filename,
|
|
77
|
+
};
|
|
78
|
+
const result = await toResultAsync(code
|
|
79
|
+
? client.attachments.uploadAttachment(code, uploadData)
|
|
80
|
+
: client.attachments.uploadAttachment(uploadData));
|
|
81
|
+
return result.match((response) => response.data.result, (error) => {
|
|
82
|
+
throw new Error(error);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Delete an attachment
|
|
87
|
+
*/
|
|
88
|
+
async function deleteAttachment(args) {
|
|
89
|
+
const client = getApiClient();
|
|
90
|
+
const { hash } = args;
|
|
91
|
+
const result = await toResultAsync(client.attachments.deleteAttachment(hash));
|
|
92
|
+
return result.match((_response) => ({ success: true, hash }), (error) => {
|
|
93
|
+
throw new Error(error);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
// ============================================================================
|
|
97
|
+
// TOOL REGISTRATION
|
|
98
|
+
// ============================================================================
|
|
99
|
+
toolRegistry.register({
|
|
100
|
+
name: 'list_attachments',
|
|
101
|
+
description: 'Get all attachments with optional pagination',
|
|
102
|
+
schema: ListAttachmentsSchema,
|
|
103
|
+
handler: listAttachments,
|
|
104
|
+
});
|
|
105
|
+
toolRegistry.register({
|
|
106
|
+
name: 'get_attachment',
|
|
107
|
+
description: 'Get a specific attachment by hash, including download URL',
|
|
108
|
+
schema: GetAttachmentSchema,
|
|
109
|
+
handler: getAttachment,
|
|
110
|
+
});
|
|
111
|
+
toolRegistry.register({
|
|
112
|
+
name: 'upload_attachment',
|
|
113
|
+
description: 'Upload a new attachment (provide file as base64 encoded string)',
|
|
114
|
+
schema: UploadAttachmentSchema,
|
|
115
|
+
handler: uploadAttachment,
|
|
116
|
+
});
|
|
117
|
+
toolRegistry.register({
|
|
118
|
+
name: 'delete_attachment',
|
|
119
|
+
description: 'Delete an attachment by hash',
|
|
120
|
+
schema: DeleteAttachmentSchema,
|
|
121
|
+
handler: deleteAttachment,
|
|
122
|
+
});
|
|
123
|
+
//# sourceMappingURL=attachments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachments.js","sourceRoot":"","sources":["../../src/operations/attachments.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EA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B;IACzB,WAAW,EAAE,iEAAiE;IAC9E,MAAM,EAAE,sBAAsB;IAC9B,OAAO,EAAE,gBAAgB;CAC1B,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,8BAA8B;IAC3C,MAAM,EAAE,sBAAsB;IAC9B,OAAO,EAAE,gBAAgB;CAC1B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authors.d.ts","sourceRoot":"","sources":["../../src/operations/authors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authors Operations
|
|
3
|
+
*
|
|
4
|
+
* Implements all MCP tools for managing test case authors in Qase.
|
|
5
|
+
* Authors are users who have created test cases.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { getApiClient } from '../client/index.js';
|
|
9
|
+
import { toolRegistry } from '../utils/registry.js';
|
|
10
|
+
import { toResultAsync } from '../utils/errors.js';
|
|
11
|
+
import { IdSchema } from '../utils/validation.js';
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// SCHEMAS
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Schema for listing authors
|
|
17
|
+
*/
|
|
18
|
+
const ListAuthorsSchema = z.object({
|
|
19
|
+
limit: z.number().int().positive().max(100).optional().describe('Maximum number of items'),
|
|
20
|
+
offset: z.number().int().nonnegative().optional().describe('Number of items to skip'),
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Schema for getting a specific author
|
|
24
|
+
*/
|
|
25
|
+
const GetAuthorSchema = z.object({
|
|
26
|
+
id: IdSchema,
|
|
27
|
+
});
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// HANDLERS
|
|
30
|
+
// ============================================================================
|
|
31
|
+
/**
|
|
32
|
+
* List all authors
|
|
33
|
+
*/
|
|
34
|
+
async function listAuthors(args) {
|
|
35
|
+
const client = getApiClient();
|
|
36
|
+
const { limit, offset } = args;
|
|
37
|
+
const result = await toResultAsync(client.authors.getAuthors(limit, offset));
|
|
38
|
+
return result.match((response) => response.data.result, (error) => {
|
|
39
|
+
throw new Error(error);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get a specific author
|
|
44
|
+
*/
|
|
45
|
+
async function getAuthor(args) {
|
|
46
|
+
const client = getApiClient();
|
|
47
|
+
const { id } = args;
|
|
48
|
+
const result = await toResultAsync(client.authors.getAuthor(id));
|
|
49
|
+
return result.match((response) => response.data.result, (error) => {
|
|
50
|
+
throw new Error(error);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// ============================================================================
|
|
54
|
+
// TOOL REGISTRATION
|
|
55
|
+
// ============================================================================
|
|
56
|
+
toolRegistry.register({
|
|
57
|
+
name: 'list_authors',
|
|
58
|
+
description: 'Get all test case authors with optional pagination',
|
|
59
|
+
schema: ListAuthorsSchema,
|
|
60
|
+
handler: listAuthors,
|
|
61
|
+
});
|
|
62
|
+
toolRegistry.register({
|
|
63
|
+
name: 'get_author',
|
|
64
|
+
description: 'Get a specific author by ID',
|
|
65
|
+
schema: GetAuthorSchema,
|
|
66
|
+
handler: getAuthor,
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=authors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authors.js","sourceRoot":"","sources":["../../src/operations/authors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC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