Automate · Lesson 16 of 20

Use your collection from an AI coding assistant

Give an AI coding assistant safe access to your requests, so it can check the real API while it codes.

Intermediate · 2 min · Updated

AI coding assistants write better code when they can try the real API instead of guessing. swc mcp serves a collection over the Model Context Protocol (MCP), the standard way assistants such as Claude Code, Cursor and VS Code connect to tools. The assistant can then list your requests, read them, send them and run their tests, on your computer, with your environment.

What the assistant can do

swc mcp offers four tools:

  • list_requests: the collection's requests, with ids, methods and URLs;
  • get_request: one request's URL, headers, query, body, tests and examples;
  • send_request: send a saved request (optionally with variable values) and get the status, headers, body and test results;
  • run_tests: run the collection, or one folder, and report each request's tests.

Safe by default

  • Read-only unless you say otherwise: only GET, HEAD and OPTIONS requests can be sent. Requests that change data are refused with a clear message. Start it with --allow-write to allow them, ideally against a test environment.
  • Secrets are redacted: secret variables, tokens, Authorization, cookies and API-key headers are replaced with «redacted» in everything the assistant sees.
  • Everything is logged: each call is printed to the terminal, and --log mcp.log writes a JSON line per call.

Connect Claude Code

Shell
claude mcp add shop-api -- swc mcp ./shop.json -e ./staging.json

Connect Cursor or VS Code

Add the server to the editor's MCP settings (.cursor/mcp.json, or .vscode/mcp.json with "servers" instead of "mcpServers"):

JSON
{
  "mcpServers": {
    "shop-api": {
      "command": "swc",
      "args": ["mcp", "./shop.json", "-e", "./staging.json"]
    }
  }
}

The collection can also be loaded from your account by id: set SWC_API_KEY in the server's environment and pass the id instead of a file.

Try it

Ask your assistant something like "List the requests in shop-api and check that GET /orders still returns a total field". It calls list_requests, then send_request, and answers from the real response.

What you learned

  • swc mcp lets AI coding assistants list, read, send and test your requests over MCP.
  • It is read-only by default, redacts secrets and logs every call.

Next: share your workspace with your team.

Try it on your own API

Swastik Codes runs in the browser and is free to use. Create an account to send requests, sync your workspaces and invite your team.