api-mcp
Detects Angular HttpClient calls to discover API endpoints in Angular codebases.
Detects axios HTTP requests, including custom instances, to discover API endpoints.
Detects http, Dio, Retrofit-dart, and Chopper calls in Dart code to discover API endpoints.
Reads .env files to auto-detect the API base URL.
Detects Express router routes to discover server-side API endpoints.
Detects FastAPI route decorators to discover API endpoints.
Detects Fastify router routes to discover API endpoints.
Detects Flask route decorators to discover API endpoints.
Detects http, Dio, and other HTTP calls in Flutter apps to discover API endpoints.
Detects jQuery $.get, $.post, $.ajax calls to discover API endpoints.
Detects Koa router routes to discover API endpoints.
Detects Retrofit @GET and other annotations in Kotlin code to discover API endpoints.
Detects NestJS decorators (@Get, @Post, etc.) to discover API endpoints.
Detects Spring @GetMapping, @PostMapping, etc., to discover API endpoints.
Detects Alamofire requests in Swift code to discover API endpoints.
Detects SWR hook usage to discover API endpoints.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@api-mcp Run a QA audit on this project with role logins."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
api-mcp
š¦ Published on npm:
@hassanjamal/api-mcpā install withnpm i -g @hassanjamal/api-mcp(no cloning or building needed).
An MCP (Model Context Protocol) server you plug into any codebase ā React Native, web, Flutter, or a backend ā that:
Discovers every API endpoint in the code (client calls and server routes)
Reads or generates an OpenAPI / Swagger spec (if none exists, it builds one)
Generates test cases + edge cases for each endpoint, based on its HTTP method and params
Auto-logs in per role (from just credentials ā finds the login endpoint, extracts the token)
Harvests real IDs from responses + JWTs and injects the right resource id into each path param
Executes them against your running server ā like Postman ā scoped to each role's real permissions
Reports everything as PDF + XLSX (per-role + an overall audit + the endpoint inventory)
The QA one-call (qa_audit) does all of it from a project path + role logins. All artifacts are
written to a .api-mcp/ folder inside the project you point it at.
What it detects
Platform | Frameworks / libraries detected |
Web |
|
React Native |
|
Flutter / Dart |
|
Mobile native | Retrofit (Android/Kotlin |
Backend routes | Express / Fastify / Koa |
Detection is text/pattern based, so it works on any language without running the code, and
handles both :param / {param} / <param> styles and JS ${...} / Dart $var interpolation.
Every framework above is covered by the regression suite (npm test) so accuracy can't silently
regress.
Related MCP server: REST API MCP Server
Install
Install once, globally ā this gives a fast, reliable api-mcp command:
npm i -g @hassanjamal/api-mcpRequires Node.js 18+. Global install is recommended over
npxbecausenpxre-checks the registry on every launch (~6s) and can trip a host's connection health-check; the global binary starts in ~1s.
Connect it to a host
An MCP server does nothing on its own ā a host (the app you chat with an AI in) connects to it and exposes its tools. Pick your host:
Claude Code
Register it once for all your projects (user scope):
claude mcp add -s user api-mcp -- api-mcpVerify: claude mcp list ā api-mcp - ā Connected. (Mind the spacing: -- api-mcp.)
Cursor
Settings ā MCP ā Add new server, or edit ~/.cursor/mcp.json:
{
"mcpServers": {
"api-mcp": { "command": "api-mcp" }
}
}Claude Desktop
Edit claude_desktop_config.json (Windows: %APPDATA%\Claude\claude_desktop_config.json):
{
"mcpServers": {
"api-mcp": { "command": "api-mcp" }
}
}Restart the host after editing config. The tools (and the /qa-audit, /scan slash commands)
then appear to the AI.
Updating: npm i -g @hassanjamal/api-mcp@latest
Slash commands (Claude Code)
Two guided entry points show up as slash commands:
Command | Does |
| Prompts for base URL + role logins, then runs the full read-only per-role audit |
| Scans the current project and summarizes the endpoints found |
You can also just ask in natural language (see below) ā the slash commands are a convenience.
Tools exposed
Tool | What it does |
| Scan a project and list every endpoint found. Writes |
| Report any existing Swagger/OpenAPI spec in the project. |
| Build an OpenAPI 3.0 spec from the code (JSON or YAML). Reuses an existing spec unless told otherwise. |
| Produce happy-path / edge / negative / security test cases. Writes |
| Execute the tests against your live server and save responses + a report. |
| One call that runs the entire pipeline end-to-end. |
| Regenerate the HTML report + colorful XLSX from already-saved JSON. |
| Auto-detect the API base URL from |
| Auto-detect the login endpoint, post credentials, and extract the token. |
| QA one-call: role credentials ā auto-login ā role-scoped, precise-ID testing ā PDF + XLSX reports. |
Once connected, just ask the AI in natural language, e.g.:
"Run a full API audit on this project against http://localhost:3000 using my API_TOKEN."
The AI will call full_audit with the right arguments.
QA workflow (the easy path)
A QA engineer provides only credentials per role ā the tool figures out the rest (base URL, login endpoint, token extraction, per-role runs):
"Run a qa_audit on this project with admin
a@x.com / pw, teachert@x.com / pw, students@x.com / pw."
qa_audit then:
Detects the API base URL from the code (
.env, axios/DartbaseURL) ā or you passbaseUrlLogs in as each role, extracting the token from the response or the JWT (
token,accessToken,data.token,jwtā¦)Harvests real resource IDs from every response + each JWT and injects the correct id into each path param (
{courseId}ā a real course id; a bare{id}ā that endpoint's own resource), preferring ids the current role can access ā turning wrong-id404s into real200sScopes each role to endpoints its route-guard permits (reads
authorizeAdmin(),@Roles('teacher')ā¦), so you get more200s and far less403/404noiseSkips session-breaking endpoints (logout/refresh/delete-account/password/register) so a test can't revoke its own token, and paces around rate limits (marks throttled requests not tested, not failed)
Writes PDF + XLSX only ā overall
qa-audit.pdf, per-roleqa-report-{role}.pdf/.xlsx, andendpoints.pdf/.xlsx
Read-only by default. Useful arguments:
Argument | Default | Effect |
| ā |
|
| auto-detect | API base URL |
|
| also run POST/PUT/PATCH/DELETE (throwaway/staging only) |
|
| test each role only on endpoints its guard permits ( |
|
| also test logout/refresh/delete-account/password/register |
|
| max pacing wait per request; raise (e.g. |
Web vs mobile ā what to provide
The tool always tests the HTTP API, so the inputs are the same for both. The only difference is which source files get scanned for endpoints.
Web app | Mobile app (React Native / Flutter / native) | |
Provide | API base URL* + role credentials | API base URL* + role credentials ā same |
Base URL source | frontend | the app's config/constants (the backend it calls) |
What's scanned | JS/TS ( | Dart ( |
Execution | identical | identical |
Understanding the results (why not all 200s?)
A healthy API returns a mix of status codes under automated testing ā that's it correctly guarding itself, not a sign it's broken. Each request passes gates in order; the status tells you which gate stopped it:
Status | Meaning | A problem? |
200 | Worked ā returned data | ā success |
400 | Request incomplete/malformed (missing query param, wrong id type) | ā No ā validation working |
401 | Wrong identity for that endpoint | ā No ā auth working |
403 | Role/owner not permitted | ā No ā RBAC working (the inverse curve across roles proves it) |
404 | That resource doesn't exist for this user | ā No ā correct "not found" |
500 | Server crashed (unhandled exception) | š“ Yes ā the real bug to fix |
You can't (and shouldn't) get all-200s from automated testing ā that would mean the API accepts
anything. Only the 500s indicate actual defects.
*The base URL is auto-detected when possible; a mobile app has no "app URL" of its own ā you give the backend API URL it talks to (which lives in the app's config).
Configuration
Live execution needs to know your server URL and auth. Provide it either per tool call
(baseUrl, bearerToken, headers arguments) or via a config file in the target project root.
Copy api-mcp.config.example.json to api-mcp.config.json:
{
"baseUrl": "http://localhost:3000",
"bearerToken": "${API_TOKEN}",
"headers": { "X-Api-Key": "${API_KEY}" },
"timeoutMs": 15000,
"sampleValues": { "id": 1, "body": { "name": "example" } }
}${ENV_VAR} references are expanded from the environment, so secrets stay out of the file.
Secret-looking headers are redacted in saved reports.
Output artifacts (.api-mcp/)
File | Contents |
|
File | Contents |
| Overall report ā KPIs, role matrix, and a "how to read the statuses" guide |
| Per-role results (status summary + full request/response table) |
| The discovered-endpoint inventory |
The other tools (scan_endpoints, generate_openapi, run_tests, full_audit) also write:
File | Contents |
| Endpoint inventory (Markdown + color-coded web page) |
| Structured endpoint list |
| Generated OpenAPI 3.0 spec (open in https://editor.swagger.io) |
| The full generated test plan |
| Pass/fail summary + status codes + failure details |
| Colorful multi-sheet spreadsheet ā Summary, Endpoints, Test Results |
| Full request/response record for every test |
The HTML & XLSX outputs
.htmlreports are self-contained (no internet needed), color-coded by result and status code, and adapt to light/dark themes. Just double-click to open in any browser.test-report.xlsxis a styled workbook with three sheets:Summary ā totals, pass/fail counts, and a status-code distribution
Endpoints ā every endpoint with method color badges
Test Results ā one row per test with complete data (request/response bodies, headers, status, duration, errors), color-coded green/red/amber, with auto-filters enabled.
Open it in Excel, Google Sheets, or LibreOffice. Secret-looking header values are redacted.
Already have results.json from a previous run and just want the pretty output? Ask the AI to
run export_report ā it rebuilds the HTML + XLSX from the saved JSON without re-running anything.
Test categories generated
happy-path ā valid request with sample params/body; expects success
edge-case ā non-existent resources, malformed params, empty bodies
negative ā malformed JSON, wrong HTTP method (expects 4xx/405)
security ā same request with credentials stripped (expects 401/403)
Develop from source (contributors)
git clone https://github.com/Hassan-Jamal/Automated_API_MCP.git
cd Automated_API_MCP
npm install
npm run build # compile to dist/
npm test # 63 tests: detectors, scanner, auth, schema, harvesting, PDF, etc.The examples/sample-app/ folder has JS, Dart, and Express files demonstrating the detectors.
Do I need to run my app first?
Depends on the step:
Step | App/server running? |
Scan, generate Swagger, generate tests | No ā reads source code statically |
Execute tests ( | Yes ā sends real HTTP requests |
For a React Native or web app, what must be running is the backend API server the app
talks to (e.g. http://localhost:3000) ā not the emulator or the web frontend. This tool
calls the API directly, the same API your app calls. Point baseUrl at that server.
If your project is the backend (Express/NestJS/FastAPI/Flask), start it, then run the tests.
Tip: use
dryRun: trueonrun_teststo preview the requests without sending any ā handy before pointing it at a real server.
Onboarding a new QA (2 commands)
No cloning, no building ā the package is on npm. On each machine (needs Node.js 18+ and a host):
npm i -g @hassanjamal/api-mcp # install once
claude mcp add -s user api-mcp -- api-mcp # register for all projectsVerify with claude mcp list ā ā Connected. Then open an app folder and either use the
/qa-audit slash command or ask in natural language. To update later:
npm i -g @hassanjamal/api-mcp@latest.
Notes & limits
Detection is heuristic (regex-based). It finds string-literal paths; fully dynamic URLs built from variables may be partially normalized (
${expr}ā{param}).Generated request bodies are placeholders ā refine them via
sampleValuesin config for endpoints with strict validation.The executor sends real requests. Point it at a dev/staging server, not production.
Available Tools
10 toolsdetect_base_urlDetect the API base URL from the codeA
Scans config (.env), axios/Dart baseURL settings, and absolute URLs in the code to find candidate API base URLs. Works for web and mobile apps. QA can use the top candidate or override it.
Inputs: path (required).
detect_openapiDetect existing OpenAPI/Swagger specB
Searches the project for an existing OpenAPI/Swagger document (swagger.json, openapi.yaml, etc.) and reports what was found.
Inputs: path (required).
export_reportExport saved results to HTML + colorful XLSXA
Regenerates the HTML report and a colorful, multi-sheet XLSX spreadsheet from previously saved endpoints.json / results.json (in the project's .api-mcp folder). Use this to get shareable HTML/Excel output without re-running the tests.
Inputs: path (required).
full_auditFull API audit (scan ā spec ā tests ā run ā report)A
One-call pipeline: scans for endpoints, generates/loads an OpenAPI spec, generates test + edge cases, executes them against the live server, and writes all reports. Provide baseUrl and auth so execution can reach the server.
Inputs: path (required), baseUrl, execute, headers, +1 more.
generate_openapiGenerate OpenAPI/Swagger specA
Builds an OpenAPI 3.0 spec from discovered endpoints. If an existing spec is found and useExisting is true, it is loaded instead of regenerated. Writes the spec into the project's .api-mcp directory.
Inputs: path (required), title, format, baseUrl, +1 more.
generate_testsGenerate API test + edge casesA
Generates a test plan (happy-path, edge, negative, and security cases) for every discovered endpoint, based on its HTTP method and parameters. Writes tests.json. Does not execute anything.
Inputs: path (required), baseUrl, headers, bearerToken.
loginLog in and obtain an auth tokenA
Given a base URL and credentials, auto-detects the login endpoint, posts the credentials (trying email/username field variants), and extracts the token from the response. Returns the token and reports exactly what worked.
Inputs: path (required), password (required), role, email, +3 more.
qa_auditQA audit: auto-login per role and test the whole APIA
The QA one-call workflow. Provide the project path and a list of role credentials (email/username + password). The tool detects the base URL and login endpoint, logs in as each role, runs the test suite per role (read-only by default), and writes a per-role + combined report. Set includeWrites=true only against a throwaway/staging env.
Inputs: path (required), roles (required), baseUrl, loginPath, +5 more.
run_testsExecute API tests against a live serverB
Generates the test plan and executes it against the running server (like Postman). Saves full responses to results.json and a Markdown report. Requires baseUrl unless endpoints use absolute URLs.
Inputs: path (required), dryRun, baseUrl, headers, +3 more.
scan_endpointsScan codebase for API endpointsA
Recursively scans a project directory (React Native, web, Flutter, or backend) for API endpoints ā fetch/axios/Dart-http/Dio client calls and Express/NestJS/Flask/FastAPI/Spring server routes. Writes a discovery report and endpoints.json.
Inputs: path (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 10 tools
Each tool has a clearly distinct purpose: detecting base URLs, detecting OpenAPI specs, scanning endpoints, generating specs, generating tests, running tests, logging in, full audit, QA audit, and exporting reports. Descriptions are detailed and unique, preventing confusion.
Most tool names follow a verb_noun pattern with snake_case (e.g., detect_base_url, generate_tests). A couple use compound nouns (full_audit, qa_audit) but still adhere to the overall lowercase underscore convention, making them predictable.
Ten tools cover the entire API auditing workflow without being excessive. Each tool addresses a specific step or role, making the set well-scoped for the domain.
The tools cover the full lifecycle: endpoint discovery, OpenAPI spec handling, test generation, execution, login, and reporting. No obvious gaps exist for the intended purpose of API testing and auditing.
Related MCP Connectors
Host any HTTP API as a standard MCP server; auto-distribute to 12+ mainstream agent platforms.
MCP server for AI access to Swagger by SmartBear.
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
A paid remote MCP for CLI tool MCP, built to return verdicts, receipts, usage logs, and audit-ready
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server for AI-powered API testing that enables automated positive, negative, and security testing directly from AI chat interfaces. It supports multiple AI providers and generates detailed security reports.22 npm-
- AlicenseNot gradedqualityCmaintenanceA dynamic MCP server that automatically discovers and generates tools from any REST API using OpenAPI/Swagger specifications, enabling instant endpoint access with zero manual configuration.MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that automates Playwright-based UI and API testing, supporting test case generation from requirements or API specs, and execution with detailed reports.12 npm1MIT
- AlicenseAqualityBmaintenanceAn MCP server that brings senior-QA discipline to AI coding assistants, enabling test planning, TDD, mutation testing, and code review.50119 PyPI7Apache 2.0