@postman/postman-mcp-server 2.3.7 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,43 +4,47 @@ The Postman MCP Server connects Postman to AI tools, giving AI agents and assist
4
4
 
5
5
  Postman supports the following tool configurations:
6
6
 
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
- - **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.
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
+ * **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
+
10
+ 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
+ Postman also offers servers as an [npm package](https://www.npmjs.com/package/@postman/postman-mcp-server).
13
+
14
+ **Note:** Before getting started, ensure that you have a valid [Postman API key](https://postman.postman.co/settings/me/api-keys).
9
15
 
10
16
  ### Use Cases
11
17
 
12
- - **Code synchronization** - Effortlessly keep your code in sync with your Postman collections and specs.
13
- - **Collection management** - Create and tag collections, update collection and request documentation, add comments, or perform actions across multiple collections without leaving your editor.
14
- - **Workspace and environment management** - Create workspaces and environments, plus manage your environment variables.
15
- - **Automatic spec creation** - Create [specs](https://learning.postman.com/docs/design-apis/specifications/overview/) from your code and use them to generate Postman collections.
18
+ * **Code synchronization** - Effortlessly keep your code in sync with your [Postman Collections](https://learning.postman.com/docs/design-apis/collections/overview/) and specs.
19
+ * **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
+ * **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
+ * **Automatic spec creation** - Create [specs](https://learning.postman.com/docs/design-apis/specifications/overview/) from your code and use them to generate collections.
16
22
 
17
23
  Designed for developers who want to integrate their AI tools with Postman’s context and features. Supports quick natural language queries queries to advanced agent workflows.
18
24
 
19
25
  ### Support for EU
20
26
 
21
27
  The Postman MCP Server supports the EU region for remote and local servers:
22
- - For streamable HTTP, the remote server is available at `https://mcp.eu.postman.com`.
23
- - For our STDIO public package, use the `--region` flag to specify the Postman API region (`us` or `eu`), or set the `POSTMAN_API_BASE_URL` environment variable directly.
28
+ * For streamable HTTP, the remote server is available at `https://mcp.eu.postman.com`.
29
+ * For our STDIO public package, use the `--region` flag to specify the Postman API region (`us` or `eu`), or set the `POSTMAN_API_BASE_URL` environment variable directly.
24
30
 
25
31
  ---
26
32
 
27
33
  ### Contents
28
34
 
29
- - [**Remote server**](#remote-server)
30
- - [**Prerequisites**](#prerequisites)
31
- - [**VS Code**](#install-in-vs-code)
32
- - [**Cursor**](#install-in-cursor)
33
- - [**Claude Code**](#install-in-claude-code)
34
- - [**Local server**](#local-server)
35
- - [**Prerequisites**](#prerequisites-1)
36
- - [**Configuration**](#configuration)
37
- - [**VS Code**](#install-in-vs-code-1)
38
- - [**Cursor**](#install-in-cursor-1)
39
- - [**Claude**](#claude-integration)
40
- - [**Claude Code**](#install-in-claude-code-1)
41
- - [**Gemini CLI**](#use-as-a-gemini-cli-extension)
42
- - [**Questions and support**](#questions-and-support)
43
- - [**Migration from Postman MCP Server v1 to v2**](#migration-from-v1x-to-v2x)
35
+ * [**Remote server**](#remote-server)
36
+ * [**VS Code**](#install-in-visual-studio-code)
37
+ * [**Cursor**](#install-in-cursor)
38
+ * [**Claude Code**](#install-in-claude-code)
39
+ * [**Local server**](#local-server)
40
+ * [**VS Code**](#install-in-visual-studio-code-1)
41
+ * [**Cursor**](#install-in-cursor-1)
42
+ * [**Claude**](#claude-integration)
43
+ * [**Claude Code**](#install-in-claude-code-1)
44
+ * [**Gemini CLI**](#use-as-a-gemini-cli-extension)
45
+ * [**Docker**](#install-in-docker)
46
+ * [**Questions and support**](#questions-and-support)
47
+ * [**Migration from Postman MCP Server v1 to v2**](#migration-from-v1x-to-v2x)
44
48
 
45
49
  ---
46
50
 
@@ -50,33 +54,39 @@ The remote Postman MCP Server is hosted by Postman over streamable HTTP and prov
50
54
 
51
55
  The remote server supports the following tool configurations:
52
56
 
53
- - **Minimal** — (Default) Only includes essential tools for basic Postman operations, available at `https://mcp.postman.com/minimal`.
54
- - **Full** — Includes all available Postman API tools (100+ tools), available at `https://mcp.postman.com/mcp`.
57
+ * **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.
58
+ * **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
+
60
+ ### Install in Cursor
61
+
62
+ [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=postman_mcp_server&config=eyJ1cmwiOiJodHRwczovL21jcC5wb3N0bWFuLmNvbS9taW5pbWFsIiwiaGVhZGVycyI6eyJBdXRob3JpemF0aW9uIjoiQmVhcmVyIFlPVVJfQVBJX0tFWSJ9fQ%3D%3D)
55
63
 
56
- **Note:** The remote EU HTTP server is available at `https://mcp.eu.postman.com`.
64
+ To install the remote Postman MCP Server in Cursor, click the install button.
57
65
 
58
- ### Prerequisites
66
+ **Note:** Ensure that the Authorization header uses the `Bearer <YOUR_API_KEY>` format.
59
67
 
60
- Before getting started, make certain you have a valid [Postman API Key](https://postman.postman.co/settings/me/api-keys).
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.
61
69
 
62
- ### Install in VS Code
70
+ ### Install in Visual Studio Code
63
71
 
64
72
  [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=postman_mcp_server&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fmcp.postman.com%2Fminimal%22%2C%22headers%22%3A%7B%22Authorization%22%3A%22Bearer%20YOUR_API_KEY%22%7D%7D)
65
73
 
66
- To install the remote Postman MCP Server in Visual Studio Code, click the install button or use the [Postman VS Code Extension](https://marketplace.visualstudio.com/items?itemName=Postman.postman-for-vscode).
74
+ 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).
67
75
 
68
- **Note:** By default, the server provides 37 tools. Use full mode (`https://mcp.postman.com/mcp`) to access all 106 tools.
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.
69
77
 
70
78
  #### Manual configuration
71
79
 
72
- To manually configure the remote Postman MCP Server in VS Code, add the following JSON block to the *.vscode/mcp.json* file:
80
+ You can use the Postman MCP Server with MCP-compatible extensions in VS Code, such as GitHub Copilot, Claude for VS Code, or other AI assistants that support MCP. To do so, add the following JSON block to the `.vscode/mcp.json` configuration file:
73
81
 
74
82
  ```json
75
83
  {
76
84
  "servers": {
77
85
  "postman-api-http-server": {
78
86
  "type": "http",
79
- "url": "https://mcp.postman.com/{minimal | mcp}", // use "minimal" (default) or "mcp" (full)
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.
89
+ // For the EU server, use the "https://mcp.eu.postman.com" URL.
80
90
  "headers": {
81
91
  "Authorization": "Bearer ${input:postman-api-key}"
82
92
  }
@@ -92,27 +102,20 @@ To manually configure the remote Postman MCP Server in VS Code, add the followin
92
102
  }
93
103
  ```
94
104
 
95
- When prompted, enter your Postman API key. Afterwards, the agent performs calls to the Postman cloud MCP server at `https://mcp.postman.com`.
96
-
97
- ### Install in Cursor
98
-
99
- [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=postman_mcp_server&config=eyJ1cmwiOiJodHRwczovL21jcC5wb3N0bWFuLmNvbS9taW5pbWFsIiwiaGVhZGVycyI6eyJBdXRob3JpemF0aW9uIjoiQmVhcmVyIFlPVVJfQVBJX0tFWSJ9fQ%3D%3D)
100
-
101
- To install the remote Postman MCP Server in Cursor, click the install button.
102
-
103
- **Note:** Ensure that the Authorization header uses the `Bearer <YOUR_API_KEY>` format.
105
+ When prompted, enter your Postman API key.
104
106
 
105
107
  ### Install in Claude Code
106
108
 
107
109
  To install the MCP server in Claude Code, run the following command in your terminal:
108
110
 
109
- **Minimal**
111
+ For **Minimal** mode:
110
112
 
111
113
  ```bash
112
114
  claude mcp add --transport http postman https://mcp.postman.com/minimal
113
115
  ```
114
116
 
115
- **Full**
117
+ For **Full** mode:
118
+
116
119
  ```bash
117
120
  claude mcp add --transport http postman https://mcp.postman.com/mcp
118
121
  ```
@@ -125,42 +128,27 @@ If remote MCP servers aren't supported by your MCP host, you can install the Pos
125
128
 
126
129
  STDIO is a lightweight solution that's ideal for integration with editors and tools like Visual Studio Code. Install an MCP-compatible VS Code extension, such as GitHub Copilot, Claude for VS Code, or other AI assistants that support MCP.
127
130
 
128
- **Note:** For Docker set up and installation, see [DOCKER.md](./DOCKER.md).
131
+ **Note:** To run the server as a Node application, install [Node.js](https://nodejs.org/en).
129
132
 
130
133
  The local server supports the following tool configurations:
131
134
 
132
- - **Minimal** — (Default) Only includes essential tools for basic Postman operations.
133
- - **Full** — Includes all available Postman API tools (100+ tools). Use the `--full` flag to enable this configuration.
134
-
135
- ### Prerequisites
136
-
137
- Before getting started, you'll need the following:
138
-
139
- 1. To run the server as a Node application, install [Node.js](https://nodejs.org/en).
140
- 1. A valid [Postman API Key](https://postman.postman.co/settings/me/api-keys).
135
+ * **Minimal** — (Default) Only includes essential tools for basic Postman operations.
136
+ * **Full** — Includes all available Postman API tools (100+ tools). Use the `--full` flag to enable this configuration.
141
137
 
142
- ### Configuration
138
+ **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.
143
139
 
144
- To configure the extension to use the local Postman MCP Server, do the following:
145
140
 
146
- 1. Clone the **postman-mcp-server** repository.
147
- 1. In the repository's root folder, run the `npm install` command. This installs all the required dependencies.
148
- 1. Replace `${workspaceFolder}` in the *mcp.json* file with the full path to the Postman MCP repository.
149
- 1. When prompted, enter your Postman API key.
150
-
151
- ### Install in VS Code
141
+ ### Install in Visual Studio Code
152
142
 
153
143
  [![Install with Node in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=postman-api-mcp&inputs=%5B%7B%22id%22%3A%22postman-api-key%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22Enter%20your%20Postman%20API%20key%22%7D%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22%40postman%2Fpostman-mcp-server%22%2C%22--full%22%5D%2C%22env%22%3A%7B%22POSTMAN_API_KEY%22%3A%22%24%7Binput%3Apostman-api-key%7D%22%7D%7D)
154
144
 
155
- To install the local Postman MCP Server in Visual Studio Code, click the install button.
145
+ To install the local Postman MCP Server in VS Code, click the install button.
156
146
 
157
- **Note:**
158
- - By default, this server provides 37 tools (minimal mode). Use the `--full` flag to access all 106 tools.
159
- - 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.
147
+ By default, the server uses **Full** mode. To access **Minimal** mode, remove the `--full` flag from the `mcp.json` configuration file.
160
148
 
161
149
  #### Manual configuration
162
150
 
163
- You can manually integrate your MCP server with VS Code to use it with extensions that support MCP. To do this, create a *.vscode/mcp.json* file in your project and add the following JSON block to it:
151
+ You can manually integrate your MCP server with Cursor or VS Code to use it with extensions that support MCP. To do this, create a `mcp.json` file in your project and add the following JSON block to it:
164
152
 
165
153
  ```json
166
154
  {
@@ -170,7 +158,8 @@ You can manually integrate your MCP server with VS Code to use it with extension
170
158
  "command": "npx",
171
159
  "args": [
172
160
  "@postman/postman-mcp-server",
173
- "--full" // (optional) Use this flag to enable full mode
161
+ "--full" // (optional) Use this flag to enable full mode.
162
+ "--region us" // (optional) Use this flag to specify the Postman API region (us or eu). Defaults to us.
174
163
  ],
175
164
  "env": {
176
165
  "POSTMAN_API_KEY": "${input:postman-api-key}"
@@ -189,32 +178,33 @@ You can manually integrate your MCP server with VS Code to use it with extension
189
178
 
190
179
  ### Install in Cursor
191
180
 
192
- <!-- Does this section require further set up instruction? -->
193
-
194
181
  [![Install with Node in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=postman-api-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAcG9zdG1hbi9wb3N0bWFuLW1jcC1zZXJ2ZXIiLCItLWZ1bGwiXSwiZW52Ijp7IlBPU1RNQU5fQVBJX0tFWSI6IllPVVJfQVBJX0tFWSJ9fQ%3D%3D)
195
182
 
196
183
  To install the local Postman MCP Server in Cursor, click the install button.
197
184
 
185
+ By default, the server uses **Full** mode. To access **Minimal** mode, remove the `--full` flag from the `mcp.json` configuration file.
186
+
198
187
  ### Claude integration
199
188
 
200
189
  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.
201
190
 
202
- * `postman-api-mcp-minimal.mcpb` - Contains the 37 essential tools for common Postman operations.
203
- * `postman-api-mcp-full.mcpb` - Contains all available Postman tools.
191
+ * **Minimal** - `postman-api-mcp-minimal.mcpb`
192
+ * **Full** - `postman-api-mcp-full.mcpb`
204
193
 
205
- For more information, see Anthropic's [Claude Desktop Extensions](https://www.anthropic.com/engineering/desktop-extensions) documentation.
194
+ For more information, see the [Claude Desktop Extensions](https://www.anthropic.com/engineering/desktop-extensions) documentation.
206
195
 
207
196
  ### Install in Claude Code
208
197
 
209
198
  To install the MCP server in Claude Code, run the following command in your terminal:
210
199
 
211
- **Minimal**
200
+ For **Minimal** mode:
212
201
 
213
202
  ```bash
214
203
  claude mcp add postman -- npx @postman/mcp-server@latest
215
204
  ```
216
205
 
217
- **Full**
206
+ For **Full** mode:
207
+
218
208
  ```bash
219
209
  claude mcp add postman -- npx @postman/mcp-server@latest --full
220
210
  ```
@@ -227,25 +217,29 @@ To install the MCP server as a Gemini CLI extension, run the following command i
227
217
  gemini extensions install https://github.com/postmanlabs/postman-mcp-server
228
218
  ```
229
219
 
220
+ ### Install in Docker
221
+
222
+ For Docker set up and installation, see [DOCKER.md](./DOCKER.md).
223
+
230
224
  ---
231
225
 
232
226
  ## Migration from v1.x to v2.x
233
227
 
234
228
  If you're migrating from Postman MCP Server version 1.x to 2.x, be aware of the following:
235
229
 
236
- - **Tool naming changes** - All tool names changed from kebab-case to camelCase. For example:
237
- - `create-collection` → `createCollection`
238
- - `get-workspaces` → `getWorkspaces`
239
- - `delete-environment` → `deleteEnvironment`
240
- - **Tool availability changes**
241
- - The default (minimal) behavior provides only 37 essential tools.
242
- - The `--full` flag provides access to all 106 tools.
230
+ * **Tool naming changes** - All tool names changed from kebab-case to camelCase. For example:
231
+ * `create-collection` → `createCollection`
232
+ * `get-workspaces` → `getWorkspaces`
233
+ * `delete-environment` → `deleteEnvironment`
234
+ * **Tool availability changes**
235
+ * The default (minimal) behavior provides only 37 essential tools.
236
+ * The `--full` flag provides access to all tools.
243
237
 
244
238
  ---
245
239
 
246
240
  ## Questions and support
247
241
 
248
- - See the [Postman Agent Generator](https://postman.com/explore/agent-generator) page for updates and new capabilities.
249
- - 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.
250
- - Visit the [Postman Community](https://community.postman.com/) to share what you've built, ask questions, and get help.
251
- - 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).
242
+ * See the [Postman Agent Generator](https://postman.com/explore/agent-generator) page for updates and new capabilities.
243
+ * 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
+ * Visit the [Postman Community](https://community.postman.com/) to share what you've built, ask questions, and get help.
245
+ * 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,7 +1,8 @@
1
1
  {
2
2
  "name": "@postman/postman-mcp-server",
3
- "version": "2.3.7",
3
+ "version": "2.4.0",
4
4
  "description": "A simple MCP server to operate on the Postman API",
5
+ "mcpName": "com.postman/@postman/postman-mcp-server",
5
6
  "main": "dist/src/index.js",
6
7
  "type": "module",
7
8
  "scripts": {
@@ -30,7 +31,8 @@
30
31
  "@modelcontextprotocol/sdk": "^1.18.1",
31
32
  "dotenv": "^17.2.2",
32
33
  "es-toolkit": "^1.39.10",
33
- "express": "^5.1.0"
34
+ "express": "^5.1.0",
35
+ "newman": "^6.2.1"
34
36
  },
35
37
  "devDependencies": {
36
38
  "@eslint/js": "^9.35.0",
@@ -109,6 +109,7 @@ const full = [
109
109
  'getDuplicateCollectionTaskStatus',
110
110
  'deleteApiCollectionComment',
111
111
  'deleteSpecFile',
112
+ 'runCollection',
112
113
  ];
113
114
  const minimal = [
114
115
  'createCollection',
@@ -149,6 +150,7 @@ const minimal = [
149
150
  'createCollectionResponse',
150
151
  'duplicateCollection',
151
152
  'getStatusOfAnAsyncApiTask',
153
+ 'runCollection',
152
154
  ];
153
155
  const excludedFromGeneration = ['createCollection', 'putCollection'];
154
156
  export const enabledResources = {
@@ -12,6 +12,8 @@ export const parameters = z.object({
12
12
  limit: z
13
13
  .number()
14
14
  .int()
15
+ .gte(1)
16
+ .lte(99)
15
17
  .describe('The maximum number of rows to return in the response.')
16
18
  .optional(),
17
19
  offset: z
@@ -0,0 +1,133 @@
1
+ import { z } from 'zod';
2
+ import { McpError, ErrorCode, } from '@modelcontextprotocol/sdk/types.js';
3
+ import newman from 'newman';
4
+ import { TestTracker, OutputBuilder, buildNewmanOptions } from './utils/runner.js';
5
+ function asMcpError(error) {
6
+ const cause = error?.cause ?? String(error);
7
+ return new McpError(ErrorCode.InternalError, cause);
8
+ }
9
+ export const method = 'runCollection';
10
+ export const description = 'Runs a Postman collection by ID with detailed test results and execution statistics. Supports optional environment for variable substitution. Note: Advanced parameters like custom delays and other runtime options are not yet available.';
11
+ export const parameters = z.object({
12
+ collectionId: z
13
+ .string()
14
+ .describe('The collection ID in the format <OWNER_ID>-<UUID> (e.g. 12345-33823532ab9e41c9b6fd12d0fd459b8b).'),
15
+ environmentId: z
16
+ .string()
17
+ .optional()
18
+ .describe('Optional environment ID to use for variable substitution during the run.'),
19
+ stopOnError: z.boolean().optional().describe('Gracefully halt on errors (default: false)'),
20
+ stopOnFailure: z
21
+ .boolean()
22
+ .optional()
23
+ .describe('Gracefully halt on test failures (default: false)'),
24
+ abortOnError: z.boolean().optional().describe('Abruptly halt on errors (default: false)'),
25
+ abortOnFailure: z
26
+ .boolean()
27
+ .optional()
28
+ .describe('Abruptly halt on test failures (default: false)'),
29
+ iterationCount: z.number().optional().describe('Number of iterations to run (default: 1)'),
30
+ requestTimeout: z
31
+ .number()
32
+ .optional()
33
+ .describe('Request timeout in milliseconds (default: 60000)'),
34
+ scriptTimeout: z.number().optional().describe('Script timeout in milliseconds (default: 5000)'),
35
+ });
36
+ export const annotations = {
37
+ title: 'Run Postman Collection',
38
+ readOnlyHint: false,
39
+ destructiveHint: false,
40
+ idempotentHint: true,
41
+ };
42
+ export async function handler(params, extra) {
43
+ try {
44
+ const tracker = new TestTracker();
45
+ const output = new OutputBuilder();
46
+ output.add(`🚀 Fetching collection with ID: ${params.collectionId}`);
47
+ const response = await extra.client.get(`/collections/${params.collectionId}`);
48
+ const collectionJSON = response.collection || response;
49
+ output.add(`✅ Successfully fetched collection: ${collectionJSON.info?.name || 'Unknown'}\n`);
50
+ let environmentJSON;
51
+ if (params.environmentId) {
52
+ output.add(`🌍 Fetching environment with ID: ${params.environmentId}`);
53
+ const envResponse = await extra.client.get(`/environments/${params.environmentId}`);
54
+ environmentJSON = envResponse.environment || envResponse;
55
+ output.add(`✅ Successfully fetched environment: ${environmentJSON.name || 'Unknown'}\n`);
56
+ }
57
+ const newmanOptions = buildNewmanOptions(params, collectionJSON, environmentJSON);
58
+ const startTime = Date.now();
59
+ await new Promise((resolve, reject) => {
60
+ newman
61
+ .run(newmanOptions)
62
+ .on('start', () => {
63
+ output.add('🎯 Starting collection run...\n');
64
+ })
65
+ .on('assertion', (_err, args) => {
66
+ if (args.assertion) {
67
+ tracker.addAssertion({
68
+ passed: !args.error,
69
+ assertion: args.assertion,
70
+ name: args.assertion,
71
+ error: args.error,
72
+ });
73
+ }
74
+ })
75
+ .on('item', (_err, args) => {
76
+ if (args.item) {
77
+ const testResults = tracker.displayCurrentResults();
78
+ if (testResults) {
79
+ output.add(`\n📝 Request: ${args.item.name}`);
80
+ output.add(testResults);
81
+ }
82
+ }
83
+ })
84
+ .on('done', (err, summary) => {
85
+ const endTime = Date.now();
86
+ const durationMs = endTime - startTime;
87
+ const durationSec = (durationMs / 1000).toFixed(2);
88
+ if (err) {
89
+ output.add('\n❌ Run error: ' + err.message);
90
+ output.add(`⏱️ Duration: ${durationSec}s`);
91
+ reject(err);
92
+ return;
93
+ }
94
+ output.add('\n=== ✅ Run completed! ===');
95
+ output.add(`⏱️ Duration: ${durationSec}s`);
96
+ const testStats = tracker.getTotalStats();
97
+ if (testStats.total > 0) {
98
+ output.add('\n📊 Overall Test Statistics:');
99
+ output.add(` Total tests: ${testStats.total}`);
100
+ output.add(` Passed: ${testStats.passed} ✅`);
101
+ output.add(` Failed: ${testStats.failed} ❌`);
102
+ output.add(` Success rate: ${((testStats.passed / testStats.total) * 100).toFixed(1)}%`);
103
+ }
104
+ if (summary?.run?.stats) {
105
+ output.add('\n📈 Request Summary:');
106
+ output.add(` Total requests: ${summary.run.stats.requests?.total || 0}`);
107
+ output.add(` Failed requests: ${summary.run.stats.requests?.failed || 0}`);
108
+ output.add(` Total assertions: ${summary.run.stats.assertions?.total || 0}`);
109
+ output.add(` Failed assertions: ${summary.run.stats.assertions?.failed || 0}`);
110
+ if (summary.run.stats.iterations) {
111
+ output.add(` Total iterations: ${summary.run.stats.iterations.total || 0}`);
112
+ output.add(` Failed iterations: ${summary.run.stats.iterations.failed || 0}`);
113
+ }
114
+ }
115
+ resolve();
116
+ });
117
+ });
118
+ return {
119
+ content: [
120
+ {
121
+ type: 'text',
122
+ text: output.build(),
123
+ },
124
+ ],
125
+ };
126
+ }
127
+ catch (e) {
128
+ if (e instanceof McpError) {
129
+ throw e;
130
+ }
131
+ throw asMcpError(e);
132
+ }
133
+ }
@@ -29,6 +29,9 @@ export const parameters = z.object({
29
29
  })
30
30
  .describe("The mock server's configuration settings.")
31
31
  .optional(),
32
+ collection: z
33
+ .string()
34
+ .describe("The associated collection's unique ID. This is a mandatory parameter."),
32
35
  })
33
36
  .optional(),
34
37
  });
@@ -0,0 +1,84 @@
1
+ export class TestTracker {
2
+ assertions = [];
3
+ totalTests = 0;
4
+ totalPassed = 0;
5
+ totalFailed = 0;
6
+ addAssertion(assertion) {
7
+ this.assertions.push(assertion);
8
+ this.totalTests++;
9
+ if (assertion.passed) {
10
+ this.totalPassed++;
11
+ }
12
+ else {
13
+ this.totalFailed++;
14
+ }
15
+ }
16
+ displayCurrentResults() {
17
+ if (this.assertions.length === 0) {
18
+ return '';
19
+ }
20
+ const lines = [' 📊 Test Results:'];
21
+ this.assertions.forEach((assertion) => {
22
+ const status = assertion.passed ? '✓' : '✗';
23
+ const name = assertion.assertion || assertion.name || 'Unnamed test';
24
+ lines.push(` ${status} ${name}`);
25
+ if (!assertion.passed && assertion.error) {
26
+ const errorMessage = typeof assertion.error === 'string'
27
+ ? assertion.error
28
+ : assertion.error.message || 'Unknown error';
29
+ lines.push(` └─ Error: ${errorMessage}`);
30
+ }
31
+ });
32
+ const passed = this.assertions.filter((a) => a.passed).length;
33
+ const failed = this.assertions.filter((a) => !a.passed).length;
34
+ lines.push(` ────────────────────────────────────────`);
35
+ lines.push(` ${this.assertions.length} tests | ✓ ${passed} passed | ✗ ${failed} failed\n`);
36
+ this.assertions.length = 0;
37
+ return lines.join('\n');
38
+ }
39
+ getTotalStats() {
40
+ return {
41
+ total: this.totalTests,
42
+ passed: this.totalPassed,
43
+ failed: this.totalFailed,
44
+ };
45
+ }
46
+ reset() {
47
+ this.assertions.length = 0;
48
+ this.totalTests = 0;
49
+ this.totalPassed = 0;
50
+ this.totalFailed = 0;
51
+ }
52
+ }
53
+ export class OutputBuilder {
54
+ lines = [];
55
+ add(line) {
56
+ this.lines.push(line);
57
+ }
58
+ build() {
59
+ return this.lines.join('\n');
60
+ }
61
+ }
62
+ export function buildNewmanOptions(params, collection, environment) {
63
+ return {
64
+ collection: collection,
65
+ environment: environment,
66
+ iterationCount: params.iterationCount || 1,
67
+ timeout: params.requestTimeout || 60000,
68
+ timeoutRequest: params.requestTimeout || 60000,
69
+ timeoutScript: params.scriptTimeout || 5000,
70
+ delayRequest: 1000,
71
+ ignoreRedirects: false,
72
+ insecure: false,
73
+ bail: params.stopOnFailure ? ['failure'] : false,
74
+ suppressExitCode: true,
75
+ reporters: [],
76
+ reporter: {},
77
+ color: 'off',
78
+ verbose: false,
79
+ requestAgents: {
80
+ http: undefined,
81
+ https: undefined,
82
+ },
83
+ };
84
+ }
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@postman/postman-mcp-server",
3
- "version": "2.3.7",
3
+ "version": "2.4.0",
4
4
  "description": "A simple MCP server to operate on the Postman API",
5
+ "mcpName": "com.postman/@postman/postman-mcp-server",
5
6
  "main": "dist/src/index.js",
6
7
  "type": "module",
7
8
  "scripts": {
@@ -30,7 +31,8 @@
30
31
  "@modelcontextprotocol/sdk": "^1.18.1",
31
32
  "dotenv": "^17.2.2",
32
33
  "es-toolkit": "^1.39.10",
33
- "express": "^5.1.0"
34
+ "express": "^5.1.0",
35
+ "newman": "^6.2.1"
34
36
  },
35
37
  "devDependencies": {
36
38
  "@eslint/js": "^9.35.0",