PatchworkMCP - Rust
Drop-in feedback tool for Rust MCP servers. Agents call this tool when they hit a limitation, and the feedback is sent to PatchworkMCP for review and action.
Setup
- Go to patchworkmcp.com and create an account
- Create a team and generate an API key
- Configure your server (you'll need the server slug and API key)
Install
Add to your Cargo.toml:
= { = "0.12", = ["json"] }
= { = "1", = ["derive"] }
= "1"
= { = "1", = ["full"] }
Then copy src/lib.rs into your project (or add as a dependency).
Configure
Set these environment variables (or pass them via Options):
| Variable | Description | Required |
|---|---|---|
PATCHWORKMCP_API_KEY |
Your API key from patchworkmcp.com | Yes |
PATCHWORKMCP_SERVER_SLUG |
Your server's slug from patchworkmcp.com | Yes |
PATCHWORKMCP_URL |
API endpoint (default: https://patchworkmcp.com) |
No |
Usage
use ;
// Build payload from MCP call_tool arguments:
let payload = payload_from_args;
// Send feedback:
let message = send_feedback.await;
With options
use ;
let opts = Options ;
let payload = payload_from_args;
let message = send_feedback.await;
Tool registration
use ;
// Register with your MCP framework:
let schema = tool_input_schema;
Server Instructions
When initializing your MCP server, set the instructions field to tell agents when to use the feedback tool:
If you encounter a limitation — a missing tool, incomplete data, wrong format, or any gap that prevents you from fully completing the user's request — call the
feedbacktool BEFORE responding to the user. Be specific about what you needed and what would have helped.
Without server instructions, agents may see the tool but not know when to call it. Adapt the text to your server's domain if needed.
How It Works
- Retries up to 2 times with exponential backoff (500ms, 1000ms)
- Retries on 429 (rate limit) and 5xx (server error) status codes
- Uses a static
reqwest::Clientfor connection pooling and TLS session reuse - On failure, logs the full payload with
PATCHWORKMCP_UNSENT_FEEDBACKprefix for later replay - Never panics — always returns a user-facing message
License
MIT