Testing APIs with Claude Code and Cursor through MCP
AI coding agents are good at writing an endpoint. They are much worse at checking that it works, because they can't see your API client: the saved requests, the staging environment, the login flow that hands a token to the next call. So they guess, or they write a throwaway curl that tests the happy path once.
The Model Context Protocol (MCP) fixes that. It lets an agent call tools you give it. The Requestarium MCP server gives it your collections: it can list them, run a request or a whole collection against an environment, read the results, and add requests and tests. Your API client becomes something the agent can use, with the same requests your team already trusts.
What it looks like
Once connected, you talk to the agent in plain language:
- "Run the Users API collection against Staging and tell me what failed."
- "Why does Get user return 401?"
- "Add a request that creates an order, with a test that the status is 201."
- "Import ./openapi.yaml and set up an environment for its variables."
The agent picks the tools it needs, runs the requests from your machine, and answers with what actually happened, not what it expects to happen. Because requests are sent locally, localhost, docker-compose services and VPN-only hosts work.
Setup in two minutes
The MCP server is part of the Requestarium CLI. Install it and sign in once:
npm install -g @requestarium/cli
requestarium loginEvery client starts the same command, requestarium mcp.
Claude Code
claude mcp add requestarium -- requestarium mcpCursor and Claude Desktop (and other clients that use mcpServers):
{
"mcpServers": {
"requestarium": { "command": "requestarium", "args": ["mcp"] }
}
}VS Code (.vscode/mcp.json, then Copilot Chat in Agent mode):
{
"servers": {
"requestarium": { "type": "stdio", "command": "requestarium", "args": ["mcp"] }
}
}A workflow that works well
The pattern we see most: you change an endpoint, and before you open a pull request you ask the agent to prove it works.
- Write the change with the agent as usual.
- Ask it to run the collection. "Run the Orders API collection against Local and explain any failures." It calls
run_collectionand gets back each request's status, timing, test results and response body. - Let it debug. For a failure it can call
run_requeston that one request, read the headers, body and script console output, and compare it with the code it just wrote. - Ask for tests. "Add
pm.testchecks for status, timing and the response body to the Create order request." It callsupdate_request, and the tests are now part of the collection, so they also run in the app and in CI.
The server also ships ready-made prompts that most clients show as slash commands: test_collection, add_tests, import_api and debug_request.
What the agent can do
| Area | Tools |
|---|---|
| Look around | list_collections, get_details, list_environments, list_runs |
| Run | run_request, run_collection, run_suite, run_flow |
| Edit | create_collection, create_folder, create_request, update_request, delete_request |
| Import and export | import_collection (Postman, OpenAPI, Swagger, curl), export_collection |
| Environments | create_environment, set_environment_variable, delete_environment_variable |
| Other | generate_snippet (curl, fetch, Python, Go and more), list_cookies, clear_cookies |
Tools accept names, not just ids, and a request can be named by its path, such as Auth/Login.
What the agent can't see
Giving an agent access to an API client raises a fair question: what about the secrets? This is where the server is deliberately strict.
- Environment values are never sent to the agent. It sees variable names only. It can set a value with
set_environment_variable, and your MCP client asks you before each such call. - Credentials written in requests are masked in tool results: bearer tokens, passwords, API keys,
AuthorizationandCookieheaders, and secrets in URLs such as?api_key=…. If the agent tries to save a masked value back, the server refuses, so a request never ends up with dots instead of its credential. - Secrets from AWS, Azure or Google Cloud secret managers are fetched on your machine and masked the same way.
Remote and cloud agents
Agents that can't start a process on your machine can reach the same server over HTTP:
export REQUESTARIUM_MCP_TOKEN="$(openssl rand -base64 32)"
requestarium mcp --http --port 8765Every call needs Authorization: Bearer <token>, and the server listens on 127.0.0.1 unless you choose otherwise. Treat the token like a password.
Limits
The MCP server runs HTTP and GraphQL requests. gRPC and WebSocket requests run in the app. File uploads are not sent.
Try it
The CLI and the MCP server are free on every plan. Install, run requestarium login, add the server to your agent, and ask it to run your first collection. The full reference is in CLI & MCP.