MockLoop MCP is an AI-native testing platform powered by the Model Context Protocol (MCP). It revolutionizes API testing with comprehensive AI-driven scenario generation, automated test execution, and intelligent analysis capabilities.
# Install the latest stable version
pip install mockloop-mcp
# Verify installation
mockloop-mcp --version
# Clone the repository
git clone https://github.com/mockloop/mockloop-mcp.git
cd mockloop-mcp
# Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install in development mode
pip install -e ".[dev]"
Add to your Cline MCP settings file:
{
"mcpServers": {
"MockLoopLocal": {
"autoApprove": [],
"disabled": false,
"timeout": 60,
"command": "mockloop-mcp",
"args": [],
"transportType": "stdio"
}
}
}
Add to your Claude Desktop configuration:
{
"mcpServers": {
"mockloop": {
"command": "mockloop-mcp",
"args": []
}
}
}
For virtual environment installations, use the full Python path:
{
"mcpServers": {
"MockLoopLocal": {
"command": "/path/to/your/venv/bin/python",
"args": ["-m", "mockloop_mcp"],
"transportType": "stdio"
}
}
}
generate_mock_api
Generate sophisticated FastAPI mock servers with dual-port architecture.
Parameters:
spec_url_or_path
(string, required): API specification URL or local file pathoutput_dir_name
(string, optional): Output directory nameauth_enabled
(boolean, optional): Enable authentication middleware (default: true)webhooks_enabled
(boolean, optional): Enable webhook support (default: true)admin_ui_enabled
(boolean, optional): Enable admin UI (default: true)storage_enabled
(boolean, optional): Enable storage functionality (default: true)query_mock_logs
Query and analyze request logs with AI-powered insights.
Parameters:
server_url
(string, required): Mock server URLlimit
(integer, optional): Maximum logs to return (default: 100)offset
(integer, optional): Pagination offset (default: 0)method
(string, optional): Filter by HTTP methodpath_pattern
(string, optional): Regex pattern for path filteringtime_from
(string, optional): Start time filter (ISO format)time_to
(string, optional): End time filter (ISO format)include_admin
(boolean, optional): Include admin requests (default: false)analyze
(boolean, optional): Perform AI analysis (default: true)discover_mock_servers
Intelligent server discovery with dual-port architecture support.
Parameters:
ports
(array, optional): Ports to scan (default: common ports)check_health
(boolean, optional): Perform health checks (default: true)include_generated
(boolean, optional): Include generated mocks (default: true)manage_mock_data
Dynamic response management without server restart.
Parameters:
server_url
(string, required): Mock server URLoperation
(string, required): Operation type ("update_response", "create_scenario", "switch_scenario", "list_scenarios")endpoint_path
(string, optional): API endpoint pathresponse_data
(object, optional): New response datascenario_name
(string, optional): Scenario namescenario_config
(object, optional): Scenario configurationMockLoop MCP includes revolutionary proxy capabilities that enable seamless switching between mock and live API environments:
MOCK
): All requests handled by generated mock responsesPROXY
): All requests forwarded to live API endpointsHYBRID
): Intelligent routing between mock and proxy based on rulesfrom mockloop_mcp.mcp_tools import create_mcp_plugin
# Create a proxy-enabled plugin
plugin_result = await create_mcp_plugin(
spec_url_or_path="https://api.example.com/openapi.json",
mode="hybrid", # Start with hybrid mode
plugin_name="example_api",
target_url="https://api.example.com",
auth_config={
"auth_type": "bearer_token",
"credentials": {"token": "your-token"}
},
routing_rules=[
{
"pattern": "/api/critical/*",
"mode": "proxy", # Critical endpoints use live API
"priority": 10
},
{
"pattern": "/api/dev/*",
"mode": "mock", # Development endpoints use mocks
"priority": 5
}
]
)
MockLoop MCP introduces a dual-port architecture that eliminates common conflicts and enhances security:
# Generate mock with dual-port architecture
result = mockloop.generate_mock_api(
spec_url_or_path="https://api.example.com/openapi.json",
business_port=8000, # Mocked API port
admin_port=8001, # Admin UI port
admin_ui_enabled=True
)
http://localhost:8000
- Your API endpointshttp://localhost:8001
- Management interfacehttp://localhost:8000/docs
- Interactive Swagger UIhttp://localhost:8000/health
- Server status# Navigate to generated mock directory
cd generated_mocks/your_api_mock
# Start with dual-port architecture
docker-compose up --build
# Access points:
# Mocked API: http://localhost:8000
# Admin UI: http://localhost:8001
# Install dependencies
pip install -r requirements_mock.txt
# Start the mock server
uvicorn main:app --reload --port 8000
http://localhost:8001
- Enhanced management interfacehttp://localhost:8000/docs
- Interactive Swagger UIhttp://localhost:8000/health
- Server status and metricshttp://localhost:8001/api/logs/search
- Advanced log queryinghttp://localhost:8001/api/logs/analyze
- AI-powered insightshttp://localhost:8001/api/mock-data/scenarios
- Dynamic testingTo add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "mockloop" '{"command":"mockloop-mcp","args":[]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"mockloop": {
"command": "mockloop-mcp",
"args": []
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"mockloop": {
"command": "mockloop-mcp",
"args": []
}
}
}
3. Restart Claude Desktop for the changes to take effect