@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.
- package/README.md +31 -15
- package/dist/package.json +11 -20
- package/dist/src/clients/postman.js +2 -4
- package/dist/src/constants.js +5 -0
- package/dist/src/enabledResources.js +24 -2
- package/dist/src/index.js +11 -6
- package/dist/src/tools/createCollection.js +35 -35
- package/dist/src/tools/createCollectionComment.js +1 -5
- package/dist/src/tools/createCollectionFolder.js +1 -5
- package/dist/src/tools/createCollectionFork.js +1 -5
- package/dist/src/tools/createCollectionRequest.js +1 -5
- package/dist/src/tools/createCollectionResponse.js +1 -5
- package/dist/src/tools/createEnvironment.js +1 -5
- package/dist/src/tools/createFolderComment.js +1 -5
- package/dist/src/tools/createMock.js +1 -5
- package/dist/src/tools/createMonitor.js +1 -5
- package/dist/src/tools/createRequestComment.js +1 -5
- package/dist/src/tools/createResponseComment.js +1 -5
- package/dist/src/tools/createSpec.js +1 -5
- package/dist/src/tools/createSpecFile.js +1 -5
- package/dist/src/tools/createWorkspace.js +1 -5
- package/dist/src/tools/deleteApiCollectionComment.js +1 -5
- package/dist/src/tools/deleteCollection.js +1 -5
- package/dist/src/tools/deleteCollectionComment.js +1 -5
- package/dist/src/tools/deleteCollectionFolder.js +1 -5
- package/dist/src/tools/deleteCollectionRequest.js +1 -5
- package/dist/src/tools/deleteCollectionResponse.js +1 -5
- package/dist/src/tools/deleteEnvironment.js +1 -5
- package/dist/src/tools/deleteFolderComment.js +1 -5
- package/dist/src/tools/deleteMock.js +1 -5
- package/dist/src/tools/deleteMonitor.js +1 -5
- package/dist/src/tools/deletePanElementOrFolder.js +1 -5
- package/dist/src/tools/deleteRequestComment.js +1 -5
- package/dist/src/tools/deleteResponseComment.js +1 -5
- package/dist/src/tools/deleteSpec.js +1 -5
- package/dist/src/tools/deleteSpecFile.js +1 -5
- package/dist/src/tools/deleteWorkspace.js +1 -5
- package/dist/src/tools/duplicateCollection.js +1 -5
- package/dist/src/tools/generateCollection.js +1 -5
- package/dist/src/tools/generateSpecFromCollection.js +1 -5
- package/dist/src/tools/getAllElementsAndFolders.js +1 -5
- package/dist/src/tools/getAllPanAddElementRequests.js +1 -5
- package/dist/src/tools/getAllSpecs.js +1 -5
- package/dist/src/tools/getAsyncSpecTaskStatus.js +1 -5
- package/dist/src/tools/getAuthenticatedUser.js +1 -5
- package/dist/src/tools/getCodeGenerationInstructions.js +439 -0
- package/dist/src/tools/getCollection.js +1 -5
- package/dist/src/tools/getCollectionComments.js +1 -5
- package/dist/src/tools/getCollectionFolder.js +1 -5
- package/dist/src/tools/getCollectionForks.js +1 -5
- package/dist/src/tools/getCollectionMap.js +101 -0
- package/dist/src/tools/getCollectionRequest.js +1 -5
- package/dist/src/tools/getCollectionResponse.js +1 -5
- package/dist/src/tools/getCollectionTags.js +1 -5
- package/dist/src/tools/getCollectionUpdatesTasks.js +1 -5
- package/dist/src/tools/getCollections.js +1 -5
- package/dist/src/tools/getCollectionsForkedByUser.js +1 -5
- package/dist/src/tools/getDuplicateCollectionTaskStatus.js +1 -5
- package/dist/src/tools/getEnabledTools.js +51 -0
- package/dist/src/tools/getEnvironment.js +1 -5
- package/dist/src/tools/getEnvironments.js +1 -5
- package/dist/src/tools/getFolderComments.js +1 -5
- package/dist/src/tools/getGeneratedCollectionSpecs.js +1 -5
- package/dist/src/tools/getMock.js +1 -5
- package/dist/src/tools/getMocks.js +1 -5
- package/dist/src/tools/getMonitor.js +1 -5
- package/dist/src/tools/getMonitors.js +1 -5
- package/dist/src/tools/getRequestComments.js +1 -5
- package/dist/src/tools/getResponseComments.js +1 -5
- package/dist/src/tools/getSourceCollectionStatus.js +1 -5
- package/dist/src/tools/getSpec.js +1 -5
- package/dist/src/tools/getSpecCollections.js +1 -5
- package/dist/src/tools/getSpecDefinition.js +1 -5
- package/dist/src/tools/getSpecFile.js +1 -5
- package/dist/src/tools/getSpecFiles.js +1 -5
- package/dist/src/tools/getStatusOfAnAsyncApiTask.js +1 -5
- package/dist/src/tools/getTaggedEntities.js +1 -5
- package/dist/src/tools/getWorkspace.js +1 -5
- package/dist/src/tools/getWorkspaceGlobalVariables.js +1 -5
- package/dist/src/tools/getWorkspaceTags.js +1 -5
- package/dist/src/tools/getWorkspaces.js +1 -5
- package/dist/src/tools/mergeCollectionFork.js +1 -5
- package/dist/src/tools/patchCollection.js +13 -17
- package/dist/src/tools/patchEnvironment.js +1 -5
- package/dist/src/tools/postPanElementOrFolder.js +1 -5
- package/dist/src/tools/publishDocumentation.js +1 -5
- package/dist/src/tools/publishMock.js +1 -5
- package/dist/src/tools/pullCollectionChanges.js +1 -5
- package/dist/src/tools/putCollection.js +36 -36
- package/dist/src/tools/putEnvironment.js +1 -5
- package/dist/src/tools/resolveCommentThread.js +1 -5
- package/dist/src/tools/runCollection.js +4 -82
- package/dist/src/tools/runMonitor.js +1 -5
- package/dist/src/tools/runner/executor.js +165 -0
- package/dist/src/tools/runner/fetchers.js +33 -0
- package/dist/src/tools/runner/index.js +20 -0
- package/dist/src/tools/runner/models.js +1 -0
- package/dist/src/tools/runner/parsers.js +8 -0
- package/dist/src/tools/runner/telemetry.js +178 -0
- package/dist/src/tools/searchPostmanElements.js +69 -0
- package/dist/src/tools/syncCollectionWithSpec.js +1 -5
- package/dist/src/tools/syncSpecWithCollection.js +1 -5
- package/dist/src/tools/transferCollectionFolders.js +1 -5
- package/dist/src/tools/transferCollectionRequests.js +1 -5
- package/dist/src/tools/transferCollectionResponses.js +1 -5
- package/dist/src/tools/unpublishDocumentation.js +1 -5
- package/dist/src/tools/unpublishMock.js +1 -5
- package/dist/src/tools/updateApiCollectionComment.js +1 -5
- package/dist/src/tools/updateCollectionComment.js +1 -5
- package/dist/src/tools/updateCollectionFolder.js +1 -5
- package/dist/src/tools/updateCollectionRequest.js +1 -5
- package/dist/src/tools/updateCollectionResponse.js +1 -5
- package/dist/src/tools/updateCollectionTags.js +1 -5
- package/dist/src/tools/updateFolderComment.js +1 -5
- package/dist/src/tools/updateMock.js +1 -5
- package/dist/src/tools/updateMonitor.js +1 -5
- package/dist/src/tools/updatePanElementOrFolder.js +1 -5
- package/dist/src/tools/updateRequestComment.js +1 -5
- package/dist/src/tools/updateResponseComment.js +1 -5
- package/dist/src/tools/updateSpecFile.js +1 -5
- package/dist/src/tools/updateSpecProperties.js +1 -5
- package/dist/src/tools/updateWorkspace.js +1 -5
- package/dist/src/tools/updateWorkspaceGlobalVariables.js +1 -5
- package/dist/src/tools/updateWorkspaceTags.js +1 -5
- package/dist/src/tools/utils/toolHelpers.js +6 -0
- package/package.json +11 -20
- package/dist/src/tools/utils/runner.js +0 -84
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
|
|
|
@@ -19,8 +20,9 @@ Postman also offers servers as an [npm package](https://www.npmjs.com/package/@p
|
|
|
19
20
|
* **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
21
|
* **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
22
|
* **Automatic spec creation** - Create [specs](https://learning.postman.com/docs/design-apis/specifications/overview/) from your code and use them to generate collections.
|
|
23
|
+
* **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
24
|
|
|
23
|
-
Designed for developers who want to integrate their AI tools with Postman
|
|
25
|
+
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
26
|
|
|
25
27
|
### Support for EU
|
|
26
28
|
|
|
@@ -55,6 +57,7 @@ The remote Postman MCP Server is hosted by Postman over streamable HTTP and prov
|
|
|
55
57
|
The remote server supports the following tool configurations:
|
|
56
58
|
|
|
57
59
|
* **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.
|
|
60
|
+
* **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
61
|
* **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
62
|
|
|
60
63
|
### Install in Cursor
|
|
@@ -65,7 +68,7 @@ To install the remote Postman MCP Server in Cursor, click the install button.
|
|
|
65
68
|
|
|
66
69
|
**Note:** Ensure that the Authorization header uses the `Bearer <YOUR_API_KEY>` format.
|
|
67
70
|
|
|
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.
|
|
71
|
+
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
72
|
|
|
70
73
|
### Install in Visual Studio Code
|
|
71
74
|
|
|
@@ -73,7 +76,7 @@ By default, the server uses **Minimal** mode. To access **Full** mode, change th
|
|
|
73
76
|
|
|
74
77
|
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
78
|
|
|
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.
|
|
79
|
+
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
80
|
|
|
78
81
|
#### Manual configuration
|
|
79
82
|
|
|
@@ -84,8 +87,7 @@ You can use the Postman MCP Server with MCP-compatible extensions in VS Code, su
|
|
|
84
87
|
"servers": {
|
|
85
88
|
"postman-api-http-server": {
|
|
86
89
|
"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.
|
|
90
|
+
"url": "https://mcp.postman.com/{minimal OR code OR mcp}",
|
|
89
91
|
// For the EU server, use the "https://mcp.eu.postman.com" URL.
|
|
90
92
|
"headers": {
|
|
91
93
|
"Authorization": "Bearer ${input:postman-api-key}"
|
|
@@ -111,13 +113,19 @@ To install the MCP server in Claude Code, run the following command in your term
|
|
|
111
113
|
For **Minimal** mode:
|
|
112
114
|
|
|
113
115
|
```bash
|
|
114
|
-
claude mcp add --transport http postman https://mcp.postman.com/minimal
|
|
116
|
+
claude mcp add --transport http postman https://mcp.postman.com/minimal --header "Authorization: Bearer <POSTMAN_API_KEY>"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
For **Code** mode:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
claude mcp add --transport http postman https://mcp.postman.com/code --header "Authorization: Bearer <POSTMAN_API_KEY>"
|
|
115
123
|
```
|
|
116
124
|
|
|
117
125
|
For **Full** mode:
|
|
118
126
|
|
|
119
127
|
```bash
|
|
120
|
-
claude mcp add --transport http postman https://mcp.postman.com/mcp
|
|
128
|
+
claude mcp add --transport http postman https://mcp.postman.com/mcp --header "Authorization: Bearer <POSTMAN_API_KEY>"
|
|
121
129
|
```
|
|
122
130
|
|
|
123
131
|
---
|
|
@@ -133,6 +141,7 @@ STDIO is a lightweight solution that's ideal for integration with editors and to
|
|
|
133
141
|
The local server supports the following tool configurations:
|
|
134
142
|
|
|
135
143
|
* **Minimal** — (Default) Only includes essential tools for basic Postman operations.
|
|
144
|
+
* **Code** — Includes tools for searching public and internal API definitions and generating client code
|
|
136
145
|
* **Full** — Includes all available Postman API tools (100+ tools). Use the `--full` flag to enable this configuration.
|
|
137
146
|
|
|
138
147
|
**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 +153,7 @@ The local server supports the following tool configurations:
|
|
|
144
153
|
|
|
145
154
|
To install the local Postman MCP Server in VS Code, click the install button.
|
|
146
155
|
|
|
147
|
-
By default, the server uses **Full** mode. To access **Minimal** mode, remove the `--full` flag from the `mcp.json` configuration file.
|
|
156
|
+
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
157
|
|
|
149
158
|
#### Manual configuration
|
|
150
159
|
|
|
@@ -158,7 +167,8 @@ You can manually integrate your MCP server with Cursor or VS Code to use it with
|
|
|
158
167
|
"command": "npx",
|
|
159
168
|
"args": [
|
|
160
169
|
"@postman/postman-mcp-server",
|
|
161
|
-
"--full" // (optional) Use this flag to enable full mode
|
|
170
|
+
"--full", // (optional) Use this flag to enable full mode...
|
|
171
|
+
"--code", // (optional) ...OR this flag to enable code mode.
|
|
162
172
|
"--region us" // (optional) Use this flag to specify the Postman API region (us or eu). Defaults to us.
|
|
163
173
|
],
|
|
164
174
|
"env": {
|
|
@@ -182,14 +192,15 @@ You can manually integrate your MCP server with Cursor or VS Code to use it with
|
|
|
182
192
|
|
|
183
193
|
To install the local Postman MCP Server in Cursor, click the install button.
|
|
184
194
|
|
|
185
|
-
By default, the server uses **Full** mode. To access **Minimal** mode, remove the `--full` flag from the `mcp.json` configuration file.
|
|
195
|
+
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
196
|
|
|
187
197
|
### Claude integration
|
|
188
198
|
|
|
189
199
|
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
200
|
|
|
191
|
-
* **Minimal** - `postman-
|
|
192
|
-
* **Full** - `postman-
|
|
201
|
+
* **Minimal** - `postman-mcp-server-minimal.mcpb`
|
|
202
|
+
* **Full** - `postman-mcp-server-full.mcpb`
|
|
203
|
+
* **Code** - `postman-mcp-server-code.mcpb`
|
|
193
204
|
|
|
194
205
|
For more information, see the [Claude Desktop Extensions](https://www.anthropic.com/engineering/desktop-extensions) documentation.
|
|
195
206
|
|
|
@@ -200,13 +211,19 @@ To install the MCP server in Claude Code, run the following command in your term
|
|
|
200
211
|
For **Minimal** mode:
|
|
201
212
|
|
|
202
213
|
```bash
|
|
203
|
-
claude mcp add postman -- npx @postman/mcp-server@latest
|
|
214
|
+
claude mcp add postman --env POSTMAN_API_KEY=YOUR_KEY -- npx @postman/postman-mcp-server@latest
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
For **Code** mode:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
claude mcp add postman --env POSTMAN_API_KEY=YOUR_KEY -- npx @postman/postman-mcp-server@latest --code
|
|
204
221
|
```
|
|
205
222
|
|
|
206
223
|
For **Full** mode:
|
|
207
224
|
|
|
208
225
|
```bash
|
|
209
|
-
claude mcp add postman -- npx @postman/mcp-server@latest --full
|
|
226
|
+
claude mcp add postman --env POSTMAN_API_KEY=YOUR_KEY -- npx @postman/postman-mcp-server@latest --full
|
|
210
227
|
```
|
|
211
228
|
|
|
212
229
|
### Use as a Gemini CLI extension
|
|
@@ -239,7 +256,6 @@ If you're migrating from Postman MCP Server version 1.x to 2.x, be aware of the
|
|
|
239
256
|
|
|
240
257
|
## Questions and support
|
|
241
258
|
|
|
242
|
-
* See the [Postman Agent Generator](https://postman.com/explore/agent-generator) page for updates and new capabilities.
|
|
243
259
|
* 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
260
|
* Visit the [Postman Community](https://community.postman.com/) to share what you've built, ask questions, and get help.
|
|
245
261
|
* 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.
|
|
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
|
-
"@
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
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.
|
|
39
|
-
"@types/express": "^5.0.3",
|
|
36
|
+
"@eslint/js": "^9.39.1",
|
|
40
37
|
"@types/node": "^24",
|
|
41
|
-
"eslint": "^9.
|
|
38
|
+
"eslint": "^9.39.1",
|
|
42
39
|
"eslint-config-prettier": "^10.1.8",
|
|
43
|
-
"eslint-plugin-
|
|
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
|
-
"
|
|
51
|
-
"typescript": "^
|
|
52
|
-
"
|
|
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"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
import
|
|
2
|
+
import { USER_AGENT } from '../constants.js';
|
|
3
3
|
export var ContentType;
|
|
4
4
|
(function (ContentType) {
|
|
5
5
|
ContentType["Json"] = "application/json";
|
|
@@ -45,9 +45,7 @@ export class PostmanAPIClient {
|
|
|
45
45
|
const contentType = options.contentType || ContentType.Json;
|
|
46
46
|
const userAgentKey = Object.keys(options.headers ?? {}).find((key) => key.toLowerCase() === 'user-agent');
|
|
47
47
|
const userAgentValue = userAgentKey ? options.headers?.[userAgentKey] : undefined;
|
|
48
|
-
const userAgentHeader = userAgentValue
|
|
49
|
-
? `${userAgentValue}/${packageJson.name}/${packageJson.version}`
|
|
50
|
-
: `${packageJson.name}/${packageJson.version}`;
|
|
48
|
+
const userAgentHeader = userAgentValue ? `${userAgentValue}/${USER_AGENT}` : USER_AGENT;
|
|
51
49
|
const disallowed = new Set([
|
|
52
50
|
'content-length',
|
|
53
51
|
'transfer-encoding',
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import packageJson from '../package.json' with { type: 'json' };
|
|
2
|
+
export const SERVER_NAME = packageJson.name;
|
|
3
|
+
export const APP_VERSION = packageJson.version;
|
|
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',
|
|
@@ -109,7 +110,8 @@ const full = [
|
|
|
109
110
|
'getDuplicateCollectionTaskStatus',
|
|
110
111
|
'deleteApiCollectionComment',
|
|
111
112
|
'deleteSpecFile',
|
|
112
|
-
'
|
|
113
|
+
'getEnabledTools',
|
|
114
|
+
'searchPostmanElements',
|
|
113
115
|
];
|
|
114
116
|
const minimal = [
|
|
115
117
|
'createCollection',
|
|
@@ -151,10 +153,30 @@ const minimal = [
|
|
|
151
153
|
'duplicateCollection',
|
|
152
154
|
'getStatusOfAnAsyncApiTask',
|
|
153
155
|
'runCollection',
|
|
156
|
+
'getEnabledTools',
|
|
157
|
+
];
|
|
158
|
+
const code = [
|
|
159
|
+
'getCodeGenerationInstructions',
|
|
160
|
+
'getWorkspace',
|
|
161
|
+
'getWorkspaces',
|
|
162
|
+
'searchPostmanElements',
|
|
163
|
+
'getCollectionRequest',
|
|
164
|
+
'getCollectionResponse',
|
|
165
|
+
'getCollectionFolder',
|
|
166
|
+
'getAuthenticatedUser',
|
|
167
|
+
'getCollectionMap',
|
|
168
|
+
'getEnvironment',
|
|
169
|
+
'getEnvironments',
|
|
170
|
+
];
|
|
171
|
+
const excludedFromGeneration = [
|
|
172
|
+
'runCollection',
|
|
173
|
+
'getEnabledTools',
|
|
174
|
+
'getCodeGenerationInstructions',
|
|
175
|
+
'getCollectionMap',
|
|
154
176
|
];
|
|
155
|
-
const excludedFromGeneration = ['createCollection', 'putCollection'];
|
|
156
177
|
export const enabledResources = {
|
|
157
178
|
full,
|
|
158
179
|
minimal,
|
|
180
|
+
code,
|
|
159
181
|
excludedFromGeneration,
|
|
160
182
|
};
|
package/dist/src/index.js
CHANGED
|
@@ -3,12 +3,12 @@ import dotenv from 'dotenv';
|
|
|
3
3
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
4
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
5
5
|
import { ErrorCode, isInitializeRequest, McpError, } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
-
import packageJson from '../package.json' with { type: 'json' };
|
|
7
6
|
import { readdir } from 'node:fs/promises';
|
|
8
7
|
import { join, dirname } from 'node:path';
|
|
9
8
|
import { fileURLToPath } from 'node:url';
|
|
10
9
|
import { enabledResources } from './enabledResources.js';
|
|
11
10
|
import { PostmanAPIClient } from './clients/postman.js';
|
|
11
|
+
import { SERVER_NAME, APP_VERSION } from './constants.js';
|
|
12
12
|
const SUPPORTED_REGIONS = {
|
|
13
13
|
us: 'https://api.postman.com',
|
|
14
14
|
eu: 'https://api.eu.postman.com',
|
|
@@ -93,13 +93,11 @@ if (dotEnvOutput.error) {
|
|
|
93
93
|
else {
|
|
94
94
|
log('info', `Environment variables loaded: ${dotEnvOutput.parsed ? Object.keys(dotEnvOutput.parsed).length : 0} environment variables: ${Object.keys(dotEnvOutput.parsed || {}).join(', ')}`);
|
|
95
95
|
}
|
|
96
|
-
const SERVER_NAME = packageJson.name;
|
|
97
|
-
const APP_VERSION = packageJson.version;
|
|
98
|
-
export const USER_AGENT = `${SERVER_NAME}/${APP_VERSION}`;
|
|
99
96
|
let clientInfo = undefined;
|
|
100
97
|
async function run() {
|
|
101
98
|
const args = process.argv.slice(2);
|
|
102
99
|
const useFull = args.includes('--full');
|
|
100
|
+
const useCode = args.includes('--code');
|
|
103
101
|
const regionIndex = args.findIndex((arg) => arg === '--region');
|
|
104
102
|
if (regionIndex !== -1 && regionIndex + 1 < args.length) {
|
|
105
103
|
const region = args[regionIndex + 1];
|
|
@@ -129,7 +127,8 @@ async function run() {
|
|
|
129
127
|
});
|
|
130
128
|
const fullTools = allGeneratedTools.filter((t) => enabledResources.full.includes(t.method));
|
|
131
129
|
const minimalTools = allGeneratedTools.filter((t) => enabledResources.minimal.includes(t.method));
|
|
132
|
-
const
|
|
130
|
+
const codeTools = allGeneratedTools.filter((t) => enabledResources.code.includes(t.method));
|
|
131
|
+
const tools = useCode ? codeTools : useFull ? fullTools : minimalTools;
|
|
133
132
|
const server = new McpServer({ name: SERVER_NAME, version: APP_VERSION });
|
|
134
133
|
server.onerror = (error) => {
|
|
135
134
|
const msg = String(error?.message || error);
|
|
@@ -141,6 +140,10 @@ async function run() {
|
|
|
141
140
|
process.exit(0);
|
|
142
141
|
});
|
|
143
142
|
const client = new PostmanAPIClient(apiKey);
|
|
143
|
+
const serverContext = {
|
|
144
|
+
serverType: useCode ? 'code' : useFull ? 'full' : 'minimal',
|
|
145
|
+
availableTools: tools.map((t) => t.method),
|
|
146
|
+
};
|
|
144
147
|
log('info', 'Registering tools with McpServer');
|
|
145
148
|
for (const tool of tools) {
|
|
146
149
|
server.tool(tool.method, tool.description, tool.parameters.shape, tool.annotations || {}, async (args, extra) => {
|
|
@@ -154,6 +157,7 @@ async function run() {
|
|
|
154
157
|
...extra?.requestInfo?.headers,
|
|
155
158
|
'user-agent': clientInfo?.name,
|
|
156
159
|
},
|
|
160
|
+
serverContext,
|
|
157
161
|
});
|
|
158
162
|
const durationMs = Date.now() - start;
|
|
159
163
|
log('info', `Tool invocation completed: ${toolName} (${durationMs}ms)`, {
|
|
@@ -180,7 +184,8 @@ async function run() {
|
|
|
180
184
|
}
|
|
181
185
|
};
|
|
182
186
|
await server.connect(transport);
|
|
183
|
-
|
|
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})`);
|
|
184
189
|
}
|
|
185
190
|
run().catch((error) => {
|
|
186
191
|
log('error', 'Unhandled error during server execution', {
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ContentType } from '../clients/postman.js';
|
|
3
|
-
import {
|
|
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 = 'createCollection';
|
|
9
5
|
export const description = 'Creates a collection using the [Postman Collection v2.1.0 schema format](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).\n\n**Note:**\n\nIf you do not include the \\`workspace\\` query parameter, the system creates the collection in the oldest personal Internal workspace you own.\n';
|
|
10
6
|
export const parameters = z.object({
|
|
@@ -126,13 +122,13 @@ export const parameters = z.object({
|
|
|
126
122
|
'edgegrid',
|
|
127
123
|
])
|
|
128
124
|
.describe('The authorization type.'),
|
|
129
|
-
noauth: z.
|
|
125
|
+
noauth: z.unknown().optional(),
|
|
130
126
|
apikey: z
|
|
131
127
|
.array(z
|
|
132
128
|
.object({
|
|
133
129
|
key: z.string().describe("The auth method's key value."),
|
|
134
130
|
value: z
|
|
135
|
-
.union([z.string(), z.array(z.record(z.
|
|
131
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
136
132
|
.describe("The key's value.")
|
|
137
133
|
.optional(),
|
|
138
134
|
type: z
|
|
@@ -148,7 +144,7 @@ export const parameters = z.object({
|
|
|
148
144
|
.object({
|
|
149
145
|
key: z.string().describe("The auth method's key value."),
|
|
150
146
|
value: z
|
|
151
|
-
.union([z.string(), z.array(z.record(z.
|
|
147
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
152
148
|
.describe("The key's value.")
|
|
153
149
|
.optional(),
|
|
154
150
|
type: z
|
|
@@ -164,7 +160,7 @@ export const parameters = z.object({
|
|
|
164
160
|
.object({
|
|
165
161
|
key: z.string().describe("The auth method's key value."),
|
|
166
162
|
value: z
|
|
167
|
-
.union([z.string(), z.array(z.record(z.
|
|
163
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
168
164
|
.describe("The key's value.")
|
|
169
165
|
.optional(),
|
|
170
166
|
type: z
|
|
@@ -180,7 +176,7 @@ export const parameters = z.object({
|
|
|
180
176
|
.object({
|
|
181
177
|
key: z.string().describe("The auth method's key value."),
|
|
182
178
|
value: z
|
|
183
|
-
.union([z.string(), z.array(z.record(z.
|
|
179
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
184
180
|
.describe("The key's value.")
|
|
185
181
|
.optional(),
|
|
186
182
|
type: z
|
|
@@ -196,7 +192,7 @@ export const parameters = z.object({
|
|
|
196
192
|
.object({
|
|
197
193
|
key: z.string().describe("The auth method's key value."),
|
|
198
194
|
value: z
|
|
199
|
-
.union([z.string(), z.array(z.record(z.
|
|
195
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
200
196
|
.describe("The key's value.")
|
|
201
197
|
.optional(),
|
|
202
198
|
type: z
|
|
@@ -212,7 +208,7 @@ export const parameters = z.object({
|
|
|
212
208
|
.object({
|
|
213
209
|
key: z.string().describe("The auth method's key value."),
|
|
214
210
|
value: z
|
|
215
|
-
.union([z.string(), z.array(z.record(z.
|
|
211
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
216
212
|
.describe("The key's value.")
|
|
217
213
|
.optional(),
|
|
218
214
|
type: z
|
|
@@ -228,7 +224,7 @@ export const parameters = z.object({
|
|
|
228
224
|
.object({
|
|
229
225
|
key: z.string().describe("The auth method's key value."),
|
|
230
226
|
value: z
|
|
231
|
-
.union([z.string(), z.array(z.record(z.
|
|
227
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
232
228
|
.describe("The key's value.")
|
|
233
229
|
.optional(),
|
|
234
230
|
type: z
|
|
@@ -244,7 +240,7 @@ export const parameters = z.object({
|
|
|
244
240
|
.object({
|
|
245
241
|
key: z.string().describe("The auth method's key value."),
|
|
246
242
|
value: z
|
|
247
|
-
.union([z.string(), z.array(z.record(z.
|
|
243
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
248
244
|
.describe("The key's value.")
|
|
249
245
|
.optional(),
|
|
250
246
|
type: z
|
|
@@ -260,7 +256,7 @@ export const parameters = z.object({
|
|
|
260
256
|
.object({
|
|
261
257
|
key: z.string().describe("The auth method's key value."),
|
|
262
258
|
value: z
|
|
263
|
-
.union([z.string(), z.array(z.record(z.
|
|
259
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
264
260
|
.describe("The key's value.")
|
|
265
261
|
.optional(),
|
|
266
262
|
type: z
|
|
@@ -276,7 +272,7 @@ export const parameters = z.object({
|
|
|
276
272
|
.object({
|
|
277
273
|
key: z.string().describe("The auth method's key value."),
|
|
278
274
|
value: z
|
|
279
|
-
.union([z.string(), z.array(z.record(z.
|
|
275
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
280
276
|
.describe("The key's value.")
|
|
281
277
|
.optional(),
|
|
282
278
|
type: z
|
|
@@ -339,7 +335,7 @@ export const parameters = z.object({
|
|
|
339
335
|
.describe('A list of x-www-form-encoded key/value pairs.')
|
|
340
336
|
.optional(),
|
|
341
337
|
formdata: z
|
|
342
|
-
.array(z.record(z.
|
|
338
|
+
.array(z.record(z.string(), z.unknown()).and(z.union([
|
|
343
339
|
z.object({
|
|
344
340
|
key: z.string().describe('The key value.').optional(),
|
|
345
341
|
value: z.string().describe("The key's value.").optional(),
|
|
@@ -357,7 +353,7 @@ export const parameters = z.object({
|
|
|
357
353
|
z.object({
|
|
358
354
|
key: z.string().describe('The key value.').optional(),
|
|
359
355
|
src: z
|
|
360
|
-
.
|
|
356
|
+
.unknown()
|
|
361
357
|
.superRefine((x, ctx) => {
|
|
362
358
|
const schemas = [z.string().nullable(), z.array(z.string())];
|
|
363
359
|
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
@@ -407,7 +403,7 @@ export const parameters = z.object({
|
|
|
407
403
|
.describe('If the `mode` value is `graphql`, an object containing the GraphQL request information.')
|
|
408
404
|
.optional(),
|
|
409
405
|
options: z
|
|
410
|
-
.record(z.
|
|
406
|
+
.record(z.string(), z.unknown())
|
|
411
407
|
.describe('Additional configurations and options set for various modes.')
|
|
412
408
|
.optional(),
|
|
413
409
|
})
|
|
@@ -416,6 +412,10 @@ export const parameters = z.object({
|
|
|
416
412
|
})
|
|
417
413
|
.describe('Information about the collection request.')
|
|
418
414
|
.optional(),
|
|
415
|
+
response: z
|
|
416
|
+
.array(z.unknown().describe("Information about the request's response."))
|
|
417
|
+
.describe("A list of the collection's responses.")
|
|
418
|
+
.optional(),
|
|
419
419
|
protocolProfileBehavior: z
|
|
420
420
|
.object({
|
|
421
421
|
strictSSL: z
|
|
@@ -544,13 +544,13 @@ export const parameters = z.object({
|
|
|
544
544
|
'edgegrid',
|
|
545
545
|
])
|
|
546
546
|
.describe('The authorization type.'),
|
|
547
|
-
noauth: z.
|
|
547
|
+
noauth: z.unknown().optional(),
|
|
548
548
|
apikey: z
|
|
549
549
|
.array(z
|
|
550
550
|
.object({
|
|
551
551
|
key: z.string().describe("The auth method's key value."),
|
|
552
552
|
value: z
|
|
553
|
-
.union([z.string(), z.array(z.record(z.
|
|
553
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
554
554
|
.describe("The key's value.")
|
|
555
555
|
.optional(),
|
|
556
556
|
type: z
|
|
@@ -566,7 +566,7 @@ export const parameters = z.object({
|
|
|
566
566
|
.object({
|
|
567
567
|
key: z.string().describe("The auth method's key value."),
|
|
568
568
|
value: z
|
|
569
|
-
.union([z.string(), z.array(z.record(z.
|
|
569
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
570
570
|
.describe("The key's value.")
|
|
571
571
|
.optional(),
|
|
572
572
|
type: z
|
|
@@ -582,7 +582,7 @@ export const parameters = z.object({
|
|
|
582
582
|
.object({
|
|
583
583
|
key: z.string().describe("The auth method's key value."),
|
|
584
584
|
value: z
|
|
585
|
-
.union([z.string(), z.array(z.record(z.
|
|
585
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
586
586
|
.describe("The key's value.")
|
|
587
587
|
.optional(),
|
|
588
588
|
type: z
|
|
@@ -598,7 +598,7 @@ export const parameters = z.object({
|
|
|
598
598
|
.object({
|
|
599
599
|
key: z.string().describe("The auth method's key value."),
|
|
600
600
|
value: z
|
|
601
|
-
.union([z.string(), z.array(z.record(z.
|
|
601
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
602
602
|
.describe("The key's value.")
|
|
603
603
|
.optional(),
|
|
604
604
|
type: z
|
|
@@ -614,7 +614,7 @@ export const parameters = z.object({
|
|
|
614
614
|
.object({
|
|
615
615
|
key: z.string().describe("The auth method's key value."),
|
|
616
616
|
value: z
|
|
617
|
-
.union([z.string(), z.array(z.record(z.
|
|
617
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
618
618
|
.describe("The key's value.")
|
|
619
619
|
.optional(),
|
|
620
620
|
type: z
|
|
@@ -630,7 +630,7 @@ export const parameters = z.object({
|
|
|
630
630
|
.object({
|
|
631
631
|
key: z.string().describe("The auth method's key value."),
|
|
632
632
|
value: z
|
|
633
|
-
.union([z.string(), z.array(z.record(z.
|
|
633
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
634
634
|
.describe("The key's value.")
|
|
635
635
|
.optional(),
|
|
636
636
|
type: z
|
|
@@ -646,7 +646,7 @@ export const parameters = z.object({
|
|
|
646
646
|
.object({
|
|
647
647
|
key: z.string().describe("The auth method's key value."),
|
|
648
648
|
value: z
|
|
649
|
-
.union([z.string(), z.array(z.record(z.
|
|
649
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
650
650
|
.describe("The key's value.")
|
|
651
651
|
.optional(),
|
|
652
652
|
type: z
|
|
@@ -662,7 +662,7 @@ export const parameters = z.object({
|
|
|
662
662
|
.object({
|
|
663
663
|
key: z.string().describe("The auth method's key value."),
|
|
664
664
|
value: z
|
|
665
|
-
.union([z.string(), z.array(z.record(z.
|
|
665
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
666
666
|
.describe("The key's value.")
|
|
667
667
|
.optional(),
|
|
668
668
|
type: z
|
|
@@ -678,7 +678,7 @@ export const parameters = z.object({
|
|
|
678
678
|
.object({
|
|
679
679
|
key: z.string().describe("The auth method's key value."),
|
|
680
680
|
value: z
|
|
681
|
-
.union([z.string(), z.array(z.record(z.
|
|
681
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
682
682
|
.describe("The key's value.")
|
|
683
683
|
.optional(),
|
|
684
684
|
type: z
|
|
@@ -694,7 +694,7 @@ export const parameters = z.object({
|
|
|
694
694
|
.object({
|
|
695
695
|
key: z.string().describe("The auth method's key value."),
|
|
696
696
|
value: z
|
|
697
|
-
.union([z.string(), z.array(z.record(z.
|
|
697
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
698
698
|
.describe("The key's value.")
|
|
699
699
|
.optional(),
|
|
700
700
|
type: z
|
|
@@ -783,16 +783,16 @@ export const annotations = {
|
|
|
783
783
|
destructiveHint: false,
|
|
784
784
|
idempotentHint: false,
|
|
785
785
|
};
|
|
786
|
-
export async function handler(
|
|
786
|
+
export async function handler(args, extra) {
|
|
787
787
|
try {
|
|
788
788
|
const endpoint = `/collections`;
|
|
789
789
|
const query = new URLSearchParams();
|
|
790
|
-
if (
|
|
791
|
-
query.set('workspace', String(
|
|
790
|
+
if (args.workspace !== undefined)
|
|
791
|
+
query.set('workspace', String(args.workspace));
|
|
792
792
|
const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
|
|
793
793
|
const bodyPayload = {};
|
|
794
|
-
if (
|
|
795
|
-
bodyPayload.collection =
|
|
794
|
+
if (args.collection !== undefined)
|
|
795
|
+
bodyPayload.collection = args.collection;
|
|
796
796
|
const options = {
|
|
797
797
|
body: JSON.stringify(bodyPayload),
|
|
798
798
|
contentType: ContentType.Json,
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ContentType } from '../clients/postman.js';
|
|
3
|
-
import {
|
|
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 = 'createCollectionComment';
|
|
9
5
|
export const description = 'Creates a comment on a collection. To create a reply on an existing comment, include the \\`threadId\\` property in the request body.\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 {
|
|
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 = 'createCollectionFolder';
|
|
9
5
|
export const description = 'Creates 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\nYou can use this endpoint to to import requests and responses into a newly-created folder. To do this, include the \\`requests\\` field and the list of request objects in the request body. For more information, see the provided example.\n\n**Note:**\n\nIt is recommended that you pass the \\`name\\` property in the request body. If you do not, the system uses a null value. As a result, this creates a folder with a blank name.\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 {
|
|
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 = 'createCollectionFork';
|
|
9
5
|
export const description = 'Creates a [fork](https://learning.postman.com/docs/collaborating-in-postman/version-control/#creating-a-fork) from an existing collection into a workspace.';
|
|
10
6
|
export const parameters = z.object({
|