Skip to main content

mcp-worker-sdk

Worker Protocol Python runtime reference implementation — a universal MCP tool runtime SDK.

Write plain Python functions with the @worker.tool decorator and automatically get standard endpoints, schema generation, parameter validation, standardized errors, lifecycle hooks, and built-in database drivers.

mcp-worker-sdk is the Python runtime binding of the language-agnostic Worker Protocol. It is Hub-agnostic: omit hub_url to run it standalone as a standard HTTP tool service that any aggregator (Hub / MCP gateway) can consume.


Install

pip install mcp-worker-sdk

With all built-in database drivers:

pip install "mcp-worker-sdk[db]"

Quick start

from mcp_worker_sdk import Worker
from mcp_worker_sdk.adapters import DBAdapter

worker = Worker(
    name="notes",
    adapter=DBAdapter("sqlite", ":memory:"),
    # hub_url="https://hub.example.com",   # optional; omit to run standalone
)


@worker.tool(
    id="notes_greet",
    title="Greet",
    description="Return a greeting for a name",
)
def greet(name: str = "World"):
    """Return a greeting.

    :param name: who to greet
    """
    return {"message": f"Hello, {name}!"}


if __name__ == "__main__":
    worker.run(port=9100)

Then:

curl http://localhost:9100/health
curl http://localhost:9100/tools
curl -X POST http://localhost:9100/execute \
  -H "Content-Type: application/json" \
  -d '{"tool_id":"notes_greet","params":{"name":"Mavis"}}'

Adapters

Adapter Purpose
ShellAdapter Command-line / sandbox / code execution
DBAdapter Relational / vector / graph / KV / document databases (7 built-in drivers)
MacAdapter macOS GUI / AppleScript / screenshots / mouse & keyboard
HTTPAdapter Cloud API forwarding (auth, signing hooks, pagination, JSONPath)
MCPClientAdapter Wrap a third-party MCP server
CustomAdapter Fully custom execution

DBAdapter built-in drivers

postgresql (psycopg), mysql (pymysql), sqlite (sqlite3), qdrant (qdrant-client), neo4j (neo4j), redis (redis), mongodb (pymongo).


CLI scaffold

mcp-worker create my-worker              # default HTTPAdapter
mcp-worker create my-worker --adapter db

License

Apache-2.0

Download files

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

Source Distribution

mcp_worker_sdk-1.0.0.tar.gz (7.9 MB view details)

Uploaded Source

Built Distribution

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

mcp_worker_sdk-1.0.0-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

Details for the file mcp_worker_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: mcp_worker_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 7.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for mcp_worker_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bfadcd29b31aa77ae51d1186cbf386bdc0c9d134489e67a5d458f957feb1bcab
MD5 e81ee21bd01f0491eed983b6e5b9c5f7
BLAKE2b-256 c6c98c461321062e0099149ba999d92b9d8210229d23d11fe359c41a641ef422

See more details on using hashes here.

File details

Details for the file mcp_worker_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_worker_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 25.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for mcp_worker_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ba24cdd97044aaa3d714aade6e3fda77a4948bc337047fdf63e7844473338546
MD5 0c249d251aff439b4f010742dad52ddd
BLAKE2b-256 94cb5c734ca4cfdbb36faa7782fc0237ba8c09706ca73bc47d455558245cdd80

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.0

2 files

1.1.0

2 files

This release

1.0.0 This release

2 files

Supported by

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