Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mpx-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
mpx-api ๐
Developer-first API testing, mocking, and documentation CLI.
No GUI. No proprietary formats. Just powerful, git-friendly API testing from your terminal.
Part of the Mesaplex developer toolchain.
Features
- Git-friendly โ Collections are YAML files, not proprietary blobs
- CI/CD ready โ Exit codes, JSON output, no GUI dependency
- Beautiful terminal output with syntax highlighting
- Request chaining โ Use response data from one request in another
- Built-in mock server โ Test against OpenAPI specs without deploying (Pro)
- Load testing โ RPS control, percentile reporting (Pro)
- Doc generation โ Generate API docs from collections (Pro)
- MCP server โ Integrates with any MCP-compatible AI agent
- Self-documenting โ
--schemareturns machine-readable tool description
Installation
npm install -g mpx-apiOr run directly with npx:
npx mpx-api get https://api.github.com/users/octocatRequirements: Node.js 18+ ยท No native dependencies ยท macOS, Linux, Windows
Quick Start
# Simple GET request
mpx-api get https://jsonplaceholder.typicode.com/users
# POST with JSON
mpx-api post https://api.example.com/users --json '{"name":"Alice"}'
# Custom headers
mpx-api get https://api.example.com/protected \
-H "Authorization: Bearer $TOKEN"
# Verbose output (show headers)
mpx-api get https://httpbin.org/get -v
# Quiet mode (only response body)
mpx-api get https://api.example.com/data -qUsage
HTTP Requests
Supports get, post, put, patch, delete, head, and options:
mpx-api get https://api.example.com/users
mpx-api post https://api.example.com/users --json '{"name":"Bob"}'
mpx-api put https://api.example.com/users/1 --json '{"name":"Alice"}'
mpx-api delete https://api.example.com/users/1Collections
Collections are YAML files for repeatable API test suites:
# Initialize collection in your project
mpx-api collection init
# Add requests
mpx-api collection add get-users GET /users
mpx-api collection add create-user POST /users --json '{"name":"Bob"}'
# Run the collection
mpx-api collection runCollection file format (.mpx-api/collection.yaml):
name: My API Tests
baseUrl: https://api.example.com
requests:
- name: get-users
method: GET
url: /users
headers:
Authorization: Bearer {{env.API_TOKEN}}
assert:
status: 200
body.length: { gt: 0 }
responseTime: { lt: 500 }
- name: get-specific-user
method: GET
url: /users/{{get-users.response.body[0].id}}
assert:
status: 200Features: request chaining ({{request.response.body.id}}), environment variables ({{env.VAR}}), built-in assertions.
Environments
mpx-api env init # Create dev, staging, production
mpx-api env set staging API_URL=https://... # Set variables
mpx-api env list # List environments
mpx-api collection run --env staging # Run with environmentTesting & Assertions
mpx-api test ./collection.yaml
mpx-api test ./collection.yaml --env production
mpx-api test ./collection.yaml --json
mpx-api test ./collection.yaml --pdf report.pdf # Export PDF reportAssertion operators: gt, lt, gte, lte, eq, ne, contains, exists
Request History
mpx-api history # View recent requests
mpx-api history -n 50 # Last 50Mock Server (Pro)
mpx-api mock ./openapi.yaml --port 4000Load Testing (Pro)
mpx-api load https://api.example.com/health --rps 100 --duration 30sDocumentation Generation (Pro)
mpx-api docs ./collection.yaml --output API.mdAI Agent Usage
mpx-api is designed to be used by AI agents as well as humans.
JSON Output
Add --json to any command for structured, machine-readable output:
mpx-api get https://api.github.com/users/octocat --json{
"request": {
"method": "GET",
"url": "https://api.github.com/users/octocat",
"headers": {},
"body": null
},
"response": {
"status": 200,
"statusText": "OK",
"headers": { "content-type": "application/json" },
"body": { "login": "octocat" },
"responseTime": 145,
"size": 1234
}
}Schema Discovery
mpx-api --schemaReturns a complete JSON schema describing all commands, flags, inputs, outputs, and examples.
MCP Integration
Add to your MCP client configuration (Claude Desktop, Cursor, Windsurf, etc.):
{
"mcpServers": {
"mpx-api": {
"command": "npx",
"args": ["mpx-api", "mcp"]
}
}
}The MCP server exposes these tools:
http_requestโ Send HTTP requests with full control over method, headers, bodyget_schemaโ Get the complete tool schema for dynamic discovery
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success (2xx or 3xx HTTP status) |
| 1 | Request failed or 4xx/5xx HTTP status |
Automation Tips
- Use
--jsonfor machine-parseable output - Use
--quietto suppress banners and progress info - Pipe output to
jqfor filtering - Check exit codes for pass/fail in CI/CD
CI/CD Integration
# .github/workflows/api-tests.yml
- name: Run API Tests
run: npx mpx-api test ./tests/api-collection.yaml --env stagingFree vs Pro
| Feature | Free | Pro |
|---|---|---|
| HTTP requests | โ | โ |
| Collections & chaining | โ | โ |
| Environments | โ | โ |
| Assertions & testing | โ | โ |
| JSON output | โ | โ |
| MCP server | โ | โ |
| Mock server | โ | โ |
| Load testing | โ | โ |
| Doc generation | โ | โ |
Upgrade to Pro: https://mesaplex.com/mpx-api
License
Dual License โ Free tier for personal use, Pro license for commercial use and advanced features. See LICENSE for full terms.
Links
- Website: https://mesaplex.com
- npm: https://www.npmjs.com/package/mpx-api
- GitHub: https://github.com/mesaplexdev/mpx-api
- Support: support@mesaplex.com
Related Tools
- mpx-scan โ Website security scanner
- mpx-db โ Database management CLI
- mpx-secrets-audit โ Secret lifecycle tracking and audit
Made with โค๏ธ by Mesaplex