PatchworkMCP - Python
Drop-in feedback tool for Python 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
uv add httpx # or: pip install httpx
Then copy feedback_tool.py into your project.
Configure
Set these environment variables (or pass them as arguments):
| 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
FastMCP
from mcp.server.fastmcp import FastMCP
from feedback_tool import register_feedback_tool
INSTRUCTIONS = """
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 `feedback` tool BEFORE responding to the user. Be specific about what you
needed and what would have helped.
"""
server = FastMCP("my-server", instructions=INSTRUCTIONS)
register_feedback_tool(server)
Raw MCP SDK
from feedback_tool import get_tool_definition, send_feedback
# In list_tools handler:
tools.append(get_tool_definition())
# In call_tool handler:
if name == "feedback":
result = await send_feedback(arguments)
Django MCP (sync)
from feedback_tool import send_feedback_sync
result = send_feedback_sync(arguments)
Server Instructions
The instructions parameter on your MCP server is what tells agents to actually use the feedback tool. Without it, agents may see the tool but not know when to call it. The instruction text above is a good starting point — adapt it 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
- On failure, logs the full payload with
PATCHWORKMCP_UNSENT_FEEDBACKprefix for later replay - Never throws or raises — always returns a user-facing message
License
MIT
Metadata
Release files for patchworkmcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| patchworkmcp-0.1.0.tar.gz | 7.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| patchworkmcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.3 kB
Release files / patchworkmcp-0.1.0.tar.gz
| Download URL | patchworkmcp-0.1.0.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85b5633774b56607475189d29e20656f940e9604dc78a977c85c957cb4037688
|
|
BLAKE2b-256 checksum How to use checksums |
fa5d590c812c9a2d2119cca86b3db41593d4ad398b4ccf413b78e150816ac948
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / patchworkmcp-0.1.0-py3-none-any.whl
| Download URL | patchworkmcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d40ec81d1648fbfca61e016350aa818c6dfe97efd09f05d9a5aeb9d0f2729571
|
|
BLAKE2b-256 checksum How to use checksums |
39e67e4d912c1e51c695e43a3367adc8b0a88571e46d5cba8ce22b742dff2cab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|