@postman/postman-mcp-server 2.2.1 → 2.3.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/dist/package.json +18 -18
- package/dist/src/clients/postman.js +25 -15
- package/dist/src/index.js +38 -50
- package/dist/src/tools/createCollection.js +13 -17
- package/dist/src/tools/createCollectionComment.js +9 -9
- package/dist/src/tools/createCollectionFolder.js +7 -7
- package/dist/src/tools/createCollectionFork.js +7 -7
- package/dist/src/tools/createCollectionRequest.js +7 -7
- package/dist/src/tools/createCollectionResponse.js +7 -7
- package/dist/src/tools/createEnvironment.js +6 -6
- package/dist/src/tools/createFolderComment.js +9 -9
- package/dist/src/tools/createMock.js +8 -8
- package/dist/src/tools/createMonitor.js +6 -6
- package/dist/src/tools/createRequestComment.js +9 -9
- package/dist/src/tools/createResponseComment.js +9 -9
- package/dist/src/tools/createSpec.js +10 -10
- package/dist/src/tools/createSpecFile.js +7 -7
- package/dist/src/tools/createWorkspace.js +4 -4
- package/dist/src/tools/deleteApiCollectionComment.js +3 -3
- package/dist/src/tools/deleteCollection.js +3 -3
- package/dist/src/tools/deleteCollectionComment.js +3 -3
- package/dist/src/tools/deleteCollectionFolder.js +3 -3
- package/dist/src/tools/deleteCollectionRequest.js +3 -3
- package/dist/src/tools/deleteCollectionResponse.js +3 -3
- package/dist/src/tools/deleteEnvironment.js +3 -3
- package/dist/src/tools/deleteFolderComment.js +3 -3
- package/dist/src/tools/deleteMock.js +5 -5
- package/dist/src/tools/deleteMonitor.js +3 -3
- package/dist/src/tools/deletePanElementOrFolder.js +3 -3
- package/dist/src/tools/deleteRequestComment.js +3 -3
- package/dist/src/tools/deleteResponseComment.js +3 -3
- package/dist/src/tools/deleteSpec.js +3 -3
- package/dist/src/tools/deleteSpecFile.js +3 -3
- package/dist/src/tools/deleteWorkspace.js +3 -3
- package/dist/src/tools/duplicateCollection.js +7 -7
- package/dist/src/tools/generateCollection.js +11 -11
- package/dist/src/tools/generateSpecFromCollection.js +9 -9
- package/dist/src/tools/getAllElementsAndFolders.js +28 -28
- package/dist/src/tools/getAllPanAddElementRequests.js +22 -22
- package/dist/src/tools/getAllSpecs.js +8 -8
- package/dist/src/tools/getAsyncSpecTaskStatus.js +3 -3
- package/dist/src/tools/getAuthenticatedUser.js +4 -4
- package/dist/src/tools/getCollection.js +7 -7
- package/dist/src/tools/getCollectionComments.js +3 -3
- package/dist/src/tools/getCollectionFolder.js +9 -9
- package/dist/src/tools/getCollectionForks.js +9 -9
- package/dist/src/tools/getCollectionRequest.js +9 -9
- package/dist/src/tools/getCollectionResponse.js +9 -9
- package/dist/src/tools/getCollectionTags.js +3 -3
- package/dist/src/tools/getCollectionUpdatesTasks.js +3 -3
- package/dist/src/tools/getCollections.js +10 -10
- package/dist/src/tools/getCollectionsForkedByUser.js +8 -8
- package/dist/src/tools/getDuplicateCollectionTaskStatus.js +3 -3
- package/dist/src/tools/getEnvironment.js +3 -3
- package/dist/src/tools/getEnvironments.js +4 -4
- package/dist/src/tools/getFolderComments.js +3 -3
- package/dist/src/tools/getGeneratedCollectionSpecs.js +3 -3
- package/dist/src/tools/getMock.js +5 -5
- package/dist/src/tools/getMocks.js +16 -10
- package/dist/src/tools/getMonitor.js +3 -3
- package/dist/src/tools/getMonitors.js +16 -16
- package/dist/src/tools/getRequestComments.js +3 -3
- package/dist/src/tools/getResponseComments.js +3 -3
- package/dist/src/tools/getSourceCollectionStatus.js +3 -3
- package/dist/src/tools/getSpec.js +3 -3
- package/dist/src/tools/getSpecCollections.js +7 -7
- package/dist/src/tools/getSpecDefinition.js +3 -3
- package/dist/src/tools/getSpecFile.js +3 -3
- package/dist/src/tools/getSpecFiles.js +3 -3
- package/dist/src/tools/getStatusOfAnAsyncApiTask.js +3 -3
- package/dist/src/tools/getTaggedEntities.js +11 -11
- package/dist/src/tools/getWorkspace.js +5 -5
- package/dist/src/tools/getWorkspaceGlobalVariables.js +3 -3
- package/dist/src/tools/getWorkspaceTags.js +3 -3
- package/dist/src/tools/getWorkspaces.js +12 -12
- package/dist/src/tools/mergeCollectionFork.js +8 -8
- package/dist/src/tools/patchCollection.js +5 -5
- package/dist/src/tools/patchEnvironment.js +50 -4
- package/dist/src/tools/postPanElementOrFolder.js +51 -3
- package/dist/src/tools/publishDocumentation.js +11 -11
- package/dist/src/tools/publishMock.js +3 -3
- package/dist/src/tools/pullCollectionChanges.js +3 -3
- package/dist/src/tools/putCollection.js +13 -17
- package/dist/src/tools/putEnvironment.js +5 -5
- package/dist/src/tools/resolveCommentThread.js +3 -3
- package/dist/src/tools/runMonitor.js +5 -5
- package/dist/src/tools/syncCollectionWithSpec.js +5 -5
- package/dist/src/tools/syncSpecWithCollection.js +5 -5
- package/dist/src/tools/transferCollectionFolders.js +10 -10
- package/dist/src/tools/transferCollectionRequests.js +10 -10
- package/dist/src/tools/transferCollectionResponses.js +10 -10
- package/dist/src/tools/unpublishDocumentation.js +3 -3
- package/dist/src/tools/unpublishMock.js +3 -3
- package/dist/src/tools/updateApiCollectionComment.js +7 -7
- package/dist/src/tools/updateCollectionComment.js +7 -7
- package/dist/src/tools/updateCollectionFolder.js +7 -7
- package/dist/src/tools/updateCollectionRequest.js +7 -7
- package/dist/src/tools/updateCollectionResponse.js +7 -7
- package/dist/src/tools/updateCollectionTags.js +5 -5
- package/dist/src/tools/updateFolderComment.js +7 -7
- package/dist/src/tools/updateMock.js +7 -7
- package/dist/src/tools/updateMonitor.js +5 -5
- package/dist/src/tools/updatePanElementOrFolder.js +62 -3
- package/dist/src/tools/updateRequestComment.js +7 -7
- package/dist/src/tools/updateResponseComment.js +7 -7
- package/dist/src/tools/updateSpecFile.js +9 -9
- package/dist/src/tools/updateSpecProperties.js +5 -5
- package/dist/src/tools/updateWorkspace.js +5 -5
- package/dist/src/tools/updateWorkspaceGlobalVariables.js +5 -5
- package/dist/src/tools/updateWorkspaceTags.js +5 -5
- package/package.json +18 -18
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postman/postman-mcp-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "A simple MCP server to operate on the Postman API",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,28 +22,28 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@apidevtools/swagger-parser": "^
|
|
26
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
27
|
-
"dotenv": "^
|
|
28
|
-
"es-toolkit": "^1.
|
|
25
|
+
"@apidevtools/swagger-parser": "^12.0.0",
|
|
26
|
+
"@modelcontextprotocol/sdk": "^1.18.1",
|
|
27
|
+
"dotenv": "^17.2.2",
|
|
28
|
+
"es-toolkit": "^1.39.10",
|
|
29
29
|
"express": "^5.1.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@eslint/js": "^9.
|
|
33
|
-
"@types/express": "^5.0.
|
|
34
|
-
"@types/node": "^
|
|
35
|
-
"eslint": "^9.
|
|
36
|
-
"eslint-config-prettier": "^10.1.
|
|
37
|
-
"eslint-plugin-prettier": "^5.4
|
|
38
|
-
"eslint-plugin-unused-imports": "^4.
|
|
39
|
-
"fs-extra": "^11.3.
|
|
40
|
-
"jest": "^
|
|
32
|
+
"@eslint/js": "^9.35.0",
|
|
33
|
+
"@types/express": "^5.0.3",
|
|
34
|
+
"@types/node": "^24",
|
|
35
|
+
"eslint": "^9.35.0",
|
|
36
|
+
"eslint-config-prettier": "^10.1.8",
|
|
37
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
38
|
+
"eslint-plugin-unused-imports": "^4.2.0",
|
|
39
|
+
"fs-extra": "^11.3.2",
|
|
40
|
+
"jest": "^30.1.3",
|
|
41
41
|
"json-schema-to-zod": "^2.6.1",
|
|
42
42
|
"openapi-types": "^12.1.3",
|
|
43
|
-
"prettier": "^3.
|
|
44
|
-
"tsx": "^4.
|
|
45
|
-
"typescript": "^5.
|
|
46
|
-
"typescript-eslint": "^8.
|
|
43
|
+
"prettier": "^3.6.2",
|
|
44
|
+
"tsx": "^4.20.5",
|
|
45
|
+
"typescript": "^5.9.2",
|
|
46
|
+
"typescript-eslint": "^8.44.0",
|
|
47
47
|
"vitest": "^3.2.4"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
@@ -10,19 +10,12 @@ export class PostmanAPIClient {
|
|
|
10
10
|
apiKey;
|
|
11
11
|
static instance = null;
|
|
12
12
|
constructor(apiKey, baseUrl = process.env.POSTMAN_API_BASE_URL || 'https://api.postman.com') {
|
|
13
|
-
|
|
14
|
-
throw new Error('API key is required. Provide it as parameter or set POSTMAN_API_KEY environment variable.');
|
|
15
|
-
}
|
|
16
|
-
this.apiKey = apiKey || process.env.POSTMAN_API_KEY;
|
|
13
|
+
this.apiKey = apiKey;
|
|
17
14
|
this.baseUrl = baseUrl;
|
|
18
15
|
}
|
|
19
16
|
static getInstance(apiKey, baseUrl) {
|
|
20
17
|
if (!PostmanAPIClient.instance) {
|
|
21
|
-
|
|
22
|
-
if (!key) {
|
|
23
|
-
throw new Error('API key is required. Provide it as parameter or set POSTMAN_API_KEY environment variable.');
|
|
24
|
-
}
|
|
25
|
-
PostmanAPIClient.instance = new PostmanAPIClient(key, baseUrl);
|
|
18
|
+
PostmanAPIClient.instance = new PostmanAPIClient(apiKey, baseUrl);
|
|
26
19
|
}
|
|
27
20
|
return PostmanAPIClient.instance;
|
|
28
21
|
}
|
|
@@ -45,20 +38,37 @@ export class PostmanAPIClient {
|
|
|
45
38
|
return this.request(endpoint, { ...options, method: 'DELETE' });
|
|
46
39
|
}
|
|
47
40
|
async request(endpoint, options) {
|
|
41
|
+
const currentApiKey = this.apiKey || process.env.POSTMAN_API_KEY;
|
|
42
|
+
if (!currentApiKey) {
|
|
43
|
+
throw new Error('API key is required for requests. Provide it via constructor parameter or set POSTMAN_API_KEY environment variable.');
|
|
44
|
+
}
|
|
48
45
|
const contentType = options.contentType || ContentType.Json;
|
|
49
|
-
const
|
|
50
|
-
|
|
46
|
+
const userAgentKey = Object.keys(options.headers ?? {}).find((key) => key.toLowerCase() === 'user-agent');
|
|
47
|
+
const userAgentValue = userAgentKey ? options.headers?.[userAgentKey] : undefined;
|
|
48
|
+
const userAgentHeader = userAgentValue
|
|
49
|
+
? `${userAgentValue}/${packageJson.name}/${packageJson.version}`
|
|
51
50
|
: `${packageJson.name}/${packageJson.version}`;
|
|
51
|
+
const disallowed = new Set([
|
|
52
|
+
'content-length',
|
|
53
|
+
'transfer-encoding',
|
|
54
|
+
'connection',
|
|
55
|
+
'host',
|
|
56
|
+
'accept-encoding',
|
|
57
|
+
'keep-alive',
|
|
58
|
+
]);
|
|
59
|
+
const extra = Object.fromEntries(Object.entries(options.headers ?? {}).filter(([k]) => !disallowed.has(k.toLowerCase())));
|
|
60
|
+
const hasBody = options.body !== undefined && options.body !== null;
|
|
52
61
|
const headers = {
|
|
53
|
-
'content-type': contentType,
|
|
54
|
-
|
|
62
|
+
...(hasBody ? { 'content-type': contentType } : {}),
|
|
63
|
+
...extra,
|
|
64
|
+
'x-api-key': currentApiKey,
|
|
55
65
|
'user-agent': userAgentHeader,
|
|
56
|
-
...options.headers,
|
|
57
66
|
};
|
|
58
|
-
const { headers:
|
|
67
|
+
const { headers: _ignored, ...optionsWithoutHeaders } = options;
|
|
59
68
|
const response = await fetch(`${this.baseUrl}${endpoint}`, {
|
|
60
69
|
...optionsWithoutHeaders,
|
|
61
70
|
headers,
|
|
71
|
+
signal: AbortSignal.timeout(300000),
|
|
62
72
|
});
|
|
63
73
|
if (!response.ok) {
|
|
64
74
|
await this.handleErrorResponse(response);
|
package/dist/src/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import dotenv from 'dotenv';
|
|
3
|
-
import {
|
|
3
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
4
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
5
|
-
import {
|
|
6
|
-
import zodToJsonSchema from 'zod-to-json-schema';
|
|
5
|
+
import { ErrorCode, isInitializeRequest, McpError, } from '@modelcontextprotocol/sdk/types.js';
|
|
7
6
|
import packageJson from '../package.json' with { type: 'json' };
|
|
8
7
|
import { readdir } from 'node:fs/promises';
|
|
9
8
|
import { join, dirname } from 'node:path';
|
|
@@ -108,7 +107,11 @@ async function run() {
|
|
|
108
107
|
process.exit(1);
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
|
-
const
|
|
110
|
+
const apiKey = process.env.POSTMAN_API_KEY;
|
|
111
|
+
if (!apiKey) {
|
|
112
|
+
log('error', 'POSTMAN_API_KEY environment variable is required for STDIO mode');
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
112
115
|
const allGeneratedTools = await loadAllTools();
|
|
113
116
|
log('info', 'Server initialization starting', {
|
|
114
117
|
serverName: SERVER_NAME,
|
|
@@ -118,7 +121,7 @@ async function run() {
|
|
|
118
121
|
const fullTools = allGeneratedTools.filter((t) => enabledResources.full.includes(t.method));
|
|
119
122
|
const minimalTools = allGeneratedTools.filter((t) => enabledResources.minimal.includes(t.method));
|
|
120
123
|
const tools = useFull ? fullTools : minimalTools;
|
|
121
|
-
const server = new
|
|
124
|
+
const server = new McpServer({ name: SERVER_NAME, version: APP_VERSION });
|
|
122
125
|
server.onerror = (error) => {
|
|
123
126
|
const msg = String(error?.message || error);
|
|
124
127
|
logBoth(server, 'error', `MCP server error: ${msg}`, { error: msg });
|
|
@@ -128,52 +131,37 @@ async function run() {
|
|
|
128
131
|
await server.close();
|
|
129
132
|
process.exit(0);
|
|
130
133
|
});
|
|
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
|
-
if (error instanceof McpError)
|
|
161
|
-
throw error;
|
|
162
|
-
throw new McpError(ErrorCode.InternalError, `API error: ${error.message}`);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
166
|
-
log('debug', `Tools list requested; ${tools.length} tools available`, {
|
|
167
|
-
toolCount: tools.length,
|
|
134
|
+
const client = new PostmanAPIClient(apiKey);
|
|
135
|
+
log('info', 'Registering tools with McpServer');
|
|
136
|
+
for (const tool of tools) {
|
|
137
|
+
server.tool(tool.method, tool.description, tool.parameters.shape, tool.annotations || {}, async (args, extra) => {
|
|
138
|
+
const toolName = tool.method;
|
|
139
|
+
log('info', `Tool invocation started: ${toolName}`, { toolName });
|
|
140
|
+
try {
|
|
141
|
+
const start = Date.now();
|
|
142
|
+
const result = await tool.handler(args, {
|
|
143
|
+
client,
|
|
144
|
+
headers: {
|
|
145
|
+
...extra?.requestInfo?.headers,
|
|
146
|
+
'user-agent': clientInfo?.name,
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
const durationMs = Date.now() - start;
|
|
150
|
+
log('info', `Tool invocation completed: ${toolName} (${durationMs}ms)`, {
|
|
151
|
+
toolName,
|
|
152
|
+
durationMs,
|
|
153
|
+
});
|
|
154
|
+
return result;
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
const errMsg = String(error?.message || error);
|
|
158
|
+
logBoth(server, 'error', `Tool invocation failed: ${toolName}: ${errMsg}`, { toolName });
|
|
159
|
+
if (error instanceof McpError)
|
|
160
|
+
throw error;
|
|
161
|
+
throw new McpError(ErrorCode.InternalError, `API error: ${error.message}`);
|
|
162
|
+
}
|
|
168
163
|
});
|
|
169
|
-
|
|
170
|
-
name: tool.method,
|
|
171
|
-
description: tool.description,
|
|
172
|
-
inputSchema: zodToJsonSchema(tool.parameters),
|
|
173
|
-
annotations: tool.annotations,
|
|
174
|
-
}));
|
|
175
|
-
return { tools: transformedTools };
|
|
176
|
-
});
|
|
164
|
+
}
|
|
177
165
|
log('info', 'Starting stdio transport');
|
|
178
166
|
const transport = new StdioServerTransport();
|
|
179
167
|
transport.onmessage = (message) => {
|
|
@@ -6,7 +6,7 @@ function asMcpError(error) {
|
|
|
6
6
|
return new McpError(ErrorCode.InternalError, cause);
|
|
7
7
|
}
|
|
8
8
|
export const method = 'createCollection';
|
|
9
|
-
export const description = 'Creates a collection using the [Postman Collection v2.1.0 schema format](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).\n\n**Note:**\n\
|
|
9
|
+
export const description = 'Creates a collection using the [Postman Collection v2.1.0 schema format](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).\n\n**Note:**\n\nIf you do not include the \\`workspace\\` query parameter, the system creates the collection in the oldest personal Internal workspace you own.\n';
|
|
10
10
|
export const parameters = z.object({
|
|
11
11
|
workspace: z.string().describe("The workspace's ID."),
|
|
12
12
|
collection: z
|
|
@@ -28,18 +28,18 @@ export const parameters = z.object({
|
|
|
28
28
|
.array(z
|
|
29
29
|
.object({
|
|
30
30
|
key: z.string().describe("The variable's key (name).").optional(),
|
|
31
|
-
value: z
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
.describe("The variable's type.")
|
|
31
|
+
value: z
|
|
32
|
+
.union([z.string(), z.boolean(), z.number().int()])
|
|
33
|
+
.describe("The key's value.")
|
|
35
34
|
.optional(),
|
|
36
35
|
description: z
|
|
37
36
|
.string()
|
|
38
|
-
.
|
|
37
|
+
.max(512)
|
|
38
|
+
.describe("The variable's description.")
|
|
39
39
|
.optional(),
|
|
40
40
|
disabled: z
|
|
41
41
|
.boolean()
|
|
42
|
-
.describe(
|
|
42
|
+
.describe("If true, the variable is not enabled. Doesn't apply to path parameter variables.")
|
|
43
43
|
.default(false),
|
|
44
44
|
})
|
|
45
45
|
.describe('Information about the variable.'))
|
|
@@ -514,18 +514,14 @@ export const parameters = z.object({
|
|
|
514
514
|
.array(z
|
|
515
515
|
.object({
|
|
516
516
|
key: z.string().describe("The variable's key (name).").optional(),
|
|
517
|
-
value: z
|
|
518
|
-
|
|
519
|
-
.
|
|
520
|
-
.describe("The variable's type.")
|
|
521
|
-
.optional(),
|
|
522
|
-
description: z
|
|
523
|
-
.string()
|
|
524
|
-
.describe("The variable's description. Doesn't apply to collection-level variables.")
|
|
517
|
+
value: z
|
|
518
|
+
.union([z.string(), z.boolean(), z.number().int()])
|
|
519
|
+
.describe("The key's value.")
|
|
525
520
|
.optional(),
|
|
521
|
+
description: z.string().max(512).describe("The variable's description.").optional(),
|
|
526
522
|
disabled: z
|
|
527
523
|
.boolean()
|
|
528
|
-
.describe(
|
|
524
|
+
.describe("If true, the variable is not enabled. Doesn't apply to path parameter variables.")
|
|
529
525
|
.default(false),
|
|
530
526
|
})
|
|
531
527
|
.describe('Information about the variable.'))
|
|
@@ -782,7 +778,7 @@ export const parameters = z.object({
|
|
|
782
778
|
.optional(),
|
|
783
779
|
});
|
|
784
780
|
export const annotations = {
|
|
785
|
-
title: 'Creates a collection using the [Postman Collection v2.1.0 schema format](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).\n\n**Note:**\n\
|
|
781
|
+
title: 'Creates a collection using the [Postman Collection v2.1.0 schema format](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).\n\n**Note:**\n\nIf you do not include the \\`workspace\\` query parameter, the system creates the collection in the oldest personal Internal workspace you own.\n',
|
|
786
782
|
readOnlyHint: false,
|
|
787
783
|
destructiveHint: false,
|
|
788
784
|
idempotentHint: false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ContentType } from '../clients/postman.js';
|
|
3
|
-
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { McpError, ErrorCode, } from '@modelcontextprotocol/sdk/types.js';
|
|
4
4
|
function asMcpError(error) {
|
|
5
5
|
const cause = error?.cause ?? String(error);
|
|
6
6
|
return new McpError(ErrorCode.InternalError, cause);
|
|
@@ -34,18 +34,18 @@ export const annotations = {
|
|
|
34
34
|
destructiveHint: false,
|
|
35
35
|
idempotentHint: false,
|
|
36
36
|
};
|
|
37
|
-
export async function handler(
|
|
37
|
+
export async function handler(args, extra) {
|
|
38
38
|
try {
|
|
39
|
-
const endpoint = `/collections/${
|
|
39
|
+
const endpoint = `/collections/${args.collectionId}/comments`;
|
|
40
40
|
const query = new URLSearchParams();
|
|
41
41
|
const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
|
|
42
42
|
const bodyPayload = {};
|
|
43
|
-
if (
|
|
44
|
-
bodyPayload.body =
|
|
45
|
-
if (
|
|
46
|
-
bodyPayload.threadId =
|
|
47
|
-
if (
|
|
48
|
-
bodyPayload.tags =
|
|
43
|
+
if (args.body !== undefined)
|
|
44
|
+
bodyPayload.body = args.body;
|
|
45
|
+
if (args.threadId !== undefined)
|
|
46
|
+
bodyPayload.threadId = args.threadId;
|
|
47
|
+
if (args.tags !== undefined)
|
|
48
|
+
bodyPayload.tags = args.tags;
|
|
49
49
|
const options = {
|
|
50
50
|
body: JSON.stringify(bodyPayload),
|
|
51
51
|
contentType: ContentType.Json,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ContentType } from '../clients/postman.js';
|
|
3
|
-
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { McpError, ErrorCode, } from '@modelcontextprotocol/sdk/types.js';
|
|
4
4
|
function asMcpError(error) {
|
|
5
5
|
const cause = error?.cause ?? String(error);
|
|
6
6
|
return new McpError(ErrorCode.InternalError, cause);
|
|
@@ -21,16 +21,16 @@ export const annotations = {
|
|
|
21
21
|
destructiveHint: false,
|
|
22
22
|
idempotentHint: false,
|
|
23
23
|
};
|
|
24
|
-
export async function handler(
|
|
24
|
+
export async function handler(args, extra) {
|
|
25
25
|
try {
|
|
26
|
-
const endpoint = `/collections/${
|
|
26
|
+
const endpoint = `/collections/${args.collectionId}/folders`;
|
|
27
27
|
const query = new URLSearchParams();
|
|
28
28
|
const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
|
|
29
29
|
const bodyPayload = {};
|
|
30
|
-
if (
|
|
31
|
-
bodyPayload.name =
|
|
32
|
-
if (
|
|
33
|
-
bodyPayload.folder =
|
|
30
|
+
if (args.name !== undefined)
|
|
31
|
+
bodyPayload.name = args.name;
|
|
32
|
+
if (args.folder !== undefined)
|
|
33
|
+
bodyPayload.folder = args.folder;
|
|
34
34
|
const options = {
|
|
35
35
|
body: JSON.stringify(bodyPayload),
|
|
36
36
|
contentType: ContentType.Json,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ContentType } from '../clients/postman.js';
|
|
3
|
-
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { McpError, ErrorCode, } from '@modelcontextprotocol/sdk/types.js';
|
|
4
4
|
function asMcpError(error) {
|
|
5
5
|
const cause = error?.cause ?? String(error);
|
|
6
6
|
return new McpError(ErrorCode.InternalError, cause);
|
|
@@ -18,16 +18,16 @@ export const annotations = {
|
|
|
18
18
|
destructiveHint: false,
|
|
19
19
|
idempotentHint: false,
|
|
20
20
|
};
|
|
21
|
-
export async function handler(
|
|
21
|
+
export async function handler(args, extra) {
|
|
22
22
|
try {
|
|
23
|
-
const endpoint = `/collections/fork/${
|
|
23
|
+
const endpoint = `/collections/fork/${args.collectionId}`;
|
|
24
24
|
const query = new URLSearchParams();
|
|
25
|
-
if (
|
|
26
|
-
query.set('workspace', String(
|
|
25
|
+
if (args.workspace !== undefined)
|
|
26
|
+
query.set('workspace', String(args.workspace));
|
|
27
27
|
const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
|
|
28
28
|
const bodyPayload = {};
|
|
29
|
-
if (
|
|
30
|
-
bodyPayload.label =
|
|
29
|
+
if (args.label !== undefined)
|
|
30
|
+
bodyPayload.label = args.label;
|
|
31
31
|
const options = {
|
|
32
32
|
body: JSON.stringify(bodyPayload),
|
|
33
33
|
contentType: ContentType.Json,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ContentType } from '../clients/postman.js';
|
|
3
|
-
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { McpError, ErrorCode, } from '@modelcontextprotocol/sdk/types.js';
|
|
4
4
|
function asMcpError(error) {
|
|
5
5
|
const cause = error?.cause ?? String(error);
|
|
6
6
|
return new McpError(ErrorCode.InternalError, cause);
|
|
@@ -24,16 +24,16 @@ export const annotations = {
|
|
|
24
24
|
destructiveHint: false,
|
|
25
25
|
idempotentHint: false,
|
|
26
26
|
};
|
|
27
|
-
export async function handler(
|
|
27
|
+
export async function handler(args, extra) {
|
|
28
28
|
try {
|
|
29
|
-
const endpoint = `/collections/${
|
|
29
|
+
const endpoint = `/collections/${args.collectionId}/requests`;
|
|
30
30
|
const query = new URLSearchParams();
|
|
31
|
-
if (
|
|
32
|
-
query.set('folderId', String(
|
|
31
|
+
if (args.folderId !== undefined)
|
|
32
|
+
query.set('folderId', String(args.folderId));
|
|
33
33
|
const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
|
|
34
34
|
const bodyPayload = {};
|
|
35
|
-
if (
|
|
36
|
-
bodyPayload.name =
|
|
35
|
+
if (args.name !== undefined)
|
|
36
|
+
bodyPayload.name = args.name;
|
|
37
37
|
const options = {
|
|
38
38
|
body: JSON.stringify(bodyPayload),
|
|
39
39
|
contentType: ContentType.Json,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ContentType } from '../clients/postman.js';
|
|
3
|
-
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { McpError, ErrorCode, } from '@modelcontextprotocol/sdk/types.js';
|
|
4
4
|
function asMcpError(error) {
|
|
5
5
|
const cause = error?.cause ?? String(error);
|
|
6
6
|
return new McpError(ErrorCode.InternalError, cause);
|
|
@@ -21,16 +21,16 @@ export const annotations = {
|
|
|
21
21
|
destructiveHint: false,
|
|
22
22
|
idempotentHint: false,
|
|
23
23
|
};
|
|
24
|
-
export async function handler(
|
|
24
|
+
export async function handler(args, extra) {
|
|
25
25
|
try {
|
|
26
|
-
const endpoint = `/collections/${
|
|
26
|
+
const endpoint = `/collections/${args.collectionId}/responses`;
|
|
27
27
|
const query = new URLSearchParams();
|
|
28
|
-
if (
|
|
29
|
-
query.set('requestId', String(
|
|
28
|
+
if (args.requestId !== undefined)
|
|
29
|
+
query.set('requestId', String(args.requestId));
|
|
30
30
|
const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
|
|
31
31
|
const bodyPayload = {};
|
|
32
|
-
if (
|
|
33
|
-
bodyPayload.name =
|
|
32
|
+
if (args.name !== undefined)
|
|
33
|
+
bodyPayload.name = args.name;
|
|
34
34
|
const options = {
|
|
35
35
|
body: JSON.stringify(bodyPayload),
|
|
36
36
|
contentType: ContentType.Json,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ContentType } from '../clients/postman.js';
|
|
3
|
-
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { McpError, ErrorCode, } from '@modelcontextprotocol/sdk/types.js';
|
|
4
4
|
function asMcpError(error) {
|
|
5
5
|
const cause = error?.cause ?? String(error);
|
|
6
6
|
return new McpError(ErrorCode.InternalError, cause);
|
|
@@ -37,16 +37,16 @@ export const annotations = {
|
|
|
37
37
|
destructiveHint: false,
|
|
38
38
|
idempotentHint: false,
|
|
39
39
|
};
|
|
40
|
-
export async function handler(
|
|
40
|
+
export async function handler(args, extra) {
|
|
41
41
|
try {
|
|
42
42
|
const endpoint = `/environments`;
|
|
43
43
|
const query = new URLSearchParams();
|
|
44
|
-
if (
|
|
45
|
-
query.set('workspace', String(
|
|
44
|
+
if (args.workspace !== undefined)
|
|
45
|
+
query.set('workspace', String(args.workspace));
|
|
46
46
|
const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
|
|
47
47
|
const bodyPayload = {};
|
|
48
|
-
if (
|
|
49
|
-
bodyPayload.environment =
|
|
48
|
+
if (args.environment !== undefined)
|
|
49
|
+
bodyPayload.environment = args.environment;
|
|
50
50
|
const options = {
|
|
51
51
|
body: JSON.stringify(bodyPayload),
|
|
52
52
|
contentType: ContentType.Json,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ContentType } from '../clients/postman.js';
|
|
3
|
-
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { McpError, ErrorCode, } from '@modelcontextprotocol/sdk/types.js';
|
|
4
4
|
function asMcpError(error) {
|
|
5
5
|
const cause = error?.cause ?? String(error);
|
|
6
6
|
return new McpError(ErrorCode.InternalError, cause);
|
|
@@ -35,18 +35,18 @@ export const annotations = {
|
|
|
35
35
|
destructiveHint: false,
|
|
36
36
|
idempotentHint: false,
|
|
37
37
|
};
|
|
38
|
-
export async function handler(
|
|
38
|
+
export async function handler(args, extra) {
|
|
39
39
|
try {
|
|
40
|
-
const endpoint = `/collections/${
|
|
40
|
+
const endpoint = `/collections/${args.collectionId}/folders/${args.folderId}/comments`;
|
|
41
41
|
const query = new URLSearchParams();
|
|
42
42
|
const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
|
|
43
43
|
const bodyPayload = {};
|
|
44
|
-
if (
|
|
45
|
-
bodyPayload.body =
|
|
46
|
-
if (
|
|
47
|
-
bodyPayload.threadId =
|
|
48
|
-
if (
|
|
49
|
-
bodyPayload.tags =
|
|
44
|
+
if (args.body !== undefined)
|
|
45
|
+
bodyPayload.body = args.body;
|
|
46
|
+
if (args.threadId !== undefined)
|
|
47
|
+
bodyPayload.threadId = args.threadId;
|
|
48
|
+
if (args.tags !== undefined)
|
|
49
|
+
bodyPayload.tags = args.tags;
|
|
50
50
|
const options = {
|
|
51
51
|
body: JSON.stringify(bodyPayload),
|
|
52
52
|
contentType: ContentType.Json,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ContentType } from '../clients/postman.js';
|
|
3
|
-
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { McpError, ErrorCode, } from '@modelcontextprotocol/sdk/types.js';
|
|
4
4
|
function asMcpError(error) {
|
|
5
5
|
const cause = error?.cause ?? String(error);
|
|
6
6
|
return new McpError(ErrorCode.InternalError, cause);
|
|
7
7
|
}
|
|
8
8
|
export const method = 'createMock';
|
|
9
|
-
export const description = 'Creates a mock server in a collection.\n\n
|
|
9
|
+
export const description = 'Creates a mock server in a collection.\n\n- Pass the collection UID (ownerId-collectionId), not the bare collection ID.\n- If you only have a \\`collectionId\\`, resolve the UID first:\n 1) Prefer GET \\`/collections/{collectionId}\\` and read \\`uid\\`, or\n 2) Construct \\`{ownerId}-{collectionId}\\` using ownerId from GET \\`/me\\`:\n - For team-owned collections: \\`ownerId = me.teamId\\`\n - For personal collections: \\`ownerId = me.user.id\\`\n- Use the \\`workspace\\` query to place the mock in a specific workspace. Prefer explicit workspace scoping.\n';
|
|
10
10
|
export const parameters = z.object({
|
|
11
11
|
workspace: z.string().describe("The workspace's ID."),
|
|
12
12
|
mock: z
|
|
@@ -25,21 +25,21 @@ export const parameters = z.object({
|
|
|
25
25
|
.optional(),
|
|
26
26
|
});
|
|
27
27
|
export const annotations = {
|
|
28
|
-
title: 'Creates a mock server in a collection.\n\n
|
|
28
|
+
title: 'Creates a mock server in a collection.\n\n- Pass the collection UID (ownerId-collectionId), not the bare collection ID.\n- If you only have a \\`collectionId\\`, resolve the UID first:\n 1) Prefer GET \\`/collections/{collectionId}\\` and read \\`uid\\`, or\n 2) Construct \\`{ownerId}-{collectionId}\\` using ownerId from GET \\`/me\\`:\n - For team-owned collections: \\`ownerId = me.teamId\\`\n - For personal collections: \\`ownerId = me.user.id\\`\n- Use the \\`workspace\\` query to place the mock in a specific workspace. Prefer explicit workspace scoping.\n',
|
|
29
29
|
readOnlyHint: false,
|
|
30
30
|
destructiveHint: false,
|
|
31
31
|
idempotentHint: false,
|
|
32
32
|
};
|
|
33
|
-
export async function handler(
|
|
33
|
+
export async function handler(args, extra) {
|
|
34
34
|
try {
|
|
35
35
|
const endpoint = `/mocks`;
|
|
36
36
|
const query = new URLSearchParams();
|
|
37
|
-
if (
|
|
38
|
-
query.set('workspace', String(
|
|
37
|
+
if (args.workspace !== undefined)
|
|
38
|
+
query.set('workspace', String(args.workspace));
|
|
39
39
|
const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
|
|
40
40
|
const bodyPayload = {};
|
|
41
|
-
if (
|
|
42
|
-
bodyPayload.mock =
|
|
41
|
+
if (args.mock !== undefined)
|
|
42
|
+
bodyPayload.mock = args.mock;
|
|
43
43
|
const options = {
|
|
44
44
|
body: JSON.stringify(bodyPayload),
|
|
45
45
|
contentType: ContentType.Json,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ContentType } from '../clients/postman.js';
|
|
3
|
-
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { McpError, ErrorCode, } from '@modelcontextprotocol/sdk/types.js';
|
|
4
4
|
function asMcpError(error) {
|
|
5
5
|
const cause = error?.cause ?? String(error);
|
|
6
6
|
return new McpError(ErrorCode.InternalError, cause);
|
|
@@ -121,16 +121,16 @@ export const annotations = {
|
|
|
121
121
|
destructiveHint: false,
|
|
122
122
|
idempotentHint: false,
|
|
123
123
|
};
|
|
124
|
-
export async function handler(
|
|
124
|
+
export async function handler(args, extra) {
|
|
125
125
|
try {
|
|
126
126
|
const endpoint = `/monitors`;
|
|
127
127
|
const query = new URLSearchParams();
|
|
128
|
-
if (
|
|
129
|
-
query.set('workspace', String(
|
|
128
|
+
if (args.workspace !== undefined)
|
|
129
|
+
query.set('workspace', String(args.workspace));
|
|
130
130
|
const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
|
|
131
131
|
const bodyPayload = {};
|
|
132
|
-
if (
|
|
133
|
-
bodyPayload.monitor =
|
|
132
|
+
if (args.monitor !== undefined)
|
|
133
|
+
bodyPayload.monitor = args.monitor;
|
|
134
134
|
const options = {
|
|
135
135
|
body: JSON.stringify(bodyPayload),
|
|
136
136
|
contentType: ContentType.Json,
|