Add UV as a new server type for Python extensions that use UV runtime
for dependency management instead of bundling dependencies.
Schema changes (v0.4):
- Add "uv" to server.type enum
- Make mcp_config optional (not needed for UV type)
- UV extensions rely on pyproject.toml for dependencies
Documentation:
- Add UV runtime section to MANIFEST.md explaining benefits and usage
- Update README.md to recommend UV runtime for Python
- Add complete hello-world-uv example
Benefits of UV runtime:
- Cross-platform support (Windows/macOS/Linux, Intel/ARM)
- Small bundle size (~100 KB vs 5-10 MB)
- Handles compiled dependencies portably
- No user Python installation required
Example manifest:
{
"manifest_version": "0.4",
"server": {
"type": "uv",
"entry_point": "src/server.py"
}
}
Co-authored-by: Joan <joan@anthropic.com>
1.4 KiB
1.4 KiB
Hello World UV Runtime Example (Experimental)
Note: UV runtime support is experimental and may change in future versions.
This example demonstrates a minimal MCP server using UV runtime.
What is UV Runtime?
UV runtime lets Claude Desktop automatically manage Python and dependencies for your extension:
- Downloads the correct Python version for the user's platform
- Creates an isolated virtual environment
- Installs dependencies from
pyproject.toml - Works cross-platform (Windows, macOS, Linux) without user setup
Structure
hello-world-uv/
├── manifest.json # server.type = "uv"
├── pyproject.toml # Dependencies listed here
├── .mcpbignore # Exclude build artifacts
└── src/
└── server.py # MCP server implementation
Key Differences from Python Runtime
UV Runtime (this example):
server.type = "uv"- No bundled dependencies
- No
mcp_configneeded - Small bundle size (~2 KB)
- Works on any platform
Python Runtime (traditional):
server.type = "python"- Must bundle dependencies in
server/lib/ - Requires
mcp_configwith PYTHONPATH - Larger bundle size
- Only works with pure Python (no compiled deps)
Installing
mcpb pack
Install the generated .mcpb file in Claude Desktop.
Testing Locally
# Install dependencies
uv sync
# Run server
uv run src/server.py
Tools
- say_hello - Greets a person by name