@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.
Files changed (111) hide show
  1. package/dist/package.json +18 -18
  2. package/dist/src/clients/postman.js +25 -15
  3. package/dist/src/index.js +38 -50
  4. package/dist/src/tools/createCollection.js +13 -17
  5. package/dist/src/tools/createCollectionComment.js +9 -9
  6. package/dist/src/tools/createCollectionFolder.js +7 -7
  7. package/dist/src/tools/createCollectionFork.js +7 -7
  8. package/dist/src/tools/createCollectionRequest.js +7 -7
  9. package/dist/src/tools/createCollectionResponse.js +7 -7
  10. package/dist/src/tools/createEnvironment.js +6 -6
  11. package/dist/src/tools/createFolderComment.js +9 -9
  12. package/dist/src/tools/createMock.js +8 -8
  13. package/dist/src/tools/createMonitor.js +6 -6
  14. package/dist/src/tools/createRequestComment.js +9 -9
  15. package/dist/src/tools/createResponseComment.js +9 -9
  16. package/dist/src/tools/createSpec.js +10 -10
  17. package/dist/src/tools/createSpecFile.js +7 -7
  18. package/dist/src/tools/createWorkspace.js +4 -4
  19. package/dist/src/tools/deleteApiCollectionComment.js +3 -3
  20. package/dist/src/tools/deleteCollection.js +3 -3
  21. package/dist/src/tools/deleteCollectionComment.js +3 -3
  22. package/dist/src/tools/deleteCollectionFolder.js +3 -3
  23. package/dist/src/tools/deleteCollectionRequest.js +3 -3
  24. package/dist/src/tools/deleteCollectionResponse.js +3 -3
  25. package/dist/src/tools/deleteEnvironment.js +3 -3
  26. package/dist/src/tools/deleteFolderComment.js +3 -3
  27. package/dist/src/tools/deleteMock.js +5 -5
  28. package/dist/src/tools/deleteMonitor.js +3 -3
  29. package/dist/src/tools/deletePanElementOrFolder.js +3 -3
  30. package/dist/src/tools/deleteRequestComment.js +3 -3
  31. package/dist/src/tools/deleteResponseComment.js +3 -3
  32. package/dist/src/tools/deleteSpec.js +3 -3
  33. package/dist/src/tools/deleteSpecFile.js +3 -3
  34. package/dist/src/tools/deleteWorkspace.js +3 -3
  35. package/dist/src/tools/duplicateCollection.js +7 -7
  36. package/dist/src/tools/generateCollection.js +11 -11
  37. package/dist/src/tools/generateSpecFromCollection.js +9 -9
  38. package/dist/src/tools/getAllElementsAndFolders.js +28 -28
  39. package/dist/src/tools/getAllPanAddElementRequests.js +22 -22
  40. package/dist/src/tools/getAllSpecs.js +8 -8
  41. package/dist/src/tools/getAsyncSpecTaskStatus.js +3 -3
  42. package/dist/src/tools/getAuthenticatedUser.js +4 -4
  43. package/dist/src/tools/getCollection.js +7 -7
  44. package/dist/src/tools/getCollectionComments.js +3 -3
  45. package/dist/src/tools/getCollectionFolder.js +9 -9
  46. package/dist/src/tools/getCollectionForks.js +9 -9
  47. package/dist/src/tools/getCollectionRequest.js +9 -9
  48. package/dist/src/tools/getCollectionResponse.js +9 -9
  49. package/dist/src/tools/getCollectionTags.js +3 -3
  50. package/dist/src/tools/getCollectionUpdatesTasks.js +3 -3
  51. package/dist/src/tools/getCollections.js +10 -10
  52. package/dist/src/tools/getCollectionsForkedByUser.js +8 -8
  53. package/dist/src/tools/getDuplicateCollectionTaskStatus.js +3 -3
  54. package/dist/src/tools/getEnvironment.js +3 -3
  55. package/dist/src/tools/getEnvironments.js +4 -4
  56. package/dist/src/tools/getFolderComments.js +3 -3
  57. package/dist/src/tools/getGeneratedCollectionSpecs.js +3 -3
  58. package/dist/src/tools/getMock.js +5 -5
  59. package/dist/src/tools/getMocks.js +16 -10
  60. package/dist/src/tools/getMonitor.js +3 -3
  61. package/dist/src/tools/getMonitors.js +16 -16
  62. package/dist/src/tools/getRequestComments.js +3 -3
  63. package/dist/src/tools/getResponseComments.js +3 -3
  64. package/dist/src/tools/getSourceCollectionStatus.js +3 -3
  65. package/dist/src/tools/getSpec.js +3 -3
  66. package/dist/src/tools/getSpecCollections.js +7 -7
  67. package/dist/src/tools/getSpecDefinition.js +3 -3
  68. package/dist/src/tools/getSpecFile.js +3 -3
  69. package/dist/src/tools/getSpecFiles.js +3 -3
  70. package/dist/src/tools/getStatusOfAnAsyncApiTask.js +3 -3
  71. package/dist/src/tools/getTaggedEntities.js +11 -11
  72. package/dist/src/tools/getWorkspace.js +5 -5
  73. package/dist/src/tools/getWorkspaceGlobalVariables.js +3 -3
  74. package/dist/src/tools/getWorkspaceTags.js +3 -3
  75. package/dist/src/tools/getWorkspaces.js +12 -12
  76. package/dist/src/tools/mergeCollectionFork.js +8 -8
  77. package/dist/src/tools/patchCollection.js +5 -5
  78. package/dist/src/tools/patchEnvironment.js +50 -4
  79. package/dist/src/tools/postPanElementOrFolder.js +51 -3
  80. package/dist/src/tools/publishDocumentation.js +11 -11
  81. package/dist/src/tools/publishMock.js +3 -3
  82. package/dist/src/tools/pullCollectionChanges.js +3 -3
  83. package/dist/src/tools/putCollection.js +13 -17
  84. package/dist/src/tools/putEnvironment.js +5 -5
  85. package/dist/src/tools/resolveCommentThread.js +3 -3
  86. package/dist/src/tools/runMonitor.js +5 -5
  87. package/dist/src/tools/syncCollectionWithSpec.js +5 -5
  88. package/dist/src/tools/syncSpecWithCollection.js +5 -5
  89. package/dist/src/tools/transferCollectionFolders.js +10 -10
  90. package/dist/src/tools/transferCollectionRequests.js +10 -10
  91. package/dist/src/tools/transferCollectionResponses.js +10 -10
  92. package/dist/src/tools/unpublishDocumentation.js +3 -3
  93. package/dist/src/tools/unpublishMock.js +3 -3
  94. package/dist/src/tools/updateApiCollectionComment.js +7 -7
  95. package/dist/src/tools/updateCollectionComment.js +7 -7
  96. package/dist/src/tools/updateCollectionFolder.js +7 -7
  97. package/dist/src/tools/updateCollectionRequest.js +7 -7
  98. package/dist/src/tools/updateCollectionResponse.js +7 -7
  99. package/dist/src/tools/updateCollectionTags.js +5 -5
  100. package/dist/src/tools/updateFolderComment.js +7 -7
  101. package/dist/src/tools/updateMock.js +7 -7
  102. package/dist/src/tools/updateMonitor.js +5 -5
  103. package/dist/src/tools/updatePanElementOrFolder.js +62 -3
  104. package/dist/src/tools/updateRequestComment.js +7 -7
  105. package/dist/src/tools/updateResponseComment.js +7 -7
  106. package/dist/src/tools/updateSpecFile.js +9 -9
  107. package/dist/src/tools/updateSpecProperties.js +5 -5
  108. package/dist/src/tools/updateWorkspace.js +5 -5
  109. package/dist/src/tools/updateWorkspaceGlobalVariables.js +5 -5
  110. package/dist/src/tools/updateWorkspaceTags.js +5 -5
  111. 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.2.1",
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": "^11.0.0",
26
- "@modelcontextprotocol/sdk": "^1.17.0",
27
- "dotenv": "^16.5.0",
28
- "es-toolkit": "^1.37.2",
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.26.0",
33
- "@types/express": "^5.0.1",
34
- "@types/node": "^22",
35
- "eslint": "^9.26.0",
36
- "eslint-config-prettier": "^10.1.5",
37
- "eslint-plugin-prettier": "^5.4.0",
38
- "eslint-plugin-unused-imports": "^4.1.4",
39
- "fs-extra": "^11.3.0",
40
- "jest": "^29.7.0",
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.5.3",
44
- "tsx": "^4.19.4",
45
- "typescript": "^5.8.3",
46
- "typescript-eslint": "^8.32.1",
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
- if (!apiKey && !process.env.POSTMAN_API_KEY) {
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
- const key = apiKey || process.env.POSTMAN_API_KEY;
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 userAgentHeader = options.headers && 'user-agent' in options.headers
50
- ? `${options.headers['user-agent']}/${packageJson.name}/${packageJson.version}`
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
- 'x-api-key': this.apiKey,
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: _, ...optionsWithoutHeaders } = options;
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 { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
5
- import { CallToolRequestSchema, ErrorCode, isInitializeRequest, ListToolsRequestSchema, McpError, } from '@modelcontextprotocol/sdk/types.js';
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 client = PostmanAPIClient.getInstance();
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 Server({ name: SERVER_NAME, version: APP_VERSION }, { capabilities: { tools: {}, logging: {} } });
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
- log('info', 'Setting up request handlers');
132
- server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
133
- const toolName = request.params.name;
134
- const tool = tools.find((t) => t.method === toolName);
135
- log('info', `Tool invocation started: ${toolName}`, { toolName });
136
- if (!tool) {
137
- log('warn', `Unknown tool requested: ${toolName}`, { toolName });
138
- throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${toolName}`);
139
- }
140
- const args = request.params.arguments || {};
141
- try {
142
- const start = Date.now();
143
- const result = await tool.handler(args, {
144
- client,
145
- headers: {
146
- ...extra.requestInfo?.headers,
147
- 'user-agent': clientInfo?.name,
148
- },
149
- });
150
- const durationMs = Date.now() - start;
151
- log('info', `Tool invocation completed: ${toolName} (${durationMs}ms)`, {
152
- toolName,
153
- durationMs,
154
- });
155
- return result;
156
- }
157
- catch (error) {
158
- const errMsg = String(error?.message || error);
159
- logBoth(server, 'error', `Tool invocation failed: ${toolName}: ${errMsg}`, { toolName });
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
- const transformedTools = tools.map((tool) => ({
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\n- If you do not include the \\`workspace\\` query parameter, the system creates the collection in the oldest personal Internal workspace you own.\n- For a complete list of available property values for this endpoint, use the following references available in the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html):\n - \\`info\\` object — Refer to the **Information** entry.\n - \\`item\\` object — Refer to the **Items** entry.\n- For all other possible values, refer to the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).\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.string().describe("The key's value.").optional(),
32
- type: z
33
- .enum(['string', 'boolean', 'integer'])
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
- .describe("The variable's description. Doesn't apply to collection-level variables.")
37
+ .max(512)
38
+ .describe("The variable's description.")
39
39
  .optional(),
40
40
  disabled: z
41
41
  .boolean()
42
- .describe('If true, the variable is not enabled.')
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.string().describe("The key's value.").optional(),
518
- type: z
519
- .enum(['string', 'boolean', 'integer'])
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('If true, the variable is not enabled.')
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\n- If you do not include the \\`workspace\\` query parameter, the system creates the collection in the oldest personal Internal workspace you own.\n- For a complete list of available property values for this endpoint, use the following references available in the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html):\n - \\`info\\` object — Refer to the **Information** entry.\n - \\`item\\` object — Refer to the **Items** entry.\n- For all other possible values, refer to the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).\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(params, extra) {
37
+ export async function handler(args, extra) {
38
38
  try {
39
- const endpoint = `/collections/${params.collectionId}/comments`;
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 (params.body !== undefined)
44
- bodyPayload.body = params.body;
45
- if (params.threadId !== undefined)
46
- bodyPayload.threadId = params.threadId;
47
- if (params.tags !== undefined)
48
- bodyPayload.tags = params.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(params, extra) {
24
+ export async function handler(args, extra) {
25
25
  try {
26
- const endpoint = `/collections/${params.collectionId}/folders`;
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 (params.name !== undefined)
31
- bodyPayload.name = params.name;
32
- if (params.folder !== undefined)
33
- bodyPayload.folder = params.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(params, extra) {
21
+ export async function handler(args, extra) {
22
22
  try {
23
- const endpoint = `/collections/fork/${params.collectionId}`;
23
+ const endpoint = `/collections/fork/${args.collectionId}`;
24
24
  const query = new URLSearchParams();
25
- if (params.workspace !== undefined)
26
- query.set('workspace', String(params.workspace));
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 (params.label !== undefined)
30
- bodyPayload.label = params.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(params, extra) {
27
+ export async function handler(args, extra) {
28
28
  try {
29
- const endpoint = `/collections/${params.collectionId}/requests`;
29
+ const endpoint = `/collections/${args.collectionId}/requests`;
30
30
  const query = new URLSearchParams();
31
- if (params.folderId !== undefined)
32
- query.set('folderId', String(params.folderId));
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 (params.name !== undefined)
36
- bodyPayload.name = params.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(params, extra) {
24
+ export async function handler(args, extra) {
25
25
  try {
26
- const endpoint = `/collections/${params.collectionId}/responses`;
26
+ const endpoint = `/collections/${args.collectionId}/responses`;
27
27
  const query = new URLSearchParams();
28
- if (params.requestId !== undefined)
29
- query.set('requestId', String(params.requestId));
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 (params.name !== undefined)
33
- bodyPayload.name = params.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(params, extra) {
40
+ export async function handler(args, extra) {
41
41
  try {
42
42
  const endpoint = `/environments`;
43
43
  const query = new URLSearchParams();
44
- if (params.workspace !== undefined)
45
- query.set('workspace', String(params.workspace));
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 (params.environment !== undefined)
49
- bodyPayload.environment = params.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(params, extra) {
38
+ export async function handler(args, extra) {
39
39
  try {
40
- const endpoint = `/collections/${params.collectionId}/folders/${params.folderId}/comments`;
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 (params.body !== undefined)
45
- bodyPayload.body = params.body;
46
- if (params.threadId !== undefined)
47
- bodyPayload.threadId = params.threadId;
48
- if (params.tags !== undefined)
49
- bodyPayload.tags = params.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**Note:**\n\n- You cannot create mocks for collections added to an API definition.\n- If you do not include the \\`workspaceId\\` query parameter, the system creates the mock server in the oldest personal Internal workspace you own.\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**Note:**\n\n- You cannot create mocks for collections added to an API definition.\n- If you do not include the \\`workspaceId\\` query parameter, the system creates the mock server in the oldest personal Internal workspace you own.\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(params, extra) {
33
+ export async function handler(args, extra) {
34
34
  try {
35
35
  const endpoint = `/mocks`;
36
36
  const query = new URLSearchParams();
37
- if (params.workspace !== undefined)
38
- query.set('workspace', String(params.workspace));
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 (params.mock !== undefined)
42
- bodyPayload.mock = params.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(params, extra) {
124
+ export async function handler(args, extra) {
125
125
  try {
126
126
  const endpoint = `/monitors`;
127
127
  const query = new URLSearchParams();
128
- if (params.workspace !== undefined)
129
- query.set('workspace', String(params.workspace));
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 (params.monitor !== undefined)
133
- bodyPayload.monitor = params.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,