REST-to-Postman MCP
REST 到 Postman MCP
一个模型上下文协议 (MCP) 服务器,用于将 REST API 代码(例如 NestJS 控制器、FastAPI/Flask 端点)转换为 Postman 集合和环境。此工具可帮助开发人员自动将其 REST API 端点和环境配置与 Postman 同步。
特征
将 REST API 端点转换为 Postman 集合
与 Postman 环境同步环境变量
支持各种身份验证方法(例如 Bearer token)
新端点与现有集合的智能合并
自动处理敏感环境变量
支持 stdio 和 SSE 传输模式
Related MCP server: Codebase Insights MCP Server
先决条件
Bun v1.2.2 或更高版本
Postman API 密钥
Postman 工作区 ID
安装和使用
这是一个模型上下文协议 (MCP) stdio 服务器,需要访问您的 Postman 工作区来创建/更新集合和环境。
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 REST-to-Postman MCP:
npx -y @smithery/cli install @runninghare/rest-to-postman-mcp --client claude使用npx运行 MCP 服务器
要将 MCP 服务器与npx一起使用:
npx -y rest-to-postman@latest --postman-api-key your_api_key --postman-workspace-id your_workspace_id或者使用环境变量:
export POSTMAN_API_KEY=your_api_key
export POSTMAN_ACTIVE_WORKSPACE_ID=your_workspace_id
npx -y rest-to-postman@latest 您可以将此命令与支持 MCP 的各种 AI 代码编辑器集成:
克劳德桌面
光标
风帆冲浪
Roo Cline 编辑
重要提示:服务器需要 Postman API 凭证才能运行。在启动服务器之前,请确保已准备好 API 密钥和工作区 ID。
工具描述
该服务器提供两个主要工具:
1. REST 到 Postman 环境( rest_to_postman_env )
使用应用程序的环境变量创建或更新 Postman 环境。
输入参数:
envName(字符串):Postman 环境的名称envVars(对象):环境变量的键值对
示例输入:
{
"envName": "REST Environment",
"envVars": {
"API_URL": "https://api.example.com",
"API_TOKEN": "secret-token-1"
}
}2. REST 到 Postman 集合( rest_to_postman_collection )
使用您的 REST API 端点创建或更新 Postman 集合。
输入参数:
collectionRequest(对象):Postman 收集配置包含:info:集合元数据auth:身份验证设置item:API 端点数组
示例输入:
{
"info": {
"name": "REST Collection",
"description": "REST Collection",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"auth": {
"type": "bearer",
"bearer": [
{
"key": "Authorization",
"value": "Bearer {{API_TOKEN}}",
"type": "string"
}
]
},
"item": [
{
"name": "Get Users",
"request": {
"method": "GET",
"url": {
"raw": "{{API_URL}}/users",
"protocol": "https",
"host": ["api", "example", "com"],
"path": ["users"]
}
}
}
]
}响应格式
两种工具都会返回一条成功消息,确认 Postman 资源的创建/更新:
{
"content": [{
"type": "text",
"text": "Successfully created/updated Postman environment: REST Environment"
}]
}在 Cursor 中使用此 MCP
您可以在 Cursor 中使用此 MCP 服务器。以下示例基于 Nest.js Typescript 控制器生成 Postman Collection。
迅速的:
Create a postman collection named "Campaign Endpoints" based on this next.js controller. The baseUrl is `http://localhost:7022`. The collection should have a Bear token which applies to all the endpoints这是自动生成的 Postman Collection:
请注意, Campaign Controller 的所有端点都已生成,同时还生成了 Bear 令牌设置。
发展
本地设置
克隆存储库:
git clone https://github.com/runninghare/rest-to-postman.git
cd rest-to-postman安装依赖项:
bun install创建
.env文件:
POSTMAN_API_KEY=your_api_key_here
POSTMAN_ACTIVE_WORKSPACE_ID=your_workspace_id_here以开发模式运行
对于开发,您可以直接使用 Bun 运行服务器:
# Start in stdio mode (default)
bun run src/mcp.ts
# Start in SSE mode
bun run src/mcp.ts --sse建筑
要构建项目:
bun run build这将在dist目录中创建捆绑输出。
脚本
bun run build构建项目bun run dev以开发模式运行服务器bun run startSSE以 SSE 模式启动服务器
贡献
欢迎贡献代码!欢迎提交 Pull 请求。
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。
Available Tools
2 toolsrest_to_postman_collectionA
Creates or updates a Postman collection with the provided collection configuration. This tool helps synchronize your REST API endpoints with Postman. When updating an existing collection, it intelligently merges the new endpoints with existing ones, avoiding duplicates while preserving custom modifications made in Postman. Here's an example:
{
"info": {
"name": "REST Collection",
"description": "REST Collection",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"auth": {
"type": "bearer",
"bearer": [
{
"key": "Authorization",
"value": "Bearer {{API_TOKEN}}",
"type": "string"
}
]
},
"item": [
{
"name": "Get Users",
"request": {
"method": "GET",
"url": {
"raw": "{{API_URL}}/users",
"protocol": "https",
"host": ["api", "example", "com"],
"path": ["users"]
}
}
},
{
"name": "Create User",
"request": {
"method": "POST",
"url": {
"raw": "{{API_URL}}/users"
},
"body": {
"mode": "raw",
"raw": "{"name":"John Doe","email":"john.doe@example.com"}"
}
}
}
]
}
Inputs: collectionRequest (required).
rest_to_postman_envA
Creates or updates a Postman environment with the provided environment variables. This tool helps synchronize your REST application's environment configuration with Postman. It supports both creating new environments and updating existing ones in your Postman workspace. Environment variables related to sensitive data (containing 'token' in their names) are automatically marked as secrets. Here's an example:
{ "envName": "REST Environment", "envVars": { "API_URL": "https://api.example.com", "API_TOKEN": "secret-token-1" } }
Inputs: envName (required), envVars (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have completely distinct purposes: one handles Postman collections (API endpoint configurations), while the other handles Postman environments (environment variables). There is no overlap in functionality, making it impossible to confuse them.
Both tools follow a perfect 'rest_to_postman_' prefix pattern with descriptive suffixes ('collection' and 'env'). The naming is completely consistent in style and structure throughout the set.
With only 2 tools, this server feels severely under-scoped for a REST-to-Postman integration purpose. A complete synchronization system would typically need tools for operations like listing collections/environments, deleting resources, or handling authentication flows, not just create/update operations.
The toolset is significantly incomplete for REST-to-Postman synchronization. While create/update operations exist for collections and environments, there are no tools for reading existing resources, deleting them, managing workspaces, or handling more complex Postman features like monitors or mocks. This creates dead ends for agents trying to perform full lifecycle management.
Related MCP Connectors
AI-callable tools for API mocking, testing, monitoring, security, and automation.
End-to-end API testing — generate and run tests from OpenAPI, curl, Postman, or real user traffic.
Give your AI agents trusted access to the full Postman platform.
Discover, compare, and monitor 1,400+ APIs directly from your AI coding agent.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAutomatically converts Postman API collections into MCP-compatible tools for AI assistants. Enables users to interact with any API through natural language by generating JavaScript tools from Postman requests.MIT
- AlicenseNot gradedqualityDmaintenanceAnalyzes API codebases from GitHub and Bitbucket repositories to generate Postman collections, business reports, and detailed code insights. Supports multiple frameworks including FastAPI, Spring Boot, Flask, Express, and OpenAPI/Swagger specifications.MIT
- AlicenseAqualityDmaintenanceIntegrates Postman with Cursor IDE to manage collections and requests through natural language. It features specialized tools for automatically migrating API endpoints and metadata directly from .NET controller code into Postman collections.8MIT
- AlicenseBqualityDmaintenanceAutomatically generates Postman collections from code directories by analyzing API endpoints and parameters, enabling easy testing, documentation, and sharing.143MIT