AP

API Lab MCP Server: AI Powered API Testing

Transform your API testing with the MCP server, use Claude to test, debug, authenticate, validate responses, and measure performance via natural conversation.

Quick Install
npx -y @atototo/api-lab-mcp

Overview

API Lab MCP is an MCP-compatible server that brings conversational API testing to Claude Desktop and Claude Code. Once installed and registered as an MCP tool, it allows developers and QA engineers to interact with APIs through natural language—asking Claude to make requests, validate responses, simulate authentication flows, collect performance metrics, and generate tests or documentation from conversations.

The server removes repetitive scripting for common API tasks and centralizes testing workflows inside the assistant environment. Instead of switching to Postman, terminal scripts, or separate test runners, you can ask Claude to exercise endpoints, analyze failures, run batch tests, and output structured reports or OpenAPI-based test suites.

Features

  • AI-driven conversational testing (works with Claude Desktop and Claude Code)
  • Universal authentication: bearer tokens, API keys, OAuth2, session cookies, CSRF handling
  • Intelligent response validation: status codes, headers, JSONPath and XPath checks
  • Spec-based test generation: create tests from OpenAPI / Swagger documents
  • Batch & sequence testing: parallel or ordered test execution
  • Real-time performance metrics: response times, payload sizes, Core Web Vitals
  • Auto documentation: export test conversations as docs or test suites
  • MCP server testing: exercise other MCP servers and their resources
  • Environment management: switch between dev, staging, production configurations

Supported authentication (summary):

Installation / Configuration

Install via npm (global recommended):

# Global install
npm install -g api-lab-mcp

Add to Claude Code:

# Add installed MCP to Claude Code
claude mcp add api-lab-mcp api-lab-mcp

# Or use npx without installing
claude mcp add api-lab-mcp "npx -y api-lab-mcp"

Local development workflow:

git clone https://github.com/atototo/api-lab-mcp.git
cd api-lab-mcp
npm install
npm run build
# Register a local server binary with Claude
claude mcp add api-lab-local "node $(pwd)/dist/mcp/server.js"

Claude Desktop configuration (macOS / Linux example):

{
  "mcpServers": {
    "api-lab-mcp": {
      "command": "npx",
      "args": ["-y", "api-lab-mcp"]
    }
  }
}
  • After editing the desktop config, restart Claude Desktop to load the MCP.
  • On Windows, place the same JSON entry into the desktop config file location used by Claude.

Available Resources

  • GitHub repository: https://github.com/atototo/api-lab-mcp — source, issues, and contribution guidelines
  • NPM package: api-lab-mcp
  • Example projects in the repo demonstrating:
    • OpenAPI-driven test generation
    • OAuth2 / session-based authentication flows
    • Performance benchmarking scenarios
  • Built-in reporters: JSON, HTML, and plain text summaries for conversational output

Tools exposed by the server (high-level):

TypeNotes
Bearer tokenStandard Authorization: Bearer
API keyHeader or query parameter placement
OAuth2Authorization code / client credentials workflows (where applicable)
Session cookiesSet cookies like JSESSIONID for authenticated flows
CSRF tokensRead and submit CSRF tokens from responses
ToolPurpose
Request RunnerExecute single HTTP requests with headers, body, params
Test Suite RunnerRun generated or recorded test suites (parallel/sequence)
Auth ManagerManage tokens, cookies, OAuth flows, CSRF extraction
AnalyzerValidate responses, suggest fixes for failures, extract fields
ReporterProduce performance and test result reports

Use Cases (concrete examples)

  • Development: “Test GET http://localhost:3000/api/users and show me JSONPath $.data[0].id”
    Claude will run the request, check the path, and return the extracted value or an assertion error.

  • Debugging authentication: “Why is my login endpoint returning 401?”
    The Analyzer inspects request headers, body, and expected auth flow and suggests missing tokens, cookie issues, or CSRF failures.

  • Spec-driven test creation: “Create tests from my OpenAPI spec at http://localhost:3000/openapi.json”
    The server fetches the spec, generates test cases for common response codes, parameter combinations, and optional schema validations.

  • Performance validation: “Verify all endpoints respond under 200ms in staging”
    Batch Runner executes endpoints against the staging base URL and returns a performance report with response times and any violations.

  • Session flows: “Use cookie JSESSIONID=ABC123 and test /account and /transactions”
    Auth Manager sets the cookie and runs the requested sequence, preserving session state between requests.

Tips and Best Practices

  • Provide base URLs and environment variables in your prompt or via the server UI to make testing reproducible across environments.
  • Use OpenAPI specs where available to get more comprehensive, schema-based validations.
  • Export generated tests to integrate with CI pipelines or to reproduce scenarios outside the assistant.
  • When debugging, ask Claude to show raw request and response headers to spot mismatches quickly.

Where to get help

  • Open issues or feature requests on the GitHub repo: https://github.com/atototo/api-lab-mcp
  • Consult example folders in the repo for common workflows and configuration snippets.

This tool is intended for developers and QA engineers who want to centralize API testing inside a conversational assistant workflow while retaining the ability to export, reproduce, and automate tests in CI.