FastMCP server exposing ResQ platform capabilities to AI clients
Project description
resQ MCP Server
A production-ready Model Context Protocol (MCP) server that integrates ResQ platform robotics, simulation, and telemetry capabilities into AI agents.
Overview
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.
Features
- 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.
Architecture
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")
Installation
Ensure you have uv installed, then clone the repository:
git clone https://github.com/resq-software/mcp.git
cd mcp
uv sync
Local 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:docker build -t resq-mcp .
Then run the container, exposing the necessary port:docker run -d -p 8000:8000 --name resq-mcp-server -e RESQ_API_KEY="your-production-api-key" resq-mcp
EnsureRESQ_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:export RESQ_API_KEY="your-production-api-key" export RESQ_SAFE_MODE="true" # Or "false" if mutations are intended uv run resq-mcp
Consider using a process manager likesystemdorsupervisordto manage the server process in production.
Quick Start
1. Run in STDIO mode
For local integration with IDEs or desktop assistants:
uv run resq-mcp
2. Configure Claude Desktop
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"resq": {
"command": "uv",
"args": ["run", "resq-mcp"],
"env": { "RESQ_API_KEY": "your-prod-token" }
}
}
}
Usage
The server exposes tools that allow AI agents to manage robotics operations directly.
Request Lifecycle
flowchart TD
Prompt[LLM Prompt] --> Protocol[MCP Protocol Layer]
Protocol --> Pydantic[Pydantic Validation]
Pydantic --> Service{ResQ Service Call}
Service -->|Auth/SafeMode Check| Action[Execution]
Configuration
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 |
API Reference
Core Modules
- 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.
Key Resources
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.
Security Model
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.
Development
Troubleshooting
- 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.
Standards
- 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.
Adding New Platform Tools
- 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.
Contributing
- 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.
License
Copyright 2026 ResQ. Distributed under the Apache License, Version 2.0. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file resq_mcp-0.3.4.tar.gz.
File metadata
- Download URL: resq_mcp-0.3.4.tar.gz
- Upload date:
- Size: 237.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab3ee3da7f6f972dfe44de5ec14ad164f2cf3455c8f089321b026e92c37884c3
|
|
| MD5 |
3747677b6311ee9f70ace4b9dd6a3347
|
|
| BLAKE2b-256 |
35f511adcda40f637c19283377f7de70cda6a4616b019c25c8887d16dc0497df
|
File details
Details for the file resq_mcp-0.3.4-py3-none-any.whl.
File metadata
- Download URL: resq_mcp-0.3.4-py3-none-any.whl
- Upload date:
- Size: 50.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcdadc29ae19619cbb627898b061b6307869e9faa412b654938197e9ee214e83
|
|
| MD5 |
5ac9544098b7f816860364574c35a5ef
|
|
| BLAKE2b-256 |
9db996af85936a6ed088e960cb711801c73daf941c4e694dd13f347bf2226cbb
|