A production-ready Model Context Protocol (MCP) server that integrates ResQ platform robotics, simulation, and telemetry capabilities into AI agents.
resq-mcp bridges the ResQ platform's core capabilities—Digital Twin Simulations (DTSOP), Hybrid Coordination Engines (HCE), and drone telemetry—directly to AI-powered environments like Claude Desktop, Cursor, and the MCP Inspector. It utilizes FastMCP to expose secure, typed interfaces for mission-critical operations.
- Native Integration: Domain-specific support for ResQ objects (DTSOP, HCE, PDIE).
- Flexible Transport: Native support for both
STDIOandSSEtransport modes. - Type Safety: Built on strict Pydantic-based schemas for AI-tool reliability.
- Security Controls: Integrated safe-mode prevents unauthorized mutations in production.
The server acts as a secure intermediary, translating AI natural language requests into authenticated, platform-native service calls.
C4Context
title System Context: resq-mcp Integration
Person(ai, "AI Client", "Claude Desktop / Cursor")
System_Boundary(resq_boundary, "resq-mcp Server") {
System(server, "resq-mcp Server", "MCP-compliant Interface")
System_Boundary(backend, "ResQ Platform") {
Component(dtsop, "DTSOP Engine", "Physics/RL Simulations")
Component(hce, "HCE Engine", "Coordination Logic")
Component(telemetry, "Drone Telemetry", "Real-time Status")
}
}
Rel(ai, server, "Uses Model Context Protocol")
Rel(server, dtsop, "Executes Simulation")
Rel(server, hce, "Validates Incidents")
Rel(server, telemetry, "Subscribes to Data")
Ensure you have uv installed, then clone the repository:
git clone https://github.com/resq-software/mcp.git
cd mcp
uv syncLocal Development Setup:
- Clone Repository: As shown above.
- Install Dependencies: Run
uv syncwithin the cloned directory. This creates a virtual environment and installs all necessary Python packages defined inpyproject.tomlanduv.lock. - Run Server: Use
uv run resq-mcpto start the server in STDIO mode for local integration.
Production Environment Deployment:
Production deployments typically involve containerization (e.g., Docker) or direct execution on a server.
- Docker: Build the image using the provided
Dockerfile:Then run the container, exposing the necessary port:docker build -t resq-mcp .Ensuredocker run -d -p 8000:8000 --name resq-mcp-server -e RESQ_API_KEY="your-production-api-key" resq-mcpRESQ_API_KEYis set securely. - Direct Execution: On a target server, clone the repository, install dependencies via
uv sync, and run the server with appropriate environment variables set:Consider using a process manager likeexport RESQ_API_KEY="your-production-api-key" export RESQ_SAFE_MODE="true" # Or "false" if mutations are intended uv run resq-mcp
systemdorsupervisordto manage the server process in production.
For local integration with IDEs or desktop assistants:
uv run resq-mcpAdd the following to your claude_desktop_config.json:
{
"mcpServers": {
"resq": {
"command": "uv",
"args": ["run", "resq-mcp"],
"env": { "RESQ_API_KEY": "your-prod-token" }
}
}
}The server exposes tools that allow AI agents to manage robotics operations directly.
flowchart TD
Prompt[LLM Prompt] --> Protocol[MCP Protocol Layer]
Protocol --> Pydantic[Pydantic Validation]
Pydantic --> Service{ResQ Service Call}
Service -->|Auth/SafeMode Check| Action[Execution]
Settings are managed via environment variables. Create a .env file in the project root:
| Variable | Description | Default |
|---|---|---|
RESQ_API_KEY |
Authentication token for platform access | resq-dev-token |
RESQ_SAFE_MODE |
Prevents destructive platform mutations | true |
RESQ_PORT |
Port for SSE (networked) mode | 8000 |
RESQ_HOST |
Host to bind the SSE server to | 0.0.0.0 |
RESQ_DEBUG |
Enable debug logging | false |
RESQ_PROJECT_NAME |
Display name for the MCP server | resQ MCP Server |
RESQ_VERSION |
Version string for the server | 0.1.0 |
- DTSOP (Digital Twin Simulation & Optimization Platform): Manages physics-based digital twin simulations and generates RL-optimized deployment strategies.
run_simulation(request: SimulationRequest) -> str: Queues a high-fidelity physics simulation job.get_optimization_strategy(incident_id: str) -> OptimizationStrategy: Retrieves RL-optimized strategy for a specific incident.
- HCE (Hybrid Coordination Engine): Coordinates hybrid operations and validates incidents.
validate_incident(val: IncidentValidation) -> str: Evaluates sensor data against PDIE risk protocols.update_mission_params(drone_id: str, strategy_id: str) -> MissionParameters | ErrorResponse: Pushes authorized mission parameters to a specific drone.
- PDIE (Predictive Disaster Intelligence Engine): Handles predictive platform incident evaluation.
get_vulnerability_map(sector_id: str) -> VulnerabilityMap | ErrorResponse: Retrieves precomputed vulnerability data for a sector.get_predictive_alerts(sector_id: str) -> list[PreAlert] | ErrorResponse: Generates probabilistic disaster forecasts for a sector.
resq://simulations/{sim_id}: Provides real-time status and results for simulations. Supports SSE subscriptions.resq://drones/active: Lists currently deployed drones, their status, battery levels, and assignments.
resq-mcp implements a two-tier security approach:
- Authentication: For SSE endpoints exposed via FastAPI (though not directly used in FastMCP's core transport), authentication is handled by
HTTPBearermiddleware, validating theAuthorization: Bearer <token>header against theRESQ_API_KEYsetting. - Safe Mode: When
RESQ_SAFE_MODE=true(the default), tools that perform platform mutations (e.g.,request_drone_deployment,run_simulationin production) will raise aFastMCPErrorexplaining that they are disabled in safe mode. This provides a sandbox environment for AI agents to interact with the system without causing real-world side effects. SettingRESQ_SAFE_MODE=falseenables these operations.
- Connection Refused (SSE): Ensure
RESQ_PORTis correctly set and the port is not already in use by another process. If running in Docker, verify port mapping (-p 8000:8000). - Schema Validation Errors: Check that the data payloads sent by the AI agent (or test client) strictly adhere to the Pydantic models defined in
src/resq_mcp/models.py. Use the MCP Inspector or FastMCP's built-in schema validation errors for debugging. - Missing Environment Variables: The server performs fail-fast validation on startup. If
RESQ_API_KEYis missing (and not in dev mode), it will refuse to start. Ensure all necessary environment variables (or a.envfile) are correctly configured. - Safe Mode Issues: If an AI agent tries to perform a mutation and gets a
FastMCPErrorindicating safe mode, this is expected behavior. To enable mutations, setRESQ_SAFE_MODE=falsein the environment.
- Async First: All tool, resource, and prompt handlers must be
async deffunctions. Avoid blocking I/O operations. Usehttpxfor asynchronous HTTP requests. - Type Safety: Employ full type annotations for all parameters and return types.
mypyis integrated into the CI pipeline and configured with strict checks (strict = true). - Pydantic Models: Use Pydantic models for all input and output data structures to ensure robust validation and clear contracts.
- Conventional Commits: Adhere to the Conventional Commits specification for commit messages. Git hooks are provided to enforce this.
- Dependencies: Manage dependencies using
uv.uv syncshould be run aftergit pullifuv.lockchanges.
- Define Pydantic Models: Create new models in
src/resq_mcp/models.pyfor the tool's inputs and outputs. - Implement Tool Logic: Write an
async deffunction implementing the tool's functionality. Place it within a relevant module (e.g.,src/resq_mcp/tools.py,src/resq_mcp/dtsop.py, etc.). - Register Tool: Decorate the function with
@mcp.tool(). Ensure the function signature uses the Pydantic models defined in step 1. - Add Docstring: Provide a clear, concise docstring explaining the tool's purpose, arguments, return values, and any usage notes. This docstring is exposed to the AI agent as the tool description.
- Write Tests: Create corresponding unit tests in the
tests/directory to verify the tool's behavior, including edge cases and error handling. - Update README: Document the new tool in the relevant sections of the README if it represents a significant new capability.
- Fork the repository.
- Branch: Create a new branch with a descriptive name, prefixed by
feat/,fix/, orchore/(e.g.,feat/add-new-simulation-type). - Setup Environment: Run
./scripts/setup.shto install Nix, enter the development shell, and set up git hooks. - Develop: Implement your changes, adhering to the project's standards (async, type safety, Pydantic, Conventional Commits).
- Lint & Test: Run
uv run ruff check .to lint anduv run pytestto run tests. Ensure all checks pass. - Commit: Use
git commit(the hooks will guide you). - Push: Push your branch to your fork.
- Pull Request: Open a pull request against the
mainbranch of theresq-software/mcprepository.
Copyright 2026 ResQ. Distributed under the Apache License, Version 2.0. See LICENSE for details.