@postman/postman-plugin 0.1.0 → 0.1.2-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +13 -1
  2. package/dist/hosts/index.js +2 -1
  3. package/dist/hosts/pi.js +84 -0
  4. package/dist/pi-extension.js +27 -0
  5. package/dist/source.js +3 -1
  6. package/hooks/session-start-context.md +11 -0
  7. package/mcp.pi.json +14 -0
  8. package/package.json +21 -6
  9. package/skills/ai-readiness/SKILL.md +50 -0
  10. package/skills/api-discovery/SKILL.md +135 -0
  11. package/skills/api-discovery/reference/orbit.md +101 -0
  12. package/skills/api-documentation/SKILL.md +34 -0
  13. package/skills/api-documentation/reference/rest-api-best-practices.md +47 -0
  14. package/skills/api-engineer/SKILL.md +29 -0
  15. package/skills/api-mocking/SKILL.md +141 -0
  16. package/skills/api-monitoring/SKILL.md +137 -0
  17. package/skills/api-testing/SKILL.md +103 -0
  18. package/skills/bootstrap/SKILL.md +216 -0
  19. package/skills/bootstrap/reference/cli_installation.md +58 -0
  20. package/skills/ci-integration/SKILL.md +121 -0
  21. package/skills/collection-schema-v3/SKILL.md +210 -0
  22. package/skills/collection-schema-v3/reference/environment.md +63 -0
  23. package/skills/collection-schema-v3/reference/other_protocols.md +86 -0
  24. package/skills/datasets/SKILL.md +323 -0
  25. package/skills/flows/SKILL.md +212 -0
  26. package/skills/flows/reference/flow_cli_flags.md +111 -0
  27. package/skills/performance-testing/SKILL.md +71 -0
  28. package/skills/postman-mcp-server/SKILL.md +71 -0
  29. package/skills/postman-mcp-server/references/docs.md +88 -0
  30. package/skills/postman-mcp-server/references/learn.md +73 -0
  31. package/skills/postman-mcp-server/references/mcp-limitations.md +38 -0
  32. package/skills/postman-mcp-server/references/mock.md +101 -0
  33. package/skills/postman-mcp-server/references/search.md +83 -0
  34. package/skills/postman-mcp-server/references/security.md +129 -0
  35. package/skills/postman-mcp-server/references/setup.md +141 -0
  36. package/skills/postman-mcp-server/references/sync.md +85 -0
  37. package/skills/postman-mcp-server/references/test.md +84 -0
@@ -0,0 +1,141 @@
1
+ ---
2
+ description: Set up Postman MCP Server. Authenticate via OAuth or API key, verify connection, select workspace.
3
+ allowed-tools: mcp__postman__authenticate, mcp__postman__complete_authentication, mcp__postman__getAuthenticatedUser, mcp__postman__getWorkspaces, mcp__postman__getCollections, mcp__postman__getAllSpecs
4
+ ---
5
+
6
+ # First-Run Configuration
7
+
8
+ Walk the user through Postman setup for Claude Code. Validate everything works before they use other commands.
9
+
10
+ ## Workflow
11
+
12
+ ### Step 1: Check MCP Connection
13
+
14
+ Verify the Postman MCP Server is available by calling `getAuthenticatedUser`.
15
+
16
+ **If it works:** Skip to Step 4 (workspace verification).
17
+
18
+ **If it fails:** Check whether `mcp__postman__authenticate` is available.
19
+ - Available → offer the user a choice: **OAuth (recommended)** or **API key**. Default to OAuth unless they ask for API key.
20
+ - Not available → the MCP server isn't loaded. Show the "MCP tools not available" error below and stop.
21
+
22
+ ### Step 2: OAuth Authentication (Recommended)
23
+
24
+ Present:
25
+ ```
26
+ Let's connect your Postman account via OAuth — no key copying required.
27
+
28
+ I'll generate an authorization URL. Open it in your browser, sign in, and paste the callback URL back here.
29
+ ```
30
+
31
+ 1. Call `mcp__postman__authenticate` — it returns an authorization URL.
32
+ 2. Show the URL:
33
+ ```
34
+ Open this URL in your browser:
35
+ <authorization URL>
36
+
37
+ After you authorize, your browser will redirect to a localhost URL.
38
+ The page may not load — that's expected. Copy the full URL from the address bar and paste it here.
39
+ ```
40
+ 3. Wait for the user to paste the callback URL.
41
+ 4. Call `mcp__postman__complete_authentication` with the pasted URL as `callback_url`.
42
+ 5. The MCP server may restart after saving the OAuth token, temporarily dropping the connection. This is expected.
43
+ - Wait a few seconds, then retry `getAuthenticatedUser` up to 3 times with short pauses between attempts.
44
+ - If tools become unavailable (server disconnected), tell the user:
45
+ ```
46
+ The MCP server is restarting after saving your credentials — this is normal.
47
+ Give it a moment and I'll retry the connection...
48
+ ```
49
+ - If tools are still unavailable after retries:
50
+ ```
51
+ The server hasn't reconnected yet. Restart Claude Code and run /postman:setup again.
52
+ Your OAuth token is already saved — you won't need to re-authorize.
53
+ ```
54
+ 6. Once `getAuthenticatedUser` succeeds, proceed to Step 4.
55
+
56
+ **If OAuth fails:** "OAuth didn't complete. You can try again or use an API key instead — just say 'use API key'." → offer Step 3.
57
+
58
+ ### Step 3: API Key Authentication (Alternative)
59
+
60
+ Present:
61
+ ```
62
+ Let's set up Postman using an API key.
63
+
64
+ 1. Go to: https://go.postman.co/settings/me/api-keys
65
+ 2. Click "Generate API Key"
66
+ 3. Name it "Claude Code"
67
+ 4. Copy the key (starts with PMAK-)
68
+
69
+ Then set it as an environment variable:
70
+
71
+ export POSTMAN_API_KEY=PMAK-your-key-here
72
+
73
+ Add it to your shell profile (~/.zshrc or ~/.bashrc) to persist across sessions.
74
+ When done, let me know and I'll verify the connection.
75
+ ```
76
+
77
+ Wait for the user to confirm they've set the key. Then verify with `getAuthenticatedUser`.
78
+
79
+ **If 401:** "API key was rejected. Check for extra spaces or generate a new one at https://go.postman.co/settings/me/api-keys"
80
+
81
+ **If timeout:** "Can't reach the Postman MCP Server. Check your network and https://status.postman.com"
82
+
83
+ ### Step 4: Workspace Verification
84
+
85
+ After successful connection (either auth method):
86
+
87
+ 1. Call `getWorkspaces` to list workspaces.
88
+ 2. Call `getCollections` with the first workspace ID to count collections.
89
+ 3. Call `getAllSpecs` with the workspace ID to count specs.
90
+
91
+ Present:
92
+ ```
93
+ Connected as: <user name>
94
+
95
+ Your workspaces:
96
+ - My Workspace (personal) — 12 collections, 3 specs
97
+ - Team APIs (team) — 8 collections, 5 specs
98
+
99
+ You're all set.
100
+ ```
101
+
102
+ If workspace is empty:
103
+ ```
104
+ Your workspace is empty. You can:
105
+ /postman:sync — Push a local OpenAPI spec to Postman
106
+ /postman:search — Search for APIs across your org's resources or the public Postman network
107
+ ```
108
+
109
+ ### Step 5: Suggest First Command
110
+
111
+ Based on what the user has:
112
+
113
+ **Has collections:**
114
+ ```
115
+ Try one of these:
116
+ /postman:search — Find APIs across your workspace
117
+ /postman:test — Run collection tests
118
+ ```
119
+
120
+ **Has specs but no collections:**
121
+ ```
122
+ Try this:
123
+ /postman:sync — Generate a collection from one of your specs
124
+ ```
125
+
126
+ **Empty workspace:**
127
+ ```
128
+ Try this:
129
+ /postman:sync — Import an OpenAPI spec from your project
130
+ ```
131
+
132
+ ## Error Handling
133
+
134
+ - **MCP tools not available:** "The Postman MCP Server isn't loaded. Make sure the plugin is installed and restart Claude Code."
135
+ - **OAuth callback invalid:** "That URL doesn't look right — make sure you copied the full address bar URL including `?code=` and `&state=`."
136
+ - **OAuth flow expired:** "The authorization URL has expired. Run `/postman:setup` again to get a fresh one."
137
+ - **MCP server disconnected after OAuth:** The server restarts after saving credentials. Retry `getAuthenticatedUser` up to 3 times. If still unavailable, tell the user to restart Claude Code — the token is saved, no re-auth needed.
138
+ - **API key not set:** Walk through Step 3 above.
139
+ - **401 Unauthorized:** "Authentication failed. Try `/postman:setup` to re-authenticate via OAuth, or generate a new API key at https://go.postman.co/settings/me/api-keys"
140
+ - **Network timeout:** "Can't reach the Postman MCP Server. Check your network and https://status.postman.com for outages."
141
+ - **Plan limitations:** "Some features (team workspaces, monitors) require a paid Postman plan. Core commands work on all plans."
@@ -0,0 +1,85 @@
1
+ ---
2
+ description: Sync Postman collections with your API code. Create collections from specs, push updates, keep everything in sync.
3
+ allowed-tools: Bash, Read, Write, Glob, Grep, mcp__postman__getWorkspaces, mcp__postman__getCollections, mcp__postman__getCollection, mcp__postman__createSpec, mcp__postman__updateSpecFile, mcp__postman__generateCollection, mcp__postman__getAsyncSpecTaskStatus, mcp__postman__getGeneratedCollectionSpecs, mcp__postman__syncCollectionWithSpec, mcp__postman__syncSpecWithCollection, mcp__postman__getCollectionUpdatesTasks, mcp__postman__createEnvironment, mcp__postman__createCollectionRequest, mcp__postman__updateCollectionRequest, mcp__postman__createCollectionFolder, mcp__postman__createCollectionResponse
4
+ ---
5
+
6
+ # Sync Collections
7
+
8
+ Keep Postman collections in sync with your API code. Create new collections from OpenAPI specs, update existing ones when specs change, or push manual endpoint changes.
9
+
10
+ ## Prerequisites
11
+
12
+ The Postman MCP Server must be connected. If MCP tools aren't available, tell the user: "Run `/postman:setup` to configure the Postman MCP Server."
13
+
14
+ ## Workflow
15
+
16
+ ### Step 1: Understand What Changed
17
+
18
+ Detect or ask:
19
+ - Is there a local OpenAPI spec? Search for `**/openapi.{json,yaml,yml}`, `**/swagger.{json,yaml,yml}`
20
+ - Did the user add/remove/modify endpoints?
21
+ - Is there an existing Postman collection to update, or do they need a new one?
22
+
23
+ ### Step 2: Resolve Workspace
24
+
25
+ Call `getWorkspaces` to get the user's workspace ID. If multiple workspaces exist, ask which to use.
26
+
27
+ ### Step 3: Find or Create the Collection
28
+
29
+ **If updating an existing collection:**
30
+ 1. Call `getCollections` with the `workspace` parameter to list collections
31
+ 2. Match by name or ask the user which collection
32
+ 3. Call `getCollection` to get current state
33
+
34
+ **If creating a new collection from a spec:**
35
+ 1. Read the local OpenAPI spec
36
+ 2. Call `createSpec` with:
37
+ - `workspaceId`: the workspace ID
38
+ - `name`: from the spec's `info.title`
39
+ - `type`: one of `OPENAPI:2.0`, `OPENAPI:3.0`, `OPENAPI:3.1`, `ASYNCAPI:2.0`
40
+ - `files`: array of `{path, content}` objects
41
+ 3. Call `generateCollection` from the spec. **This is async (HTTP 202).** Poll `getAsyncSpecTaskStatus` or `getGeneratedCollectionSpecs` until complete, with increasing waits between polls (2s, 4s, 8s). Don't narrate intermediate poll results — report only the final outcome.
42
+ 4. Call `createEnvironment` with variables extracted from the spec:
43
+ - `base_url` from `servers[0].url`
44
+ - Auth variables from `securitySchemes` (mark as `secret`)
45
+ - Common path parameters
46
+
47
+ ### Step 4: Sync
48
+
49
+ **Spec to Collection (most common):**
50
+ 1. Call `createSpec` or `updateSpecFile` with local spec content
51
+ 2. Call `syncCollectionWithSpec` to update the collection. **Async (HTTP 202).** Poll `getCollectionUpdatesTasks` for completion with increasing waits between polls.
52
+ 3. **Note:** `syncCollectionWithSpec` only supports OpenAPI 3.0. For Swagger 2.0 or OpenAPI 3.1, use `updateSpecFile` and regenerate the collection.
53
+ 4. Report what changed
54
+
55
+ **Collection to Spec (reverse sync):**
56
+ 1. Call `syncSpecWithCollection` to update the spec from collection changes
57
+ 2. Write the updated spec back to the local file
58
+
59
+ **Manual updates (no spec):**
60
+ For individual endpoint changes:
61
+ 1. `createCollectionRequest` to add new endpoints
62
+ 2. `updateCollectionRequest` to modify existing ones
63
+ 3. `createCollectionFolder` to organize by resource
64
+ 4. `createCollectionResponse` to add example responses
65
+
66
+ ### Step 5: Confirm
67
+
68
+ ```
69
+ Collection synced: "Pet Store API" (15 requests)
70
+ Added: POST /pets/{id}/vaccinations
71
+ Updated: GET /pets — added 'breed' filter parameter
72
+ Removed: (none)
73
+
74
+ Environment: "Pet Store - Development" updated
75
+ Spec Hub: petstore-v3.1.0 pushed
76
+ ```
77
+
78
+ ## Error Handling
79
+
80
+ - **MCP not configured:** "Run `/postman:setup` to configure the Postman MCP Server."
81
+ - **MCP timeout:** Retry once. If `generateCollection` or `syncCollectionWithSpec` times out, the spec may be too large. Suggest breaking it into smaller specs by domain.
82
+ - **401 Unauthorized:** "Your Postman API key was rejected. Generate a new one at https://go.postman.co/settings/me/api-keys and run `/postman:setup`."
83
+ - **Invalid spec:** Report specific parse errors with line numbers. Offer to fix common YAML/JSON syntax issues.
84
+ - **Async operation stuck:** If polling shows no progress after 30 seconds, inform the user and suggest checking the Postman app directly.
85
+ - **Plan limitations:** "Workspace creation may be limited on free plans. Using your default workspace instead."
@@ -0,0 +1,84 @@
1
+ ---
2
+ description: Run Postman collection tests, analyze results, diagnose failures, and suggest fixes.
3
+ allowed-tools: Bash, Read, Write, Glob, Grep, mcp__postman__getWorkspaces, mcp__postman__getCollections, mcp__postman__getCollection, mcp__postman__runCollection, mcp__postman__getEnvironments, mcp__postman__getCollectionRequest, mcp__postman__getCollectionResponse, mcp__postman__updateCollectionRequest, mcp__postman__updateCollectionResponse
4
+ ---
5
+
6
+ # Run Collection Tests
7
+
8
+ Execute Postman collection tests directly from Claude Code. Analyze results, diagnose failures, and suggest code fixes.
9
+
10
+ ## Prerequisites
11
+
12
+ The Postman MCP Server must be connected. If MCP tools aren't available, tell the user: "Run `/postman:setup` to configure the Postman MCP Server."
13
+
14
+ ## Workflow
15
+
16
+ ### Step 1: Find the Collection
17
+
18
+ 1. Call `getWorkspaces` to find the target workspace
19
+ 2. Call `getCollections` with the `workspace` parameter. Use the `name` filter if the user specified a collection.
20
+ 3. If the user provides a collection ID directly, skip to Step 2.
21
+
22
+ ### Step 2: Run Tests
23
+
24
+ Call `runCollection` with the collection UID in `OWNER_ID-UUID` format. Get the UID from the `getCollection` response's `uid` field.
25
+
26
+ If the collection uses environment variables:
27
+ 1. Call `getEnvironments` to list available environments
28
+ 2. Ask which environment to use (or detect from naming convention)
29
+ 3. Pass the environment ID to `runCollection`
30
+
31
+ ### Step 3: Parse Results
32
+
33
+ Present results clearly:
34
+
35
+ ```
36
+ Test Results: Pet Store API
37
+ Requests: 15 executed
38
+ Passed: 12 (80%)
39
+ Failed: 3
40
+ Avg time: 245ms
41
+
42
+ Failures:
43
+ 1. POST /users → "Status code is 201" → Got 400
44
+ Request: createUser
45
+ Folder: User Management
46
+
47
+ 2. GET /users/{id} → "Response has email field" → Missing
48
+ Request: getUser
49
+ Folder: User Management
50
+
51
+ 3. DELETE /users/{id} → "Status code is 204" → Got 403
52
+ Request: deleteUser
53
+ Folder: User Management
54
+ ```
55
+
56
+ ### Step 4: Diagnose Failures
57
+
58
+ For each failure:
59
+ 1. Call `getCollectionRequest` to see the full request definition
60
+ 2. Call `getCollectionResponse` to see expected responses
61
+ 3. Check if the API source code is in the current project
62
+ 4. Explain what the test expected vs what happened
63
+ 5. If code is local, find the handler and suggest the fix
64
+
65
+ ### Step 5: Fix and Re-run
66
+
67
+ After fixing code:
68
+ 1. Offer to re-run: "Tests fixed. Want me to run the collection again?"
69
+ 2. Call `runCollection` again
70
+ 3. Show before/after comparison
71
+
72
+ ### Step 6: Update Collection (if needed)
73
+
74
+ If the tests themselves need updating (not the API):
75
+ - Call `updateCollectionRequest` to fix request bodies, headers, or test scripts
76
+ - Call `updateCollectionResponse` to update expected responses
77
+
78
+ ## Error Handling
79
+
80
+ - **MCP not configured:** "Run `/postman:setup` to configure the Postman MCP Server."
81
+ - **Collection not found:** "No collection matching that name. Run `/postman:search` to find available collections, or `/postman:sync` to create one."
82
+ - **401 Unauthorized:** "Your Postman API key was rejected. Generate a new one at https://go.postman.co/settings/me/api-keys and run `/postman:setup`."
83
+ - **MCP timeout:** Retry once. For large collections, suggest running a single folder to narrow the test run.
84
+ - **Plan limitations:** "Collection runs may require a Postman Basic plan or higher for increased limits."