Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .cursor-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "postman",
"version": "1.1.0",
"description": "Full API lifecycle management for Cursor. Sync collections, generate client code, discover APIs, run tests, create mocks, improve docs, and audit security. Powered by the Postman MCP Server.",
"version": "1.2.0",
"description": "Full API lifecycle management for Cursor. Sync collections, generate OpenAPI specs, discover APIs, run tests and Flows, create mocks, improve docs, and audit security. Powered by the Postman MCP Server.",
"author": {
"name": "Postman DevRel",
"url": "https://www.postman.com"
Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ section into a dated, versioned entry when a release is cut — see [RELEASING.m

## [Unreleased]

## [1.2.0] - 2026-08-02

### Added

- Nine commands to reach the canonical **18-command** set shared with the [Claude Code](https://github.com/Postman-Devrel/postman-claude-code-plugin) and Antigravity plugins: `/postman:run-collection`, `/postman:send-request`, `/postman:list-flows`, `/postman:trigger-flow`, `/postman:deploy-flow`, `/postman:get-flow-run`, `/postman:use-local`, and `/postman:use-remote`. The Flow, `run-collection`, and `send-request` commands drive the Postman CLI; `use-local` / `use-remote` toggle `.mcp.json` between the local stdio package and the hosted server (both API-key authenticated).
- `/postman:generate-client` — generate typed client code **from** a Postman collection. This preserves the client-code-generation capability of the pre-rename `codegen` command (distinct from `/postman:generate-spec`, which generates an OpenAPI spec **from** your code). MCP-tool-driven; requires Code or Full MCP mode.

### Changed

- Renamed `/postman:codegen` to `/postman:generate-spec` and reworked it to generate or update an OpenAPI 3.0 spec from the codebase, matching the canonical command shared across Postman's AI coding plugins. The original client-code-generation capability is preserved as the distinct `/postman:generate-client` command (see Added). Updated the README, routing skill, and knowledge skill references accordingly.
- Updated README installation instructions: Postman is now an official [Cursor Marketplace](https://cursor.com/marketplace/postman) plugin.

## [1.1.0] - 2026-07-20
Expand Down Expand Up @@ -45,5 +53,6 @@ section into a dated, versioned entry when a release is cut — see [RELEASING.m

[1.0.1]: https://github.com/Postman-Devrel/cursor-postman-plugin/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/Postman-Devrel/cursor-postman-plugin/releases/tag/1.0.0
[Unreleased]: https://github.com/Postman-Devrel/cursor-postman-plugin/compare/1.1.0...HEAD
[Unreleased]: https://github.com/Postman-Devrel/cursor-postman-plugin/compare/1.2.0...HEAD
[1.2.0]: https://github.com/Postman-Devrel/cursor-postman-plugin/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/Postman-Devrel/cursor-postman-plugin/compare/1.0.1...1.1.0
109 changes: 99 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Postman Plugin for Cursor

Full API lifecycle management inside Cursor. Sync collections, generate typed client code, discover APIs, run tests, create mocks, improve documentation, and audit security. Powered by the [Postman MCP Server](https://github.com/postmanlabs/postman-mcp-server).
Full API lifecycle management inside Cursor. Sync collections, generate OpenAPI specs and typed clients, discover APIs, run tests, create mocks, run Flows, improve documentation, and audit security. Powered by the [Postman MCP Server](https://github.com/postmanlabs/postman-mcp-server).

> **Note:** This plugin mirrors the [Postman Plugin for Claude Code](https://github.com/Postman-Devrel/postman-claude-code-plugin), which is the source of truth for Postman's AI coding agent plugins.

## What This Plugin Does

This plugin connects Cursor to your Postman account via the Postman MCP Server and bundles purpose-built commands, skills, and an API readiness analyzer. One install gives you:

- **9 commands** covering the complete API lifecycle
- **18 commands** covering the complete API lifecycle (the canonical command set shared with the [Claude Code](https://github.com/Postman-Devrel/postman-claude-code-plugin) and Antigravity plugins)
- **3 auto-loaded skills** that teach the agent how to use Postman effectively
- **1 sub-agent** for deep API readiness analysis (48 checks across 8 pillars)
- **API design rules** injected into every session
Expand Down Expand Up @@ -87,12 +87,23 @@ Creating collection "Pet Store API" with 15 endpoints...
Collection synced. Environment "Pet Store - Dev" created.
```

### `/postman:codegen` -- Generate Client Code
### `/postman:generate-spec` -- Generate an OpenAPI Spec

Generate typed client code from any Postman collection. Detects your project language and matches existing conventions.
Generate or update an OpenAPI 3.0 spec by scanning the API routes in your codebase, then validate it with the Postman CLI.

```
> /postman:codegen
> /postman:generate-spec
Scanned 8 routes in src/routes/
Wrote postman/specs/openapi.yaml (8 endpoints, 4 schemas)
Validation: passed
```

### `/postman:generate-client` -- Generate Client Code

Generate typed client code from any Postman collection. Detects your project language and matches existing conventions. (The inverse of `generate-spec`: client code **from** a collection, rather than a spec **from** your code.)

```
> /postman:generate-client
Which collection? "User Management API"
Detected: TypeScript project
Generated: src/clients/user-management-api.ts (5 endpoints, 8 types)
Expand Down Expand Up @@ -163,14 +174,83 @@ Ask "how do I..." questions about Postman itself and how to accomplish workflows
Source: learning.postman.com/docs/design-apis/mock-apis/...
```

### `/postman:run-collection` -- Run a Collection (CLI)

Run a Postman collection with the Postman CLI, then parse the results and diagnose failures.

```
> /postman:run-collection
Running collection 12345678-...
Passed: 14/15 -- diagnosing the 1 failure...
```

### `/postman:send-request` -- Send an HTTP Request (CLI)

Send a single ad-hoc HTTP request with the Postman CLI and report the response.

```
> /postman:send-request GET https://api.example.com/health
200 OK (82ms) -- {"status":"healthy"}
```

### `/postman:list-flows` -- List Flows

List Postman Flows in a workspace and resolve a flow name to its 24-character ID.

```
> /postman:list-flows
Checkout -- 6634a1... (last run: passed)
Onboarding -- 6634b2... (last run: failed)
```

### `/postman:trigger-flow` -- Trigger a Flow

Trigger a deployed Postman Flow with inputs from natural language, and report the Run ID, status, and response.

```
> /postman:trigger-flow Checkout with amount 4200
Run ID: run_abc123 Status: 200 Body: {"ok":true}
```

### `/postman:deploy-flow` -- Deploy a Flow

Deploy a Postman Flow so it becomes triggerable, confirming the trigger path first (deploy is mutating).

```
> /postman:deploy-flow Checkout
Proposed path: /checkout -- confirm? (y/n)
Deployed. Trigger URL: https://... Trigger: enabled
```

### `/postman:get-flow-run` -- Inspect a Flow Run

Inspect a Flow run by its Run ID -- per-block logs, the failing block, and status.

```
> /postman:get-flow-run run_abc123
Status: failed Failing block: "Charge Card" (502 from upstream)
```

### `/postman:use-local` -- Use the Local MCP Server

Rewrite this plugin's `.mcp.json` to run the Postman MCP server locally over stdio (`npx @postman/postman-mcp-server@latest`), authenticated with your `POSTMAN_API_KEY`.

### `/postman:use-remote` -- Use the Remote MCP Server

Rewrite this plugin's `.mcp.json` back to Postman's hosted MCP server (`https://mcp.postman.com/mcp`), authenticated with your API key.

## Auto-Routing

You don't have to remember command names. The plugin includes a routing skill that maps natural language to the right command:

| You say | Plugin runs |
|---------|------------|
| "Sync my API with Postman" | `/postman:sync` |
| "Generate a Python client for the payments API" | `/postman:codegen` |
| "Generate an OpenAPI spec from my API code" | `/postman:generate-spec` |
| "Generate a Python client for the payments API" | `/postman:generate-client` |
| "Run the checkout collection" | `/postman:run-collection` |
| "Trigger the Checkout flow with amount 4200" | `/postman:trigger-flow` |
| "Run the Postman MCP server locally" | `/postman:use-local` |
| "What endpoints do we have for orders?" | `/postman:search` |
| "Run my API tests" | `/postman:test` |
| "I need a mock for frontend dev" | `/postman:mock` |
Expand All @@ -194,7 +274,7 @@ See `examples/sample-readiness-report.md` for a sample output.

### MCP Server Modes

This plugin defaults to **Code mode** (~45-50 tools), which covers 8 of 9 commands fully. The only gap is documentation publishing (available in Full mode only).
This plugin ships with the Full (`https://mcp.postman.com/mcp`) endpoint in `.mcp.json`, which covers every MCP-based command including documentation publishing. The Flow, `run-collection`, `send-request`, and `generate-spec` commands drive the Postman CLI instead of MCP, so they work regardless of the MCP mode. Use `/postman:use-remote` or `/postman:use-local` to switch the MCP transport at any time.

**Code mode (default):**
```json
Expand Down Expand Up @@ -243,16 +323,25 @@ cursor-postman-plugin/
├── .cursor-plugin/
│ └── plugin.json # Plugin manifest
├── .mcp.json # Postman MCP server config (Code mode)
├── commands/
├── commands/ # 18 commands (canonical cross-plugin set)
│ ├── setup.md # /postman:setup
│ ├── sync.md # /postman:sync
│ ├── codegen.md # /postman:codegen
│ ├── generate-spec.md # /postman:generate-spec
│ ├── generate-client.md # /postman:generate-client
│ ├── search.md # /postman:search
│ ├── test.md # /postman:test
│ ├── run-collection.md # /postman:run-collection
│ ├── send-request.md # /postman:send-request
│ ├── mock.md # /postman:mock
│ ├── docs.md # /postman:docs
│ ├── security.md # /postman:security
│ └── learn.md # /postman:learn
│ ├── learn.md # /postman:learn
│ ├── list-flows.md # /postman:list-flows
│ ├── trigger-flow.md # /postman:trigger-flow
│ ├── deploy-flow.md # /postman:deploy-flow
│ ├── get-flow-run.md # /postman:get-flow-run
│ ├── use-local.md # /postman:use-local
│ └── use-remote.md # /postman:use-remote
├── skills/
│ ├── postman-routing/ # Auto-routes intent to commands
│ ├── postman-knowledge/ # Postman concepts + MCP guidance
Expand Down
57 changes: 57 additions & 0 deletions commands/deploy-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
description: Deploy a Postman Flow so it becomes triggerable, proposing and confirming a trigger path.
allowed-tools: Bash, Read
---

# /postman:deploy-flow -- Deploy a Flow

Deploy a Postman Flow with the Postman CLI so it becomes triggerable. Deploy is mutating — always confirm before running it.

## Prerequisites

This command drives the Postman CLI (`postman flows ...`). If the CLI isn't installed, see https://learning.postman.com/docs/postman-cli/postman-cli-installation/. The CLI authenticates with the same `POSTMAN_API_KEY` this plugin uses — if it's not logged in, run `postman login --with-api-key $POSTMAN_API_KEY`. Reuse the existing CLI session; never authenticate twice.

## Inputs (from the user's message)

- The flow (a 24-character ID, or a name to resolve via `/postman:list-flows`)
- Optionally a desired trigger path and whether auth is required

## Workflow

### Step 1: Resolve the Flow ID

Use `/postman:list-flows` if given a name; ask for the workspace if unknown.

### Step 2: Propose and Confirm

Propose a trigger path derived from the flow name (e.g. "Checkout" → `/checkout`) and **confirm the path and the deploy action** with the user. Deploy is mutating and MUST NOT run without explicit confirmation.

### Step 3: Deploy

Show the command, then run it after confirmation:

```bash
POSTMAN_CLI_SOURCE=cursor-plugin postman flows deploy <flowId> --path /checkout
```

### Step 4: Report

Report the **Trigger URL** and whether the **trigger is enabled**. If it's off, offer `postman flows update <flowId> --trigger on` (confirm first).

### Step 5: Hand Off

If this was part of a deploy-then-trigger request, hand back to `/postman:trigger-flow` to run it.

## Error Handling

| Error | Response |
|-------|----------|
| Postman CLI not installed | "This command needs the Postman CLI. Install it from https://learning.postman.com/docs/postman-cli/postman-cli-installation/ and try again." |
| Flow not found | "I couldn't find that flow. Run /postman:list-flows to see what's in the workspace." |
| Deploy not confirmed | "Deploy is a mutating action — I'll wait for your explicit go-ahead on the trigger path before deploying." |
| Auth failure | "Postman returned 401. Run `postman login --with-api-key $POSTMAN_API_KEY`, or /postman:setup to reconfigure." |

## Related Commands

- Resolve a flow name to an ID -> `/postman:list-flows`
- Run the deployed flow -> `/postman:trigger-flow`
6 changes: 5 additions & 1 deletion commands/codegen.md → commands/generate-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ description: Generate typed client code from Postman collections. Reads your pri
allowed-tools: Bash, Read, Write, Glob, Grep, mcp__postman__*
---

# /postman:codegen -- Generate Client Code
# /postman:generate-client -- Generate Client Code

Generate typed client code from Postman collections. Reads your private APIs and writes production-ready client code that matches your project conventions.

> This is the inverse of `/postman:generate-spec` (which writes an OpenAPI spec **from** your code). This command writes client code **from** a Postman collection.

## Prerequisites

Postman MCP Server must be configured. If MCP tools fail, tell the user to run `/postman:setup`.

**MCP mode:** requires **Code** or **Full** mode — the code-generation tools (`getCodeGenerationInstructions`, etc.) are absent in `minimal`. This plugin's `.mcp.json` points at the Full endpoint (`https://mcp.postman.com/mcp`), so it works out of the box.

## Workflow

### Step 1: Find the API
Expand Down
92 changes: 92 additions & 0 deletions commands/generate-spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
description: Generate or update an OpenAPI 3.0 spec by analyzing the API routes in your codebase.
allowed-tools: Bash, Read, Write, Glob, Grep
---

# /postman:generate-spec -- Generate an OpenAPI Spec

Generate or update an OpenAPI 3.0 specification by analyzing the API routes in your codebase. Scan the project for route definitions, derive schemas from the code, write a valid spec, and validate it.

## Prerequisites

The Postman CLI is used to validate the generated spec (`postman spec lint`). If it isn't installed, see https://learning.postman.com/docs/postman-cli/postman-cli-installation/. The CLI authenticates with the same `POSTMAN_API_KEY` this plugin uses — if it's not logged in, run `postman login --with-api-key $POSTMAN_API_KEY`. Validation is optional; if the CLI is unavailable, still write the spec and tell the user to lint it later.

## Workflow

### Step 1: Check for an Existing Spec

```bash
ls postman/specs/**/*.yaml postman/specs/**/*.yml postman/specs/**/*.json 2>/dev/null
ls openapi.yaml openapi.yml swagger.yaml swagger.yml 2>/dev/null
```

If a spec exists, read it to understand the current state. You'll update it rather than replace it.

### Step 2: Discover API Endpoints

Scan the project for route definitions based on the framework:

- **Express/Node**: `app.get()`, `router.post()`, `@Get()` (NestJS)
- **Python**: `@app.route()`, `@router.get()` (FastAPI), `path()` (Django)
- **Go**: `http.HandleFunc()`, `r.GET()` (Gin/Echo)
- **Java**: `@GetMapping`, `@PostMapping`, `@RequestMapping`
- **Ruby**: `get`, `post`, `resources` in `routes.rb`

Read the route files and extract methods, paths, parameters, request bodies, response schemas, and auth requirements.

### Step 3: Generate or Update the Spec

Write a valid OpenAPI 3.0.3 YAML spec including:

- `info` with title, version, and description
- `servers` with a local dev URL
- `paths` with all discovered endpoints
- `components/schemas` with models derived from the code (types, models, structs)
- `components/securitySchemes` if auth is used

**When updating**: add new endpoints, update changed ones, and remove endpoints no longer in the code. Preserve existing descriptions and examples.

**When creating**: write to `postman/specs/openapi.yaml`.

### Step 4: Validate

```bash
postman spec lint ./postman/specs/openapi.yaml
```

Fix any validation errors and re-run until clean.

### Step 5: Report

Show what was created or changed:

```
Spec written: postman/specs/openapi.yaml

Endpoints documented: 8
GET /users
GET /users/{id}
POST /users
... and 5 more

Schemas defined: User, CreateUserRequest, UserListResponse, Error
Security schemes: bearerAuth
Validation: passed (0 errors, 0 warnings)
```

When updating, also summarize the changes from the previous spec (added / updated / removed endpoints).

## Error Handling

| Error | Response |
|-------|----------|
| No routes found | "I couldn't find API route definitions in this project. Tell me where your routes live, or which framework you're using." |
| Can't detect framework | "I can't tell which web framework this project uses. Point me at the routing file and I'll take it from there." |
| Validation errors | "The generated spec has validation issues — I'll fix them and re-lint until it's clean." |
| Postman CLI not installed | "I wrote the spec but couldn't validate it — the Postman CLI isn't installed. Install it, then run `postman spec lint ./postman/specs/openapi.yaml`." |
| Auth failure | "Postman returned 401. Your API key may be expired. Run /postman:setup to reconfigure." |

## Related Commands

- Push the generated spec to Postman as a collection -> `/postman:sync`
- Run the collection's tests -> `/postman:test`
Loading
Loading