MCP ExplorerExplorer

Python Workers Mcp

@danlapidon a year ago
25 MIT
FreeCommunity
AI Systems
A Python Worker example using FastMCP, requiring Python 3.12 and manual package installation.

Overview

What is Python Workers Mcp

python-workers-mcp is an example of a Python Worker that utilizes the FastMCP package, specifically designed to run with Python 3.12 and requires manual installation of necessary packages.

Use cases

Use cases for python-workers-mcp include building scalable web applications, processing large datasets in real-time, and automating workflows that require efficient task management.

How to use

To use python-workers-mcp, first install Python 3.12 and set up a virtual environment. Activate the environment, install the pyodide CLI, and download the required vendored packages. Development can be initiated using ‘npx wrangler@latest dev’ and deployment with ‘npx wrangler@latest deploy’.

Key features

Key features of python-workers-mcp include compatibility with Python 3.12, the use of FastMCP for efficient processing, and a structured approach for package management through vendoring.

Where to use

python-workers-mcp can be used in various fields such as web development, data processing, and automation tasks where Python Workers are beneficial for handling asynchronous operations.

Content

Python Workers: FastMCP Example

This is an example of a Python Worker that uses the FastMCP package.

Deploy to Workers

[!NOTE]
Due to the size of the Worker, this example can only be deployed if you’re using the Workers Paid plan. Free plan users will encounter deployment errors because this Worker exceeds the 3MB size limit.

Developing and Deploying

To develop your Worker run:

uv run pywrangler dev

To deploy your Worker run:

uv run pywrangler deploy

Testing

To test run:

uv run pytest tests

Linting and Formatting

This project uses Ruff for linting and formatting:

uv ruff format . --check
uv ruff check .

IDE Integration

To have good autocompletions in your IDE simply select .venv-workers/bin/python as your IDE’s interpreter.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers