Skip to main content

A Model Context Protocol server for REST and SOAP API testing with assertions, chaining, load testing, and response storage.

Project description

apibench-mcp

A Model Context Protocol (MCP) server for REST and SOAP API testing. Supports HTTP requests, SOAP calls, response assertions, request chaining, data-driven load testing, and response storage.

Overview

apibench-mcp provides a structured set of tools for API testing through MCP-compatible AI clients. It is designed for both functional testing (individual requests with assertions) and performance testing (concurrent load with statistics).

Key capabilities:

  • REST requests with authentication, custom headers, and JSONPath extraction
  • SOAP requests via WSDL with XPath extraction
  • Flag-based response assertions (status code, headers, body content, JSONPath)
  • Sequential request chaining with value injection from prior responses
  • Data-driven load testing with CSV, JSON, or DSV data files
  • System resource preflight checks before load testing
  • In-memory response storage with file export

Installation

pip install apibench-mcp

Usage

apibench-mcp

The server requires no arguments. It starts and exposes its tools over the MCP protocol.

MCP Client Configuration

{
  "mcpServers": {
    "api-tester": {
      "command": "apibench-mcp",
      "args": [],
      "autoApprove": [
        "rest_request",
        "soap_request",
        "assert_response",
        "chain_requests",
        "preflight_check",
        "load_test",
        "save_response"
      ]
    }
  }
}

Tools

rest_request

Make an HTTP request (GET, POST, PUT, PATCH, DELETE).

Parameter Type Default Description
method string required HTTP method
url string required Full URL
headers string or dict None HTTP headers
body string or dict None Request body
auth_type string None Authentication type: "bearer", "basic", or "api_key"
auth_value string None Token or key value for authentication
timeout integer 30 Request timeout in seconds
follow_redirects boolean true Follow HTTP redirects
verify_ssl boolean true Verify SSL certificates
extract string None JSONPath expression to extract from response body

Returns the response with a stored ID for use with assert_response and save_response.

soap_request

Send a SOAP request to a WSDL endpoint.

Parameter Type Default Description
wsdl_url string required URL to the WSDL file
operation string required SOAP operation name
params string or dict None Operation parameters
headers string or dict None Extra HTTP headers
timeout integer 30 Request timeout in seconds
verify_ssl boolean true Verify SSL certificates
extract string None XPath expression to extract from XML response

assert_response

Validate a stored response against one or more assertions. All assertion parameters are optional; only the ones provided are evaluated.

Parameter Type Default Description
response_id string required ID of a stored response (e.g., "resp_1")
status_code integer None Expected HTTP status code
body_contains string None String that must appear in the response body
body_not_contains string None String that must not appear in the response body
header_exists string None Header name that must be present
header_value string None Expected value for the specified header
jsonpath_expr string None JSONPath expression to evaluate
jsonpath_expected string None Expected value for the JSONPath match

chain_requests

Run a sequence of REST requests where each step can reference extracted values from earlier steps using {{resp_N.extracted[0]}} placeholders.

Parameter Type Default Description
steps string required JSON array of request objects

Each request object supports: method, url, headers, body, auth_type, auth_value, and extract (JSONPath).

preflight_check

Check system resources and recommend a safe maximum concurrency for load testing. Reports CPU count and usage, available memory, file descriptor limits, and a calculated recommendation.

Parameters: None

load_test

Fire N concurrent HTTP requests and return performance statistics.

Parameter Type Default Description
method string required HTTP method
url string required Target URL (supports {{field}} and {{seq}} placeholders)
total_requests integer required Total number of requests to send
concurrency integer required Number of simultaneous requests
headers string or dict None HTTP headers
body string or dict None Static request body
body_template string None Body string with {{field_name}} placeholders
body_template_file string None Path to a file containing the body template
data_file string None Path to CSV, JSON, or DSV file with per-request data
delimiter string "," Column delimiter for CSV/DSV data files
timeout integer 30 Per-request timeout in seconds
verify_ssl boolean true Verify SSL certificates
force boolean false Bypass the safety concurrency cap

Body resolution priority: body_template_file > body_template > body.

When a data_file is provided, each request receives its own row of data. If total_requests exceeds the number of rows, rows are cycled. The {{seq}} placeholder is replaced with a 1-based sequence number per request.

Returns: total requests, success and error counts, error rate, status code distribution, and response time statistics (min, max, avg, median, p95, p99), along with requests per second.

save_response

Save a stored response to a JSON file.

Parameter Type Default Description
response_id string required ID of the stored response
file_path string required Path to save the JSON file

Data-Driven Load Testing

To run load tests with unique data per request:

  1. Create a data file (JSON, CSV, or DSV):
[
  {"name": "User-1", "email": "user1@example.com"},
  {"name": "User-2", "email": "user2@example.com"}
]
  1. Create a body template:
{"name": "{{name}}", "email": "{{email}}", "role": "tester"}
  1. Run the load test referencing both files. Each request will use the next row from the data file, with placeholders replaced by the corresponding field values.

Requirements

  • Python 3.12 or later
  • Dependencies: mcp[cli], httpx, zeep, jsonpath-ng, lxml, psutil

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apibench_mcp-0.1.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apibench_mcp-0.1.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file apibench_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: apibench_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for apibench_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6a24a84516bab6b554f33699f893eed5d9cf774bad84f66430c838b1a1283526
MD5 d5852429de31d5d9b134e90090ad80ae
BLAKE2b-256 e352e3a5630a5f4bba02335d94c338a14b0ee5cb2f54be77b94ce847cc41293a

See more details on using hashes here.

File details

Details for the file apibench_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: apibench_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for apibench_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb6a522fb80d823c03b3bd70f9383accb318f36999a8f145ae9dcfddf70a4dbc
MD5 cc6aef880ae4e99f3b18cc8315c76ccb
BLAKE2b-256 0736d1cb3b5760446e00da90e15753a1c7b87319fabca838dbadabc5f505106d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page