The
mcp command requires the mcp feature to be enabled during installation.Usage
Run in test mode (currently not used, server runs normally)
What is MCP?
Model Context Protocol is a standardized way for AI assistants to communicate with tools and services. The apicentric MCP server exposes simulator capabilities to AI agents, enabling:- Service creation and management
- Endpoint configuration
- Request/response mocking
- Scenario activation
- Log retrieval
How it works
- JSON-RPC communication: The server uses stdin/stdout for JSON-RPC messages
- AI agent connection: AI tools (like Claude Desktop) connect to the server
- Tool invocation: The agent calls apicentric tools as needed
- Context sharing: The agent accesses your local apicentric context
Starting the server
- Input: JSON-RPC requests from stdin
- Output: JSON-RPC responses to stdout
- Logging: Diagnostic messages to stderr
Configuration for AI clients
Claude Desktop
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Other MCP clients
Provide the command to your MCP client:Available tools
When connected, AI agents can access these capabilities:Service management
- Create new service definitions
- List existing services
- Start and stop services
- Get service status
Endpoint configuration
- Define REST endpoints
- Configure GraphQL schemas
- Set up response templates
- Define scenarios
Request/response mocking
- Create mock responses
- Set up dynamic responses
- Configure status codes and headers
- Define delays and error conditions
Scenario management
- Activate scenarios
- Switch between scenarios
- Query active scenario
Logging
- Retrieve request logs
- Filter logs by criteria
- Export log data
Example interaction
AI agents can now help with tasks like: User: “Create a user API with login and registration endpoints” AI Agent:- Calls
apicentric.create_servicewith the service definition - Configures POST
/loginand POST/registerendpoints - Sets up mock responses for success and error cases
- Starts the service
- Reports the service URL
Server lifecycle
Startup
Processing requests
The server processes JSON-RPC messages silently:Shutdown
The server exits when:- stdin is closed (client disconnects)
- A fatal error occurs
Ctrl+Cis pressed
Logging
Diagnostic logs are written to stderr, not stdout:Error handling
Server errors
If the server fails to start:- Invalid configuration
- Port already in use
- Missing dependencies
Request errors
Invalid JSON-RPC requests return error responses:Security considerations
Best practices
- Review tool calls: Check what actions the AI agent is performing
- Limit scope: Configure the server with minimal permissions
- Monitor logs: Watch stderr for unexpected operations
- Use separate contexts: Run in a dedicated directory for AI interactions
Troubleshooting
Server not responding
Check that:- The server process is running
- stdin/stdout are properly connected
- No other process is writing to stdout
AI agent can’t connect
Verify:- Command path is correct in client config
apicentricbinary is in PATH- Client has permission to execute the command
JSON-RPC errors
Ensure:- Client is sending valid JSON-RPC 2.0 messages
- Method names match available tools
- Required parameters are provided
Dry run mode
Dry run affects operations triggered through MCP:Advanced usage
With custom config
With verbose logging
In a specific directory
Integration examples
Claude Desktop
- Install and configure Claude Desktop
- Add apicentric to MCP servers config
- Restart Claude Desktop
- Ask Claude to help with API mocking tasks
Custom MCP client
Next steps
- Learn about MCP protocol specification
- Set up Claude Desktop integration
- Explore AI-assisted development workflows