Skip to content

Development

Setting up the development environment

Clone the repository and install in editable mode:

git clone git@gitlab.com:ryaneatfood/mcp-api-testing.git
cd mcp-api-testing
pip install -e .

After pulling changes, re-install to pick up any dependency updates:

pip install -e .

Running the MCP server directly

Start the server in development mode:

mcp-api-test

The server communicates over STDIO as per the MCP protocol.

Running tests

Install test dependencies and run the suite:

# Install with dev dependencies
pip install -e ".[dev]"

# Run the full test suite
pytest -v

Test structure

The test suite consists of:

  • Unit tests — test individual functions like the cURL parser and status code range parser
  • Integration tests — test the full run_test_api tool with mocked HTTP responses

All integration tests use respx to mock HTTP responses. No real network calls are made, so the suite runs fast and offline.

Test files

File Description
tests/test_parse_curl_command.py Unit tests for the cURL command parser
tests/test_parse_status_code.py Unit tests for status code range parsing
tests/test_mcp_api_tools.py Integration tests for the run_test_api tool

Project structure

mcp-api-testing/
├── src/
│   ├── __init__.py
│   ├── __main__.py       # Entry point for `python -m`
│   ├── server.py         # MCP server and run_test_api tool
│   ├── models.py         # Data models (APITestResult, AssertionResult)
│   ├── utils.py          # Console rendering, URL building, field validation
│   ├── flags.py          # cURL flag definitions
│   └── logger.py         # Logging configuration
├── tests/
│   ├── test_parse_curl_command.py
│   ├── test_parse_status_code.py
│   └── test_mcp_api_tools.py
├── pyproject.toml
├── mkdocs.yml            # Documentation config
└── docs/                 # Documentation source

Building documentation

The documentation is built with MkDocs Material:

# Install mkdocs-material
pip install mkdocs-material

# Serve locally with live reload
mkdocs serve

# Build static site
mkdocs build

The built site is output to the site/ directory.