@postman/postman-mcp-server 2.4.9 → 2.5.2

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/README.md CHANGED
@@ -6,6 +6,7 @@ Postman supports the following tool configurations:
6
6
 
7
7
  * **Minimal** — (Default) Only includes essential tools for basic Postman operations This offers faster performance and simplifies use for those who only need basic Postman operations. Ideal for users who want to modify a single Postman elements, such as collections, workspaces, or environments.
8
8
  * **Full** — Includes all available Postman API tools (100+ tools). This configuration is ideal for users who engage in advanced collaboration and Postman's Enterprise features.
9
+ * **Code** — Includes tools to generate high-quality, well-organized client code from public and internal API definitions. This configuration is ideal for users who need to consume APIs or simply get context about APIs to their agents.
9
10
 
10
11
  For a complete list of the Postman MCP Server's tools, see the [Postman MCP Server collection](https://www.postman.com/postman/postman-public-workspace/collection/681dc649440b35935978b8b7). This collection offers both the remote [full](https://www.postman.com/postman/postman-public-workspace/mcp-request/6821a76b17ccb90a86df48d3) and [minimal](https://www.postman.com/postman/postman-public-workspace/mcp-request/689e1c635be722a98b723238) servers, and the [local server](https://www.postman.com/postman/postman-public-workspace/mcp-request/6866a655b36c67cc435b5033).
11
12
 
@@ -15,12 +16,14 @@ Postman also offers servers as an [npm package](https://www.npmjs.com/package/@p
15
16
 
16
17
  ### Use Cases
17
18
 
19
+ * **API Testing** - Continuously test your API using your Postman collection.
18
20
  * **Code synchronization** - Effortlessly keep your code in sync with your [Postman Collections](https://learning.postman.com/docs/design-apis/collections/overview/) and specs.
19
21
  * **Collection management** - Create and [tag](https://learning.postman.com/docs/collections/use-collections/collaborate-with-collections/#tag-a-collection) collections, update collection and request [documentation](https://learning.postman.com/docs/publishing-your-api/api-documentation-overview/), add [comments](https://learning.postman.com/docs/collaborating-in-postman/comments/), or perform actions across multiple collections without leaving your editor.
20
22
  * **Workspace and environment management** - Create [workspaces](https://learning.postman.com/docs/collaborating-in-postman/using-workspaces/overview/) and [environments](https://learning.postman.com/docs/sending-requests/variables/managing-environments/), plus manage your environment variables.
21
23
  * **Automatic spec creation** - Create [specs](https://learning.postman.com/docs/design-apis/specifications/overview/) from your code and use them to generate collections.
24
+ * **Client code generation** - Generate production-ready client code that consumes APIs following best practices and project conventions. The `code` toolset produces code that precisely matches your API definitions, organizes it into an intuitive tree structure mirroring your Postman collections and requests, and leverages example responses to create accurate response types and error handling.
22
25
 
23
- Designed for developers who want to integrate their AI tools with Postmans context and features. Supports quick natural language queries queries to advanced agent workflows.
26
+ Designed for developers who want to integrate their AI tools with Postman's context and features. Supports quick natural language queries to advanced agent workflows.
24
27
 
25
28
  ### Support for EU
26
29
 
@@ -55,6 +58,7 @@ The remote Postman MCP Server is hosted by Postman over streamable HTTP and prov
55
58
  The remote server supports the following tool configurations:
56
59
 
57
60
  * **Minimal** — (Default) Only includes essential tools for basic Postman operations, available at `https://mcp.postman.com/minimal` and `https://mcp.eu.postman.com/minimal` for EU users.
61
+ * **Code** — Includes tools for searching public and internal API definitions and generating client code, available at `https://mcp.postman.com/code` and `https://mcp.eu.postman.com/code` for EU users.
58
62
  * **Full** — Includes all available Postman API tools (100+ tools), available at `https://mcp.postman.com/mcp` and `https://mcp.eu.postman.com/mcp` for EU users.
59
63
 
60
64
  ### Install in Cursor
@@ -65,7 +69,7 @@ To install the remote Postman MCP Server in Cursor, click the install button.
65
69
 
66
70
  **Note:** Ensure that the Authorization header uses the `Bearer <YOUR_API_KEY>` format.
67
71
 
68
- By default, the server uses **Minimal** mode. To access **Full** mode, change the `url` value to `https://mcp.postman.com/mcp` in the `mcp.json` file.
72
+ By default, the server uses **Minimal** mode. To access **Full** mode, change the `url` value to `https://mcp.postman.com/mcp` in the `mcp.json` file. To access **Code** mode, change the value to `https://mcp.postman.com/code`.
69
73
 
70
74
  ### Install in Visual Studio Code
71
75
 
@@ -73,7 +77,7 @@ By default, the server uses **Minimal** mode. To access **Full** mode, change th
73
77
 
74
78
  To install the remote Postman MCP Server in VS Code, click the install button or use the [Postman VS Code Extension](https://marketplace.visualstudio.com/items?itemName=Postman.postman-for-vscode).
75
79
 
76
- By default, the server uses **Minimal** mode. To access **Full** mode, change the `url` value to `https://mcp.postman.com/mcp` in the `mcp.json` file.
80
+ By default, the server uses **Minimal** mode. To access **Full** mode, change the `url` value to `https://mcp.postman.com/mcp` in the `mcp.json` file. To access **Code** mode, change the value to `https://mcp.postman.com/code`.
77
81
 
78
82
  #### Manual configuration
79
83
 
@@ -84,8 +88,7 @@ You can use the Postman MCP Server with MCP-compatible extensions in VS Code, su
84
88
  "servers": {
85
89
  "postman-api-http-server": {
86
90
  "type": "http",
87
- "url": "https://mcp.postman.com/{minimal OR mcp}",
88
- // Use "https://mcp.postman.com/mcp" for full or "https://mcp.postman.com/minimal" for minimal mode.
91
+ "url": "https://mcp.postman.com/{minimal OR code OR mcp}",
89
92
  // For the EU server, use the "https://mcp.eu.postman.com" URL.
90
93
  "headers": {
91
94
  "Authorization": "Bearer ${input:postman-api-key}"
@@ -114,6 +117,12 @@ For **Minimal** mode:
114
117
  claude mcp add --transport http postman https://mcp.postman.com/minimal --header "Authorization: Bearer <POSTMAN_API_KEY>"
115
118
  ```
116
119
 
120
+ For **Code** mode:
121
+
122
+ ```bash
123
+ claude mcp add --transport http postman https://mcp.postman.com/code --header "Authorization: Bearer <POSTMAN_API_KEY>"
124
+ ```
125
+
117
126
  For **Full** mode:
118
127
 
119
128
  ```bash
@@ -133,6 +142,7 @@ STDIO is a lightweight solution that's ideal for integration with editors and to
133
142
  The local server supports the following tool configurations:
134
143
 
135
144
  * **Minimal** — (Default) Only includes essential tools for basic Postman operations.
145
+ * **Code** — Includes tools for searching public and internal API definitions and generating client code
136
146
  * **Full** — Includes all available Postman API tools (100+ tools). Use the `--full` flag to enable this configuration.
137
147
 
138
148
  **Note:** Use the `--region` flag to specify the Postman API region (`us` or `eu`), or set the `POSTMAN_API_BASE_URL` environment variable directly. By default, the server uses the `us` option.
@@ -144,7 +154,7 @@ The local server supports the following tool configurations:
144
154
 
145
155
  To install the local Postman MCP Server in VS Code, click the install button.
146
156
 
147
- By default, the server uses **Full** mode. To access **Minimal** mode, remove the `--full` flag from the `mcp.json` configuration file.
157
+ By default, the server uses **Full** mode. To access **Minimal** mode, remove the `--full` flag from the `mcp.json` configuration file. To access **Code** mode, replace the `--full` flag with `--code`.
148
158
 
149
159
  #### Manual configuration
150
160
 
@@ -158,7 +168,8 @@ You can manually integrate your MCP server with Cursor or VS Code to use it with
158
168
  "command": "npx",
159
169
  "args": [
160
170
  "@postman/postman-mcp-server",
161
- "--full" // (optional) Use this flag to enable full mode.
171
+ "--full", // (optional) Use this flag to enable full mode...
172
+ "--code", // (optional) ...OR this flag to enable code mode.
162
173
  "--region us" // (optional) Use this flag to specify the Postman API region (us or eu). Defaults to us.
163
174
  ],
164
175
  "env": {
@@ -182,14 +193,15 @@ You can manually integrate your MCP server with Cursor or VS Code to use it with
182
193
 
183
194
  To install the local Postman MCP Server in Cursor, click the install button.
184
195
 
185
- By default, the server uses **Full** mode. To access **Minimal** mode, remove the `--full` flag from the `mcp.json` configuration file.
196
+ By default, the server uses **Full** mode. To access **Minimal** mode, remove the `--full` flag from the `mcp.json` configuration file. To access **Code** mode, replace the `--full` flag with `--code`.
186
197
 
187
198
  ### Claude integration
188
199
 
189
200
  To integrate the MCP server with Claude, check the latest [Postman MCP Server release](https://github.com/postmanlabs/postman-mcp-server/releases) and get the `.mcpb` file.
190
201
 
191
- * **Minimal** - `postman-api-mcp-minimal.mcpb`
192
- * **Full** - `postman-api-mcp-full.mcpb`
202
+ * **Minimal** - `postman-mcp-server-minimal.mcpb`
203
+ * **Full** - `postman-mcp-server-full.mcpb`
204
+ * **Code** - `postman-mcp-server-code.mcpb`
193
205
 
194
206
  For more information, see the [Claude Desktop Extensions](https://www.anthropic.com/engineering/desktop-extensions) documentation.
195
207
 
@@ -203,6 +215,12 @@ For **Minimal** mode:
203
215
  claude mcp add postman --env POSTMAN_API_KEY=YOUR_KEY -- npx @postman/postman-mcp-server@latest
204
216
  ```
205
217
 
218
+ For **Code** mode:
219
+
220
+ ```bash
221
+ claude mcp add postman --env POSTMAN_API_KEY=YOUR_KEY -- npx @postman/postman-mcp-server@latest --code
222
+ ```
223
+
206
224
  For **Full** mode:
207
225
 
208
226
  ```bash
@@ -239,7 +257,6 @@ If you're migrating from Postman MCP Server version 1.x to 2.x, be aware of the
239
257
 
240
258
  ## Questions and support
241
259
 
242
- * See the [Postman Agent Generator](https://postman.com/explore/agent-generator) page for updates and new capabilities.
243
260
  * See [Add your MCP requests to your collections](https://learning.postman.com/docs/postman-ai-agent-builder/mcp-requests/overview/) to learn how to use Postman to perform MCP requests.
244
261
  * Visit the [Postman Community](https://community.postman.com/) to share what you've built, ask questions, and get help.
245
262
  * You can connect to both the remote and local servers and test them using the [Postman MCP Server collection](https://www.postman.com/postman/postman-public-workspace/collection/681dc649440b35935978b8b7).
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postman/postman-mcp-server",
3
- "version": "2.4.9",
3
+ "version": "2.5.2",
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"
@@ -8,10 +8,12 @@ export var ContentType;
8
8
  export class PostmanAPIClient {
9
9
  baseUrl;
10
10
  apiKey;
11
+ serverContext;
11
12
  static instance = null;
12
- constructor(apiKey, baseUrl = process.env.POSTMAN_API_BASE_URL || 'https://api.postman.com') {
13
+ constructor(apiKey, baseUrl = process.env.POSTMAN_API_BASE_URL || 'https://api.postman.com', serverContext) {
13
14
  this.apiKey = apiKey;
14
15
  this.baseUrl = baseUrl;
16
+ this.serverContext = serverContext;
15
17
  }
16
18
  static getInstance(apiKey, baseUrl) {
17
19
  if (!PostmanAPIClient.instance) {
@@ -45,7 +47,10 @@ export class PostmanAPIClient {
45
47
  const contentType = options.contentType || ContentType.Json;
46
48
  const userAgentKey = Object.keys(options.headers ?? {}).find((key) => key.toLowerCase() === 'user-agent');
47
49
  const userAgentValue = userAgentKey ? options.headers?.[userAgentKey] : undefined;
48
- const userAgentHeader = userAgentValue ? `${userAgentValue}/${USER_AGENT}` : USER_AGENT;
50
+ let userAgentHeader = userAgentValue ? `${userAgentValue}/${USER_AGENT}` : USER_AGENT;
51
+ if (this.serverContext?.serverType) {
52
+ userAgentHeader = `${userAgentHeader} (toolset: ${this.serverContext.serverType})`;
53
+ }
49
54
  const disallowed = new Set([
50
55
  'content-length',
51
56
  'transfer-encoding',
@@ -2,3 +2,4 @@ import packageJson from '../package.json' with { type: 'json' };
2
2
  export const SERVER_NAME = packageJson.name;
3
3
  export const APP_VERSION = packageJson.version;
4
4
  export const USER_AGENT = `${packageJson.name}/${packageJson.version}`;
5
+ export const RUNNER_ACCEPT_HEADER = 'application/vnd.postman.v2+json';
@@ -35,6 +35,7 @@ const full = [
35
35
  'getCollectionResponse',
36
36
  'updateCollectionResponse',
37
37
  'transferCollectionResponses',
38
+ 'runCollection',
38
39
  'createCollectionComment',
39
40
  'deleteCollectionComment',
40
41
  'getCollectionComments',
@@ -102,6 +103,7 @@ const full = [
102
103
  'getStatusOfAnAsyncApiTask',
103
104
  'getAuthenticatedUser',
104
105
  'getTaggedEntities',
106
+ 'getCodeGenerationInstructions',
105
107
  'transferCollectionFolders',
106
108
  'transferCollectionResponses',
107
109
  'transferCollectionResponses',
@@ -110,7 +112,7 @@ const full = [
110
112
  'deleteApiCollectionComment',
111
113
  'deleteSpecFile',
112
114
  'getEnabledTools',
113
- 'runCollection',
115
+ 'searchPostmanElements',
114
116
  ];
115
117
  const minimal = [
116
118
  'createCollection',
@@ -154,9 +156,36 @@ const minimal = [
154
156
  'runCollection',
155
157
  'getEnabledTools',
156
158
  ];
157
- const excludedFromGeneration = ['runCollection', 'getEnabledTools'];
159
+ const code = [
160
+ 'getCodeGenerationInstructions',
161
+ 'getWorkspace',
162
+ 'getWorkspaces',
163
+ 'searchPostmanElements',
164
+ 'getCollectionRequest',
165
+ 'getCollectionResponse',
166
+ 'getCollectionFolder',
167
+ 'getAuthenticatedUser',
168
+ 'getCollectionMap',
169
+ 'getEnvironment',
170
+ 'getEnvironments',
171
+ ];
172
+ const excludedFromGeneration = [
173
+ 'runCollection',
174
+ 'getEnabledTools',
175
+ 'getCodeGenerationInstructions',
176
+ 'getCollectionMap',
177
+ 'getCollection',
178
+ ];
179
+ const subtools = {
180
+ getCollection: {
181
+ orchestrator: 'getCollection',
182
+ subtools: ['getCollection', 'getCollectionMap'],
183
+ },
184
+ };
158
185
  export const enabledResources = {
159
186
  full,
160
187
  minimal,
188
+ code,
161
189
  excludedFromGeneration,
190
+ subtools,
162
191
  };
package/dist/src/index.js CHANGED
@@ -97,6 +97,7 @@ let clientInfo = undefined;
97
97
  async function run() {
98
98
  const args = process.argv.slice(2);
99
99
  const useFull = args.includes('--full');
100
+ const useCode = args.includes('--code');
100
101
  const regionIndex = args.findIndex((arg) => arg === '--region');
101
102
  if (regionIndex !== -1 && regionIndex + 1 < args.length) {
102
103
  const region = args[regionIndex + 1];
@@ -126,7 +127,8 @@ async function run() {
126
127
  });
127
128
  const fullTools = allGeneratedTools.filter((t) => enabledResources.full.includes(t.method));
128
129
  const minimalTools = allGeneratedTools.filter((t) => enabledResources.minimal.includes(t.method));
129
- const tools = useFull ? fullTools : minimalTools;
130
+ const codeTools = allGeneratedTools.filter((t) => enabledResources.code.includes(t.method));
131
+ const tools = useCode ? codeTools : useFull ? fullTools : minimalTools;
130
132
  const server = new McpServer({ name: SERVER_NAME, version: APP_VERSION });
131
133
  server.onerror = (error) => {
132
134
  const msg = String(error?.message || error);
@@ -137,11 +139,11 @@ async function run() {
137
139
  await server.close();
138
140
  process.exit(0);
139
141
  });
140
- const client = new PostmanAPIClient(apiKey);
141
142
  const serverContext = {
142
- serverType: useFull ? 'full' : 'minimal',
143
+ serverType: useCode ? 'code' : useFull ? 'full' : 'minimal',
143
144
  availableTools: tools.map((t) => t.method),
144
145
  };
146
+ const client = new PostmanAPIClient(apiKey, undefined, serverContext);
145
147
  log('info', 'Registering tools with McpServer');
146
148
  for (const tool of tools) {
147
149
  server.tool(tool.method, tool.description, tool.parameters.shape, tool.annotations || {}, async (args, extra) => {
@@ -182,7 +184,8 @@ async function run() {
182
184
  }
183
185
  };
184
186
  await server.connect(transport);
185
- logBoth(server, 'info', `Server connected and ready: ${SERVER_NAME}@${APP_VERSION} with ${tools.length} tools (${useFull ? 'full' : 'minimal'})`);
187
+ const toolsetName = useCode ? 'code' : useFull ? 'full' : 'minimal';
188
+ logBoth(server, 'info', `Server connected and ready: ${SERVER_NAME}@${APP_VERSION} with ${tools.length} tools (${toolsetName})`);
186
189
  }
187
190
  run().catch((error) => {
188
191
  log('error', 'Unhandled error during server execution', {