@postman/postman-mcp-server 2.4.2 → 2.5.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.
Files changed (127) hide show
  1. package/README.md +31 -15
  2. package/dist/package.json +11 -20
  3. package/dist/src/clients/postman.js +2 -4
  4. package/dist/src/constants.js +5 -0
  5. package/dist/src/enabledResources.js +24 -2
  6. package/dist/src/index.js +11 -6
  7. package/dist/src/tools/createCollection.js +35 -35
  8. package/dist/src/tools/createCollectionComment.js +1 -5
  9. package/dist/src/tools/createCollectionFolder.js +1 -5
  10. package/dist/src/tools/createCollectionFork.js +1 -5
  11. package/dist/src/tools/createCollectionRequest.js +1 -5
  12. package/dist/src/tools/createCollectionResponse.js +1 -5
  13. package/dist/src/tools/createEnvironment.js +1 -5
  14. package/dist/src/tools/createFolderComment.js +1 -5
  15. package/dist/src/tools/createMock.js +1 -5
  16. package/dist/src/tools/createMonitor.js +1 -5
  17. package/dist/src/tools/createRequestComment.js +1 -5
  18. package/dist/src/tools/createResponseComment.js +1 -5
  19. package/dist/src/tools/createSpec.js +1 -5
  20. package/dist/src/tools/createSpecFile.js +1 -5
  21. package/dist/src/tools/createWorkspace.js +1 -5
  22. package/dist/src/tools/deleteApiCollectionComment.js +1 -5
  23. package/dist/src/tools/deleteCollection.js +1 -5
  24. package/dist/src/tools/deleteCollectionComment.js +1 -5
  25. package/dist/src/tools/deleteCollectionFolder.js +1 -5
  26. package/dist/src/tools/deleteCollectionRequest.js +1 -5
  27. package/dist/src/tools/deleteCollectionResponse.js +1 -5
  28. package/dist/src/tools/deleteEnvironment.js +1 -5
  29. package/dist/src/tools/deleteFolderComment.js +1 -5
  30. package/dist/src/tools/deleteMock.js +1 -5
  31. package/dist/src/tools/deleteMonitor.js +1 -5
  32. package/dist/src/tools/deletePanElementOrFolder.js +1 -5
  33. package/dist/src/tools/deleteRequestComment.js +1 -5
  34. package/dist/src/tools/deleteResponseComment.js +1 -5
  35. package/dist/src/tools/deleteSpec.js +1 -5
  36. package/dist/src/tools/deleteSpecFile.js +1 -5
  37. package/dist/src/tools/deleteWorkspace.js +1 -5
  38. package/dist/src/tools/duplicateCollection.js +1 -5
  39. package/dist/src/tools/generateCollection.js +1 -5
  40. package/dist/src/tools/generateSpecFromCollection.js +1 -5
  41. package/dist/src/tools/getAllElementsAndFolders.js +1 -5
  42. package/dist/src/tools/getAllPanAddElementRequests.js +1 -5
  43. package/dist/src/tools/getAllSpecs.js +1 -5
  44. package/dist/src/tools/getAsyncSpecTaskStatus.js +1 -5
  45. package/dist/src/tools/getAuthenticatedUser.js +1 -5
  46. package/dist/src/tools/getCodeGenerationInstructions.js +439 -0
  47. package/dist/src/tools/getCollection.js +1 -5
  48. package/dist/src/tools/getCollectionComments.js +1 -5
  49. package/dist/src/tools/getCollectionFolder.js +1 -5
  50. package/dist/src/tools/getCollectionForks.js +1 -5
  51. package/dist/src/tools/getCollectionMap.js +101 -0
  52. package/dist/src/tools/getCollectionRequest.js +1 -5
  53. package/dist/src/tools/getCollectionResponse.js +1 -5
  54. package/dist/src/tools/getCollectionTags.js +1 -5
  55. package/dist/src/tools/getCollectionUpdatesTasks.js +1 -5
  56. package/dist/src/tools/getCollections.js +1 -5
  57. package/dist/src/tools/getCollectionsForkedByUser.js +1 -5
  58. package/dist/src/tools/getDuplicateCollectionTaskStatus.js +1 -5
  59. package/dist/src/tools/getEnabledTools.js +51 -0
  60. package/dist/src/tools/getEnvironment.js +1 -5
  61. package/dist/src/tools/getEnvironments.js +1 -5
  62. package/dist/src/tools/getFolderComments.js +1 -5
  63. package/dist/src/tools/getGeneratedCollectionSpecs.js +1 -5
  64. package/dist/src/tools/getMock.js +1 -5
  65. package/dist/src/tools/getMocks.js +1 -5
  66. package/dist/src/tools/getMonitor.js +1 -5
  67. package/dist/src/tools/getMonitors.js +1 -5
  68. package/dist/src/tools/getRequestComments.js +1 -5
  69. package/dist/src/tools/getResponseComments.js +1 -5
  70. package/dist/src/tools/getSourceCollectionStatus.js +1 -5
  71. package/dist/src/tools/getSpec.js +1 -5
  72. package/dist/src/tools/getSpecCollections.js +1 -5
  73. package/dist/src/tools/getSpecDefinition.js +1 -5
  74. package/dist/src/tools/getSpecFile.js +1 -5
  75. package/dist/src/tools/getSpecFiles.js +1 -5
  76. package/dist/src/tools/getStatusOfAnAsyncApiTask.js +1 -5
  77. package/dist/src/tools/getTaggedEntities.js +1 -5
  78. package/dist/src/tools/getWorkspace.js +1 -5
  79. package/dist/src/tools/getWorkspaceGlobalVariables.js +1 -5
  80. package/dist/src/tools/getWorkspaceTags.js +1 -5
  81. package/dist/src/tools/getWorkspaces.js +1 -5
  82. package/dist/src/tools/mergeCollectionFork.js +1 -5
  83. package/dist/src/tools/patchCollection.js +13 -17
  84. package/dist/src/tools/patchEnvironment.js +1 -5
  85. package/dist/src/tools/postPanElementOrFolder.js +1 -5
  86. package/dist/src/tools/publishDocumentation.js +1 -5
  87. package/dist/src/tools/publishMock.js +1 -5
  88. package/dist/src/tools/pullCollectionChanges.js +1 -5
  89. package/dist/src/tools/putCollection.js +36 -36
  90. package/dist/src/tools/putEnvironment.js +1 -5
  91. package/dist/src/tools/resolveCommentThread.js +1 -5
  92. package/dist/src/tools/runCollection.js +4 -82
  93. package/dist/src/tools/runMonitor.js +1 -5
  94. package/dist/src/tools/runner/executor.js +165 -0
  95. package/dist/src/tools/runner/fetchers.js +33 -0
  96. package/dist/src/tools/runner/index.js +20 -0
  97. package/dist/src/tools/runner/models.js +1 -0
  98. package/dist/src/tools/runner/parsers.js +8 -0
  99. package/dist/src/tools/runner/telemetry.js +178 -0
  100. package/dist/src/tools/searchPostmanElements.js +69 -0
  101. package/dist/src/tools/syncCollectionWithSpec.js +1 -5
  102. package/dist/src/tools/syncSpecWithCollection.js +1 -5
  103. package/dist/src/tools/transferCollectionFolders.js +1 -5
  104. package/dist/src/tools/transferCollectionRequests.js +1 -5
  105. package/dist/src/tools/transferCollectionResponses.js +1 -5
  106. package/dist/src/tools/unpublishDocumentation.js +1 -5
  107. package/dist/src/tools/unpublishMock.js +1 -5
  108. package/dist/src/tools/updateApiCollectionComment.js +1 -5
  109. package/dist/src/tools/updateCollectionComment.js +1 -5
  110. package/dist/src/tools/updateCollectionFolder.js +1 -5
  111. package/dist/src/tools/updateCollectionRequest.js +1 -5
  112. package/dist/src/tools/updateCollectionResponse.js +1 -5
  113. package/dist/src/tools/updateCollectionTags.js +1 -5
  114. package/dist/src/tools/updateFolderComment.js +1 -5
  115. package/dist/src/tools/updateMock.js +1 -5
  116. package/dist/src/tools/updateMonitor.js +1 -5
  117. package/dist/src/tools/updatePanElementOrFolder.js +1 -5
  118. package/dist/src/tools/updateRequestComment.js +1 -5
  119. package/dist/src/tools/updateResponseComment.js +1 -5
  120. package/dist/src/tools/updateSpecFile.js +1 -5
  121. package/dist/src/tools/updateSpecProperties.js +1 -5
  122. package/dist/src/tools/updateWorkspace.js +1 -5
  123. package/dist/src/tools/updateWorkspaceGlobalVariables.js +1 -5
  124. package/dist/src/tools/updateWorkspaceTags.js +1 -5
  125. package/dist/src/tools/utils/toolHelpers.js +6 -0
  126. package/package.json +11 -20
  127. package/dist/src/tools/utils/runner.js +0 -84
@@ -0,0 +1,178 @@
1
+ import { RUNNER_ACCEPT_HEADER } from '../../constants.js';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+ export function buildTelemetryPayload(collectionId, collectionName, result) {
4
+ const durationMs = result.durationMs;
5
+ const stats = result.summary?.run?.stats || {};
6
+ const iterations = stats.iterations || { total: 0, pending: 0, failed: 0 };
7
+ const items = stats.items || { total: 0, pending: 0, failed: 0 };
8
+ const scripts = stats.scripts || { total: 0, pending: 0, failed: 0 };
9
+ const prerequests = stats.prerequests || { total: 0, pending: 0, failed: 0 };
10
+ const requests = stats.requests || { total: 0, pending: 0, failed: 0 };
11
+ const tests = stats.tests || { total: 0, pending: 0, failed: 0 };
12
+ const assertions = stats.assertions || { total: 0, pending: 0, failed: 0 };
13
+ const testScripts = stats.testScripts || { total: 0, pending: 0, failed: 0 };
14
+ const prerequestScripts = stats.prerequestScripts || { total: 0, pending: 0, failed: 0 };
15
+ const responses = result.summary?.run?.executions || [];
16
+ const totalResponseTime = responses.reduce((sum, exec) => {
17
+ return sum + (exec?.response?.responseTime || 0);
18
+ }, 0);
19
+ const averageResponseTime = responses.length > 0 ? totalResponseTime / responses.length : 0;
20
+ const totalDataReceived = responses.reduce((sum, exec) => {
21
+ return sum + (exec?.response?.responseSize || 0);
22
+ }, 0);
23
+ const iterationsData = (result.summary?.run?.executions || []).map((exec) => {
24
+ const item = exec.item || {};
25
+ const request = exec.request || {};
26
+ const response = exec.response || {};
27
+ const assertions = exec.assertions || [];
28
+ const testResults = assertions.map((assertion) => ({
29
+ name: assertion.assertion || 'Unnamed test',
30
+ status: assertion.error ? 'fail' : 'pass',
31
+ error: assertion.error
32
+ ? {
33
+ name: assertion.error.name || 'AssertionError',
34
+ message: assertion.error.message || 'Unknown error',
35
+ stack: assertion.error.stack || '',
36
+ }
37
+ : null,
38
+ }));
39
+ const requestData = {
40
+ url: request.url?.toString() || '',
41
+ method: request.method || 'GET',
42
+ headers: request.headers || {},
43
+ };
44
+ if (request.body) {
45
+ requestData.body = {
46
+ mode: request.body.mode || 'raw',
47
+ raw: request.body.raw || '',
48
+ };
49
+ if (request.body.options) {
50
+ requestData.body.options = request.body.options;
51
+ }
52
+ }
53
+ const responseData = {
54
+ code: response.code || 0,
55
+ name: response.status || '',
56
+ time: response.responseTime || 0,
57
+ size: response.responseSize || 0,
58
+ headers: response.headers || [],
59
+ };
60
+ if (response.stream) {
61
+ try {
62
+ responseData.body = response.stream.toString();
63
+ }
64
+ catch {
65
+ responseData.body = '';
66
+ }
67
+ }
68
+ return {
69
+ id: uuidv4(),
70
+ name: item.name || 'Request',
71
+ error: exec.requestError
72
+ ? {
73
+ name: exec.requestError.name || 'Error',
74
+ message: exec.requestError.message || 'Unknown error',
75
+ }
76
+ : null,
77
+ tests: testResults,
78
+ request: requestData,
79
+ response: responseData,
80
+ };
81
+ });
82
+ return {
83
+ collectionRun: {
84
+ id: uuidv4(),
85
+ collection: collectionId,
86
+ name: collectionName,
87
+ status: 'finished',
88
+ source: 'postman-cli',
89
+ delay: 0,
90
+ currentIteration: iterations.total || 1,
91
+ failedTestCount: result.testStats.failed,
92
+ skippedTestCount: 0,
93
+ passedTestCount: result.testStats.passed,
94
+ totalTestCount: result.testStats.total,
95
+ iterations: iterationsData.length > 0 ? [iterationsData] : [],
96
+ totalTime: durationMs,
97
+ totalRequests: requests.total || 0,
98
+ startedAt: result.startTime,
99
+ createdAt: result.endTime,
100
+ branchSource: 'local',
101
+ branch: process.env.GIT_BRANCH || 'main',
102
+ },
103
+ runOverview: {
104
+ collectionName: collectionName,
105
+ runDurationInMiliseconds: durationMs,
106
+ averageResponseTimeInMiliseconds: Math.round(averageResponseTime),
107
+ totalDataReceivedInBytes: totalDataReceived,
108
+ statistics: {
109
+ iterations: {
110
+ total: iterations.total || 0,
111
+ pending: iterations.pending || 0,
112
+ failed: iterations.failed || 0,
113
+ },
114
+ items: {
115
+ total: items.total || 0,
116
+ pending: items.pending || 0,
117
+ failed: items.failed || 0,
118
+ },
119
+ scripts: {
120
+ total: scripts.total || 0,
121
+ pending: scripts.pending || 0,
122
+ failed: scripts.failed || 0,
123
+ },
124
+ prerequests: {
125
+ total: prerequests.total || 0,
126
+ pending: prerequests.pending || 0,
127
+ failed: prerequests.failed || 0,
128
+ },
129
+ requests: {
130
+ total: requests.total || 0,
131
+ pending: requests.pending || 0,
132
+ failed: requests.failed || 0,
133
+ },
134
+ tests: {
135
+ total: tests.total || 0,
136
+ pending: tests.pending || 0,
137
+ failed: tests.failed || 0,
138
+ },
139
+ assertions: {
140
+ total: assertions.total || 0,
141
+ pending: assertions.pending || 0,
142
+ failed: assertions.failed || 0,
143
+ },
144
+ testScripts: {
145
+ total: testScripts.total || 0,
146
+ pending: testScripts.pending || 0,
147
+ failed: testScripts.failed || 0,
148
+ },
149
+ prerequestScripts: {
150
+ total: prerequestScripts.total || 0,
151
+ pending: prerequestScripts.pending || 0,
152
+ failed: prerequestScripts.failed || 0,
153
+ },
154
+ responses: {
155
+ total: responses.length || 0,
156
+ pending: 0,
157
+ failed: requests.failed || 0,
158
+ totalResponseTime: Math.round(totalResponseTime),
159
+ },
160
+ },
161
+ },
162
+ };
163
+ }
164
+ export function reportTelemetryAsync(payload, client) {
165
+ setImmediate(async () => {
166
+ try {
167
+ await client.post('/collectionruns', {
168
+ body: JSON.stringify(payload),
169
+ headers: {
170
+ Accept: RUNNER_ACCEPT_HEADER,
171
+ },
172
+ });
173
+ }
174
+ catch (error) {
175
+ console.error('[TelemetryReporter] Failed to post collection run data:', error.message);
176
+ }
177
+ });
178
+ }
@@ -0,0 +1,69 @@
1
+ import { z } from 'zod';
2
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
3
+ export const method = 'searchPostmanElements';
4
+ export const description = 'Searches for Postman elements in the public network.\n\n**When to Use This Tool:**\n- When the user asks for a specific named request (e.g., "find PayPal requests", "search for Stripe API requests")\n- When the user explicitly wants to search the public network\n- Do NOT use this for searching the user\'s own workspaces or collections (use getCollections or getWorkspaces instead)\n\n**Search Scope:**\n- Only searches the public network (public workspaces and collections)\n- Does not search private workspaces, team workspaces, or personal collections\n- Currently supports searching for requests (entityType: "requests")\n';
5
+ export const parameters = z.object({
6
+ entityType: z
7
+ .literal('requests')
8
+ .describe('The type of Postman [entity](https://learning.postman.com/docs/getting-started/basics/postman-elements/) (element) to search for. At this time, this only accepts the `requests` value.'),
9
+ q: z
10
+ .string()
11
+ .min(1)
12
+ .max(512)
13
+ .describe('The query used to search for Postman elements.')
14
+ .optional(),
15
+ publisherIsVerified: z
16
+ .boolean()
17
+ .describe('Filter the search results to only return entities from publishers [verified](https://learning.postman.com/docs/collaborating-in-postman/public-api-network/verify-your-team/) by Postman.')
18
+ .optional(),
19
+ nextCursor: z
20
+ .string()
21
+ .describe('The cursor to get the next set of results in the paginated response. If you pass an invalid value, the API returns empty results.')
22
+ .optional(),
23
+ limit: z
24
+ .number()
25
+ .int()
26
+ .gte(1)
27
+ .lte(10)
28
+ .describe('The max number of search results returned in the response.')
29
+ .default(10),
30
+ });
31
+ export const annotations = {
32
+ title: 'Searches for Postman elements in the public network.\n\n**When to Use This Tool:**\n- When the user asks for a specific named request (e.g., "find PayPal requests", "search for Stripe API requests")\n- When the user explicitly wants to search the public network\n- Do NOT use this for searching the user\'s own workspaces or collections (use getCollections or getWorkspaces instead)\n\n**Search Scope:**\n- Only searches the public network (public workspaces and collections)\n- Does not search private workspaces, team workspaces, or personal collections\n- Currently supports searching for requests (entityType: "requests")\n',
33
+ readOnlyHint: true,
34
+ destructiveHint: false,
35
+ idempotentHint: true,
36
+ };
37
+ export async function handler(args, extra) {
38
+ try {
39
+ const endpoint = `/search/${args.entityType}`;
40
+ const query = new URLSearchParams();
41
+ if (args.q !== undefined)
42
+ query.set('q', String(args.q));
43
+ if (args.publisherIsVerified !== undefined)
44
+ query.set('publisherIsVerified', String(args.publisherIsVerified));
45
+ if (args.nextCursor !== undefined)
46
+ query.set('nextCursor', String(args.nextCursor));
47
+ if (args.limit !== undefined)
48
+ query.set('limit', String(args.limit));
49
+ const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
50
+ const options = {
51
+ headers: extra.headers,
52
+ };
53
+ const result = await extra.client.get(url, options);
54
+ return {
55
+ content: [
56
+ {
57
+ type: 'text',
58
+ text: `${typeof result === 'string' ? result : JSON.stringify(result, null, 2)}`,
59
+ },
60
+ ],
61
+ };
62
+ }
63
+ catch (e) {
64
+ if (e instanceof McpError) {
65
+ throw e;
66
+ }
67
+ throw asMcpError(e);
68
+ }
69
+ }
@@ -1,9 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { McpError, ErrorCode, } from '@modelcontextprotocol/sdk/types.js';
3
- function asMcpError(error) {
4
- const cause = error?.cause ?? String(error);
5
- return new McpError(ErrorCode.InternalError, cause);
6
- }
2
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
7
3
  export const method = 'syncCollectionWithSpec';
8
4
  export const description = 'Syncs a collection generated from an API specification. This is an asynchronous endpoint that returns an HTTP \\`202 Accepted\\` response.\n\n**Note:**\n\n- This endpoint only supports the OpenAPI 3.0 specification type.\n- You can only sync collections generated from the given spec ID.\n';
9
5
  export const parameters = z.object({
@@ -1,9 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { McpError, ErrorCode, } from '@modelcontextprotocol/sdk/types.js';
3
- function asMcpError(error) {
4
- const cause = error?.cause ?? String(error);
5
- return new McpError(ErrorCode.InternalError, cause);
6
- }
2
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
7
3
  export const method = 'syncSpecWithCollection';
8
4
  export const description = 'Syncs an API specification linked to a collection. This is an asynchronous endpoint that returns an HTTP \\`202 Accepted\\` response.\n\n**Note:**\n\n- This endpoint only supports the OpenAPI 3.0 specification type.\n- You can only sync specs generated from the given collection ID.\n';
9
5
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'transferCollectionFolders';
9
5
  export const description = 'Copies or moves folders into a collection or folder.';
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'transferCollectionRequests';
9
5
  export const description = 'Copies or moves requests into a collection or folder.';
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'transferCollectionResponses';
9
5
  export const description = 'Copies or moves responses into a request.';
10
6
  export const parameters = z.object({
@@ -1,9 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { McpError, ErrorCode, } from '@modelcontextprotocol/sdk/types.js';
3
- function asMcpError(error) {
4
- const cause = error?.cause ?? String(error);
5
- return new McpError(ErrorCode.InternalError, cause);
6
- }
2
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
7
3
  export const method = 'unpublishDocumentation';
8
4
  export const description = "Unpublishes a collection's documentation. On success, this returns an HTTP \\`204 No Content\\` response.";
9
5
  export const parameters = z.object({
@@ -1,9 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { McpError, ErrorCode, } from '@modelcontextprotocol/sdk/types.js';
3
- function asMcpError(error) {
4
- const cause = error?.cause ?? String(error);
5
- return new McpError(ErrorCode.InternalError, cause);
6
- }
2
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
7
3
  export const method = 'unpublishMock';
8
4
  export const description = 'Unpublishes a mock server. Unpublishing a mock server sets its **Access Control** configuration setting to private.';
9
5
  export const parameters = z.object({ mockId: z.string().describe("The mock's ID.") });
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateApiCollectionComment';
9
5
  export const description = "Updates a comment on an API's collection.\n\n**Note:**\n\nThis endpoint accepts a max of 10,000 characters.\n";
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateCollectionComment';
9
5
  export const description = 'Updates a comment on a collection.\n\n**Note:**\n\nThis endpoint accepts a max of 10,000 characters.\n';
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateCollectionFolder';
9
5
  export const description = 'Updates a folder in a collection. For a complete list of properties, refer to the **Folder** entry in the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).\n\n**Note:**\n\nThis endpoint acts like a PATCH method. It only updates the values that you pass in the request body (for example, the \\`name\\` property). The endpoint does not update the entire resource.\n';
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateCollectionRequest';
9
5
  export const description = 'Updates a request in a collection. For a complete list of properties, refer to the **Request** entry in the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).\n\n**Note:**\n\n- You must pass a collection ID (\\`12ece9e1-2abf-4edc-8e34-de66e74114d2\\`), not a collection(\\`12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\`), in this endpoint.\n- This endpoint does not support changing the folder of a request.\n';
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateCollectionResponse';
9
5
  export const description = 'Updates a response in a collection. For a complete list of properties, see the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).\n\n**Note:**\n\n- You must pass a collection ID (\\`12ece9e1-2abf-4edc-8e34-de66e74114d2\\`), not a collection UID (\\`12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\`), in this endpoint.\n- This endpoint acts like a PATCH method. It only updates the values that you pass in the request body (for example, the \\`name\\` property). The endpoint does not update the entire resource.\n';
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateCollectionTags';
9
5
  export const description = "Updates a collection's associated tags. This endpoint replaces all existing tags with those you pass in the request body.";
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateFolderComment';
9
5
  export const description = 'Updates a comment on a folder.\n\n**Note:**\n\nThis endpoint accepts a max of 10,000 characters.\n';
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateMock';
9
5
  export const description = 'Updates a mock server.\n- Resource: Mock server entity associated with a collection UID.\n- Use this to change name, environment, privacy, or default server response.\n';
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateMonitor';
9
5
  export const description = "Updates a monitor's [configurations](https://learning.postman.com/docs/monitoring-your-api/setting-up-monitor/#configure-a-monitor).";
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updatePanElementOrFolder';
9
5
  export const description = "Updates an element or folder in your team's [Private API Network](https://learning.postman.com/docs/collaborating-in-postman/adding-private-network/).\n\n**Note:**\n\nYou can only pass one element object type per call. For example, you cannot pass both \\`api\\` and \\`collection\\` in a single request.\n";
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateRequestComment';
9
5
  export const description = 'Updates a comment on a request.\n\n**Note:**\n\nThis endpoint accepts a max of 10,000 characters.\n';
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateResponseComment';
9
5
  export const description = 'Updates a comment on a response.\n\n**Note:**\n\nThis endpoint accepts a max of 10,000 characters.\n';
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateSpecFile';
9
5
  export const description = "Updates an API specification's file.\n\n**Note:**\n\n- This endpoint does not accept an empty request body. You must pass one of the accepted values.\n- This endpoint does not accept multiple request body properties in a single call. For example, you cannot pass both the \\`content\\` and \\`type\\` property at the same time.\n- Multi-file specifications can only have one root file.\n- When updating a file type to \\`ROOT\\`, the previous root file is updated to the \\`DEFAULT\\` file type.\n- Files cannot exceed a maximum of 10 MB in size.\n";
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateSpecProperties';
9
5
  export const description = "Updates an API specification's properties, such as its name.";
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateWorkspace';
9
5
  export const description = 'Updates a workspace.\n\n**Note:**\n\n- There are rate limits when publishing public workspaces.\n- Public team workspace names must be unique.\n\n### Important\n\nWe deprecated linking collections or environments between workspaces. We do not recommend that you do this.\n\nIf you have a linked collection or environment, note the following:\n- The endpoint does not create a clone of a collection or environment.\n- Any changes you make to a linked collection or environment changes them in all workspaces.\n- If you delete a collection or environment linked between workspaces, the system deletes it in all the workspaces.\n';
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateWorkspaceGlobalVariables';
9
5
  export const description = "Updates and replaces a workspace's global [variables](https://learning.postman.com/docs/sending-requests/variables/#variable-scopes). This endpoint replaces all existing global variables with the variables you pass in the request body.";
10
6
  export const parameters = z.object({
@@ -1,10 +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';
4
- function asMcpError(error) {
5
- const cause = error?.cause ?? String(error);
6
- return new McpError(ErrorCode.InternalError, cause);
7
- }
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
8
4
  export const method = 'updateWorkspaceTags';
9
5
  export const description = "Updates a workspace's associated tags. This endpoint replaces all existing tags with those you pass in the request body.";
10
6
  export const parameters = z.object({
@@ -0,0 +1,6 @@
1
+ import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
2
+ export { McpError };
3
+ export function asMcpError(error) {
4
+ const cause = error?.cause ?? String(error);
5
+ return new McpError(ErrorCode.InternalError, cause);
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postman/postman-mcp-server",
3
- "version": "2.4.2",
3
+ "version": "2.5.1",
4
4
  "description": "A simple MCP server to operate on the Postman API",
5
5
  "mcpName": "com.postman/postman-mcp-server",
6
6
  "main": "dist/src/index.js",
@@ -27,30 +27,21 @@
27
27
  "access": "public"
28
28
  },
29
29
  "dependencies": {
30
- "@apidevtools/swagger-parser": "^12.0.0",
31
- "@modelcontextprotocol/sdk": "^1.18.1",
32
- "dotenv": "^17.2.2",
33
- "es-toolkit": "^1.39.10",
34
- "express": "^5.1.0",
35
- "newman": "^6.2.1"
30
+ "@modelcontextprotocol/sdk": "^1.22.0",
31
+ "dotenv": "^17.2.3",
32
+ "newman": "^6.2.0",
33
+ "uuid": "^13.0.0"
36
34
  },
37
35
  "devDependencies": {
38
- "@eslint/js": "^9.35.0",
39
- "@types/express": "^5.0.3",
36
+ "@eslint/js": "^9.39.1",
40
37
  "@types/node": "^24",
41
- "eslint": "^9.35.0",
38
+ "eslint": "^9.39.1",
42
39
  "eslint-config-prettier": "^10.1.8",
43
- "eslint-plugin-prettier": "^5.5.4",
44
- "eslint-plugin-unused-imports": "^4.2.0",
45
- "fs-extra": "^11.3.2",
46
- "jest": "^30.1.3",
47
- "json-schema-to-zod": "^2.6.1",
48
- "openapi-types": "^12.1.3",
40
+ "eslint-plugin-unused-imports": "^4.3.0",
49
41
  "prettier": "^3.6.2",
50
- "tsx": "^4.20.5",
51
- "typescript": "^5.9.2",
52
- "typescript-eslint": "^8.44.0",
53
- "vitest": "^3.2.4"
42
+ "typescript": "^5.9.3",
43
+ "typescript-eslint": "^8.48.0",
44
+ "vitest": "^4.0.13"
54
45
  },
55
46
  "engines": {
56
47
  "node": ">=20.0.0"