Skip to main content

PatchworkMCP drop-in feedback tool for Python MCP servers

Project description

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

  1. Go to patchworkmcp.com and create an account
  2. Create a team and generate an API key
  3. 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_FEEDBACK prefix for later replay
  • Never throws or raises — always returns a user-facing message

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

patchworkmcp-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

patchworkmcp-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file patchworkmcp-0.1.0.tar.gz.

File metadata

  • Download URL: patchworkmcp-0.1.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for patchworkmcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 85b5633774b56607475189d29e20656f940e9604dc78a977c85c957cb4037688
MD5 2d8807e95c2fc22acd382e471085883b
BLAKE2b-256 fa5d590c812c9a2d2119cca86b3db41593d4ad398b4ccf413b78e150816ac948

See more details on using hashes here.

File details

Details for the file patchworkmcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: patchworkmcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for patchworkmcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d40ec81d1648fbfca61e016350aa818c6dfe97efd09f05d9a5aeb9d0f2729571
MD5 4b468949d2b7b5b76fd7d5c320ec4f58
BLAKE2b-256 39e67e4d912c1e51c695e43a3367adc8b0a88571e46d5cba8ce22b742dff2cab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page