@postman/postman-mcp-server 2.7.0 → 2.8.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 (44) hide show
  1. package/README.md +32 -0
  2. package/dist/package.json +15 -13
  3. package/dist/src/clients/postman.js +2 -0
  4. package/dist/src/enabledResources.js +14 -9
  5. package/dist/src/index.js +29 -1
  6. package/dist/src/tools/addWorkspaceToPrivateNetwork.js +47 -0
  7. package/dist/src/tools/createCollectionRequest.js +255 -94
  8. package/dist/src/tools/createCollectionResponse.js +125 -3
  9. package/dist/src/tools/createSpec.js +16 -4
  10. package/dist/src/tools/createWorkspace.js +6 -2
  11. package/dist/src/tools/deleteWorkspace.js +1 -1
  12. package/dist/src/tools/generateCollection.js +2 -2
  13. package/dist/src/tools/getAnalyticsData.js +107 -0
  14. package/dist/src/tools/getAnalyticsMetadata.js +55 -0
  15. package/dist/src/tools/getCodeGenerationInstructions.js +12 -6
  16. package/dist/src/tools/getCollection/getCollectionMap.js +2 -2
  17. package/dist/src/tools/getWorkspace.js +1 -1
  18. package/dist/src/tools/{getAllPanAddElementRequests.js → listPrivateNetworkAddRequests.js} +9 -16
  19. package/dist/src/tools/{getAllElementsAndFolders.js → listPrivateNetworkWorkspaces.js} +27 -34
  20. package/dist/src/tools/publishDocumentation.js +1 -1
  21. package/dist/src/tools/pullCollectionChanges.js +3 -1
  22. package/dist/src/tools/putCollection.js +11 -1
  23. package/dist/src/tools/removeWorkspaceFromPrivateNetwork.js +36 -0
  24. package/dist/src/tools/resolveCommentThread.js +1 -1
  25. package/dist/src/tools/respondPrivateNetworkAddRequest.js +56 -0
  26. package/dist/src/tools/searchPostmanElementsInPrivateNetwork.js +127 -0
  27. package/dist/src/tools/{searchPostmanElements.js → searchPostmanElementsInPublicNetwork.js} +1 -1
  28. package/dist/src/tools/updateCollectionRequest.js +254 -97
  29. package/dist/src/tools/updateCollectionResponse.js +113 -0
  30. package/dist/src/tools/updateWorkspace.js +1 -1
  31. package/dist/src/tools/utils/errorTemplateRenderer.js +23 -0
  32. package/dist/src/views/errors/getCollectionFolder.404.njk +5 -0
  33. package/dist/src/views/errors/getCollectionRequest.404.njk +5 -0
  34. package/dist/src/views/errors/getCollectionResponse.404.njk +5 -0
  35. package/dist/src/views/errors/getEnvironment.404.njk +5 -0
  36. package/dist/src/views/errors/getMock.404.njk +5 -0
  37. package/dist/src/views/errors/getMonitor.404.njk +5 -0
  38. package/dist/src/views/errors/getSpec.404.njk +5 -0
  39. package/dist/src/views/errors/getWorkspace.404.njk +5 -0
  40. package/dist/src/views/getWorkspaces.njk +3 -3
  41. package/package.json +24 -24
  42. package/dist/src/tools/deletePanElementOrFolder.js +0 -41
  43. package/dist/src/tools/postPanElementOrFolder.js +0 -84
  44. package/dist/src/tools/updatePanElementOrFolder.js +0 -100
package/README.md CHANGED
@@ -590,6 +590,38 @@ To install the MCP server as a Gemini CLI extension, run the following command i
590
590
  gemini extensions install https://github.com/postmanlabs/postman-mcp-server
591
591
  ```
592
592
 
593
+ ### Install in Kiro
594
+
595
+ To use the Postman MCP Server in Kiro, you can use one of the following methods:
596
+
597
+ To set up the Postman MCP Server with one-click, see [API Testing with Postman](https://kiro.dev/powers/) on the Kiro Powers page. Click **Add to Kiro**.
598
+
599
+ To install the Postman MCP Server manually, do the following:
600
+
601
+ 1. Launch Kiro and click the Kiro ghost icon in the left sidebar.
602
+ 1. Add an MCP Server and select either **User Config** or **Workspace Config** to install the Postman MCP server.
603
+ 1. Add the following JSON block to the `mcp.json` configuration file:
604
+
605
+ ```json wordWrap
606
+ {
607
+ "mcpServers": {
608
+ "postman": {
609
+ "command": "npx",
610
+ "args": [
611
+ "@postman/postman-mcp-server"
612
+ ],
613
+ "env": {
614
+ "POSTMAN_API_KEY": "postman-api-key"
615
+ },
616
+ "disabled": false,
617
+ "autoApprove": [
618
+ "getAuthenticatedUser"
619
+ ]
620
+ }
621
+ }
622
+ }
623
+ ```
624
+
593
625
  ### Install in Docker
594
626
 
595
627
  For Docker set up and installation, see [DOCKER.md](./DOCKER.md).
package/dist/package.json CHANGED
@@ -1,20 +1,22 @@
1
1
  {
2
2
  "name": "@postman/postman-mcp-server",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
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",
7
7
  "type": "module",
8
+ "packageManager": "pnpm@10.6.2",
8
9
  "scripts": {
10
+ "preinstall": "npx only-allow pnpm",
9
11
  "start:stdio": "node dist/src/index.js",
10
12
  "build": "eslint --fix ./src && prettier --write \"src/**/*.ts\" && tsc",
11
- "prepack": "npm run build",
13
+ "prepack": "pnpm run build",
12
14
  "test": "vitest",
13
15
  "lint": "eslint",
14
16
  "lint:fix": "eslint --fix",
15
- "preversion": "npm run build",
17
+ "preversion": "pnpm run build",
16
18
  "version": "git add dist/",
17
- "release": "npm version",
19
+ "release": "pnpm version",
18
20
  "release-custom": "node scripts/release.js"
19
21
  },
20
22
  "bin": "dist/src/index.js",
@@ -27,23 +29,23 @@
27
29
  "access": "public"
28
30
  },
29
31
  "dependencies": {
30
- "@modelcontextprotocol/sdk": "^1.25.2",
31
- "dotenv": "^17.2.3",
32
- "newman": "^6.2.0",
32
+ "@modelcontextprotocol/sdk": "^1.27.1",
33
+ "dotenv": "^17.3.1",
34
+ "newman": "^6.2.2",
33
35
  "nunjucks": "^3.2.4",
34
36
  "uuid": "^13.0.0",
35
37
  "zod": "^3.25.76"
36
38
  },
37
39
  "devDependencies": {
38
- "@eslint/js": "^9.39.1",
40
+ "@eslint/js": "^10.0.1",
39
41
  "@types/node": "^24",
40
- "eslint": "^9.39.1",
42
+ "eslint": "^10.0.2",
41
43
  "eslint-config-prettier": "^10.1.8",
42
- "eslint-plugin-unused-imports": "^4.3.0",
43
- "prettier": "^3.6.2",
44
+ "eslint-plugin-unused-imports": "^4.4.1",
45
+ "prettier": "^3.8.1",
44
46
  "typescript": "^5.9.3",
45
- "typescript-eslint": "^8.48.0",
46
- "vitest": "^4.0.13"
47
+ "typescript-eslint": "^8.56.1",
48
+ "vitest": "^4.0.18"
47
49
  },
48
50
  "engines": {
49
51
  "node": ">=20.0.0"
@@ -94,10 +94,12 @@ export class PostmanAPIClient {
94
94
  case 403:
95
95
  throw new McpError(ErrorCode.InvalidParams, `API request failed: ${response.status} ${errorText}`, {
96
96
  cause: errorText,
97
+ httpStatus: response.status,
97
98
  });
98
99
  default:
99
100
  throw new McpError(ErrorCode.InternalError, `API request failed: ${response.status}`, {
100
101
  cause: errorText,
102
+ httpStatus: response.status,
101
103
  });
102
104
  }
103
105
  }
@@ -92,11 +92,11 @@ const full = [
92
92
  'updateWorkspaceGlobalVariables',
93
93
  'getWorkspaceTags',
94
94
  'updateWorkspaceTags',
95
- 'getAllElementsAndFolders',
96
- 'getAllPanAddElementRequests',
97
- 'deletePanElementOrFolder',
98
- 'postPanElementOrFolder',
99
- 'updatePanElementOrFolder',
95
+ 'listPrivateNetworkWorkspaces',
96
+ 'listPrivateNetworkAddRequests',
97
+ 'removeWorkspaceFromPrivateNetwork',
98
+ 'addWorkspaceToPrivateNetwork',
99
+ 'respondPrivateNetworkAddRequest',
100
100
  'publishDocumentation',
101
101
  'unpublishDocumentation',
102
102
  'getAsyncSpecTaskStatus',
@@ -112,7 +112,10 @@ const full = [
112
112
  'deleteApiCollectionComment',
113
113
  'deleteSpecFile',
114
114
  'getEnabledTools',
115
- 'searchPostmanElements',
115
+ 'searchPostmanElementsInPublicNetwork',
116
+ 'searchPostmanElementsInPrivateNetwork',
117
+ 'getAnalyticsData',
118
+ 'getAnalyticsMetadata',
116
119
  ];
117
120
  const minimal = [
118
121
  'createCollection',
@@ -152,7 +155,7 @@ const minimal = [
152
155
  'createCollectionRequest',
153
156
  'createCollectionResponse',
154
157
  'duplicateCollection',
155
- 'getStatusOfAnAsyncApiTask',
158
+ 'getDuplicateCollectionTaskStatus',
156
159
  'runCollection',
157
160
  'getEnabledTools',
158
161
  'updateCollectionRequest',
@@ -161,7 +164,7 @@ const code = [
161
164
  'getCodeGenerationInstructions',
162
165
  'getWorkspace',
163
166
  'getWorkspaces',
164
- 'searchPostmanElements',
167
+ 'searchPostmanElementsInPublicNetwork',
165
168
  'getCollectionRequest',
166
169
  'getCollectionResponse',
167
170
  'getCollectionFolder',
@@ -169,6 +172,7 @@ const code = [
169
172
  'getCollection',
170
173
  'getEnvironment',
171
174
  'getEnvironments',
175
+ 'searchPostmanElementsInPrivateNetwork',
172
176
  ];
173
177
  const excludedFromGeneration = [
174
178
  'runCollection',
@@ -176,7 +180,8 @@ const excludedFromGeneration = [
176
180
  'getCodeGenerationInstructions',
177
181
  'getCollectionMap',
178
182
  'getCollection',
179
- 'searchPostmanElements',
183
+ 'searchPostmanElementsInPublicNetwork',
184
+ 'searchPostmanElementsInPrivateNetwork',
180
185
  ];
181
186
  const subtools = {
182
187
  getCollection: {
package/dist/src/index.js CHANGED
@@ -11,6 +11,7 @@ import { PostmanAPIClient } from './clients/postman.js';
11
11
  import { SERVER_NAME, APP_VERSION } from './constants.js';
12
12
  import { env } from './env.js';
13
13
  import { createTemplateRenderer } from './tools/utils/templateRenderer.js';
14
+ import { createErrorTemplateRenderer } from './tools/utils/errorTemplateRenderer.js';
14
15
  const SUPPORTED_REGIONS = {
15
16
  us: 'https://api.postman.com',
16
17
  eu: 'https://api.eu.postman.com',
@@ -148,6 +149,8 @@ async function run() {
148
149
  const __dirname = dirname(__filename);
149
150
  const viewsDir = join(__dirname, './views');
150
151
  const renderTemplate = createTemplateRenderer(viewsDir);
152
+ const errorsDir = join(__dirname, './views/errors');
153
+ const renderErrorTemplate = createErrorTemplateRenderer(errorsDir);
151
154
  const client = new PostmanAPIClient(apiKey, undefined, serverContext);
152
155
  log('info', 'Registering tools with McpServer');
153
156
  for (const tool of tools) {
@@ -184,8 +187,33 @@ async function run() {
184
187
  catch (error) {
185
188
  const errMsg = String(error?.message || error);
186
189
  logBoth(server, 'error', `Tool invocation failed: ${toolName}: ${errMsg}`, { toolName });
187
- if (error instanceof McpError)
190
+ if (error instanceof McpError) {
191
+ const httpStatus = error.data?.httpStatus;
192
+ if (typeof httpStatus === 'number') {
193
+ const rawBody = String(error.data?.cause ?? '');
194
+ let parsedBody = null;
195
+ try {
196
+ parsedBody = JSON.parse(rawBody);
197
+ }
198
+ catch {
199
+ }
200
+ const errorObj = parsedBody?.error && typeof parsedBody.error === 'object'
201
+ ? parsedBody.error
202
+ : parsedBody;
203
+ const rendered = renderErrorTemplate(toolName, httpStatus, {
204
+ toolName,
205
+ statusCode: httpStatus,
206
+ args,
207
+ errorMessage: error.message,
208
+ errorBody: rawBody,
209
+ error: errorObj,
210
+ });
211
+ if (rendered) {
212
+ throw new McpError(error.code, rendered, error.data);
213
+ }
214
+ }
188
215
  throw error;
216
+ }
189
217
  throw new McpError(ErrorCode.InternalError, `API error: ${error.message}`);
190
218
  }
191
219
  });
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ import { ContentType } from '../clients/postman.js';
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
4
+ export const method = 'addWorkspaceToPrivateNetwork';
5
+ export const description = "Publishes a workspace to your team's Private API Network.\n\nWARNING: This tool is for Private API Network management, not for general workspace operations. For workspace management use: getWorkspaces, getWorkspace, createWorkspace, updateWorkspace, deleteWorkspace.\n";
6
+ export const parameters = z.object({
7
+ workspace: z.object({
8
+ id: z.string().describe("The workspace's ID."),
9
+ parentFolderId: z.number().int().describe('The `0` value.').default(0),
10
+ }),
11
+ });
12
+ export const annotations = {
13
+ title: "Publishes a workspace to your team's Private API Network.",
14
+ readOnlyHint: false,
15
+ destructiveHint: false,
16
+ idempotentHint: false,
17
+ };
18
+ export async function handler(args, extra) {
19
+ try {
20
+ const endpoint = `/network/private`;
21
+ const query = new URLSearchParams();
22
+ const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
23
+ const bodyPayload = {};
24
+ if (args.workspace !== undefined)
25
+ bodyPayload.workspace = args.workspace;
26
+ const options = {
27
+ body: JSON.stringify(bodyPayload),
28
+ contentType: ContentType.Json,
29
+ headers: extra.headers,
30
+ };
31
+ const result = await extra.client.post(url, options);
32
+ return {
33
+ content: [
34
+ {
35
+ type: 'text',
36
+ text: `${typeof result === 'string' ? result : JSON.stringify(result, null, 2)}`,
37
+ },
38
+ ],
39
+ };
40
+ }
41
+ catch (e) {
42
+ if (e instanceof McpError) {
43
+ throw e;
44
+ }
45
+ throw asMcpError(e);
46
+ }
47
+ }