A MCP server that exposes Specmatic's capabilities to AI coding agents like Claude Code, Codex, etc.
2.2K
A Model Context Protocol (MCP) server that exposes Specmatic's capabilities—including API Contract Testing, API Resiliency Testing, and API mocking—to AI coding agents.
https://github.com/specmatic/specmatic-mcp-server
Build an entire FE and BE application with Specmatic MCP as guard rails:
https://github.com/specmatic/specmatic-mcp-sample
claude mcp add-json specmatic '{"command":"docker","args":["run","--rm","-i","--network=host","-v","'$(pwd)/reports':/app/reports","specmatic/specmatic-mcp:latest"],"env":{}}'
Note: If you encounter path resolution issues with $(pwd), replace it with your absolute project path:
claude mcp add-json specmatic '{"command":"docker","args":["run","--rm","-i","--network=host","-v","/path/to/your/project/reports:/app/reports","specmatic/specmatic-mcp:latest"],"env":{}}'
Make sure Docker Desktop is running
Open your project in VS Code as a workspace (single-folder or multi-root as needed).
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and search for MCP: Add server, then press Enter
Choose transport protocol as stdio
⚠️ CRITICAL: Enter the command to run the MCP server - YOU MUST REPLACE <REPLACE_WITH_YOUR_PROJECT_PATH> with your actual project path:
Template:
docker run --rm -i --network=host -v <REPLACE_WITH_YOUR_PROJECT_PATH>/reports:/app/reports specmatic/specmatic-mcp:latest
Examples:
# macOS/Linux example:
docker run --rm -i --network=host -v /Users/yourname/projects/my-api-project/reports:/app/reports specmatic/specmatic-mcp:latest
# Windows example:
docker run --rm -i --network=host -v C:\Users\yourname\projects\my-api-project\reports:/app/reports specmatic/specmatic-mcp:latest
Set the server ID to specmatic-mcp.
Choose installation scope: Global (available everywhere) or Workspace (just this project).
Verify the server: Make sure that Specmatic MCP is listed without errors in the MCP servers panel and then request your Copilot Agent to run contract tests, resiliency tests, or start a mock server in natural language.
For Cursor, GitHub Copilot, or other MCP clients, add to your mcp.json configuration:
⚠️ IMPORTANT: Replace <REPLACE_WITH_YOUR_PROJECT_PATH> with your actual project path.
{
"servers": {
"specmatic": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--network=host",
"-v",
"<REPLACE_WITH_YOUR_PROJECT_PATH>/reports:/app/reports",
"specmatic/specmatic-mcp:latest"
],
"env": {}
}
}
}
Path Examples:
/Users/yourname/projects/my-api-project/reports:/app/reportsC:\Users\yourname\projects\my-api-project\reports:/app/reportsThe --network=host flag is required for:
http://localhost:3000)Security Note: Host networking gives the container access to your host's network interfaces. Only use this with trusted images.
run_contract_testValidates API implementations against OpenAPI specifications by running contract tests.
run_resiliency_testTests API resilience by sending boundary condition and invalid requests.
manage_mock_serverComplete mock server lifecycle management for frontend development.
start, stop, listAfter setup, interact with your AI coding agent using natural language:
"Run contract tests against my API at https://api.example.com using this OpenAPI spec: [paste spec]"
"Start a mock server on port 9000 using this spec: [paste spec]"
"Run resiliency tests to check error handling with @products-api.yaml spec"
"List all running mock servers"
"Stop the mock server on port 9000"
reports/ directoryDocker permission errors:
docker groupPort conflicts:
manage_mock_server list to see currently used portsVolume mounting issues:
mkdir -p reportsContent type
Image
Digest
sha256:d5148c136…
Size
297.3 MB
Last updated
about 1 year ago
docker pull specmatic/specmatic-mcp