Merge pull request #206 from modelcontextprotocol/worktree-fix-examples-uv-graduation

fix: repair broken examples and graduate UV runtime
This commit is contained in:
joan-anthropic 2026-04-05 11:01:13 -07:00 • committed by GitHub
commit cf1f956935
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 44 additions and 57 deletions

2
.gitignore vendored
View file

@ -88,6 +88,8 @@ typings/
# Claude files # Claude files
.claude.json .claude.json
.claude/ .claude/
CLAUDE.md
PROJECT_STATUS.md
# Vite # Vite
.vite/ .vite/

View file

@ -403,11 +403,9 @@ Four server types are supported:
- **`node`**: Node.js server with bundled dependencies - **`node`**: Node.js server with bundled dependencies
- **`python`**: Python server with bundled dependencies - **`python`**: Python server with bundled dependencies
- **`binary`**: Compiled executable - **`binary`**: Compiled executable
- **`uv`**: Python server using UV runtime (experimental, v0.4+) - **`uv`**: Python server using UV runtime (v0.4+)
### UV Runtime (Experimental, v0.4+) ### UV Runtime (v0.4+)
> **Note:** UV runtime support is experimental and may change in future versions.
The `uv` server type enables cross-platform Python extensions without bundling dependencies. Instead, dependencies are declared in `pyproject.toml` and installed by the host application using UV. The `uv` server type enables cross-platform Python extensions without bundling dependencies. Instead, dependencies are declared in `pyproject.toml` and installed by the host application using UV.

View file

@ -109,7 +109,7 @@ bundle.mcpb (ZIP file)
### Bundling Dependencies ### Bundling Dependencies
**UV Runtime (Experimental - v0.4+):** **UV Runtime (v0.4+):**
- Use `server.type = "uv"` in manifest - Use `server.type = "uv"` in manifest
- Include `pyproject.toml` with dependencies (no bundled packages needed) - Include `pyproject.toml` with dependencies (no bundled packages needed)

View file

@ -0,0 +1,7 @@
.venv/
__pycache__/
*.pyc
.pytest_cache/
.mypy_cache/
*.egg-info/
uv.lock

View file

@ -1,28 +1,28 @@
{ {
"$schema": "../../dist/mcpb-manifest.schema.json", "manifest_version": "0.4",
"manifest_version": "0.1",
"name": "file-manager-python", "name": "file-manager-python",
"display_name": "Python File Manager MCP", "display_name": "Python File Manager MCP",
"version": "0.1.0", "version": "0.2.0",
"description": "A Python MCP server for file operations", "description": "A Python MCP server for file operations",
"long_description": "This extension provides file management capabilities through a Python MCP server. It demonstrates Python-based MCP Bundle development, including file operations, directory management, and proper MCP protocol implementation.", "long_description": "This extension provides file management capabilities through a Python MCP server. It demonstrates Python-based MCP Bundle development using UV runtime, including file operations, directory management, and proper MCP protocol implementation.",
"author": { "author": {
"name": "Anthropic", "name": "Anthropic",
"email": "support@anthropic.com", "email": "support@anthropic.com",
"url": "https://github.com/anthropics" "url": "https://github.com/anthropics"
}, },
"server": { "server": {
"type": "python", "type": "uv",
"entry_point": "server/main.py", "entry_point": "server/main.py",
"mcp_config": { "mcp_config": {
"command": "python", "command": "uv",
"args": [ "args": [
"${__dirname}/server/main.py", "run",
"--directory", "${__dirname}",
"server/main.py",
"--workspace=${user_config.workspace_directory}" "--workspace=${user_config.workspace_directory}"
], ],
"env": { "env": {
"DEBUG": "${user_config.debug_mode}", "DEBUG": "${user_config.debug_mode}"
"PYTHONPATH": "${__dirname}/server/lib"
} }
} }
}, },
@ -62,8 +62,7 @@
"claude_desktop": ">=0.10.0", "claude_desktop": ">=0.10.0",
"platforms": ["darwin", "win32", "linux"], "platforms": ["darwin", "win32", "linux"],
"runtimes": { "runtimes": {
"python": ">=3.8.0 <4" "python": ">=3.10.0 <4"
} }
}, }
"privacy_policies": []
} }

View file

@ -1,31 +1,8 @@
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"
[project] [project]
name = "file-manager-python" name = "file-manager-python"
version = "0.1.0" version = "0.2.0"
description = "A Python MCP server for file operations" description = "A Python MCP server for file operations"
authors = [ requires-python = ">=3.10"
{name = "Anthropic", email = "support@anthropic.com"} dependencies = [
"mcp>=1.0.0",
] ]
license = {text = "MIT"}
classifiers = [
"Private :: Do Not Upload" # Prevents accidental uploads to PyPI
]
[project.dependencies]
mcp = ">=1.0.0"
trio = ">=0.22.0"
[tool.setuptools]
packages = ["server"]
[project.scripts]
bundle-deps = "python:install_deps"
# Custom scripts section for DXT development
[tool.dxt]
bundle = "pip install \"mcp[all]\" --target server/lib --upgrade --force-reinstall"
test = "python server/main.py --debug"
pack = "npx @anthropic-ai/dxt pack"

View file

@ -1,2 +0,0 @@
mcp>=1.0.0
trio>=0.22.0

View file

@ -64,7 +64,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
}); });
// Start the server // Start the server
const transport = new StdioServerTransport(); async function main() {
server.connect(transport); const transport = new StdioServerTransport();
await server.connect(transport);
console.error("Hello World MCP server running...");
}
console.error("Hello World MCP server running..."); main().catch((error) => {
console.error("Fatal error in main():", error);
process.exit(1);
});

View file

@ -1,6 +1,4 @@
# Hello World UV Runtime Example (Experimental) # Hello World UV Runtime Example
> **Note:** UV runtime support is experimental and may change in future versions.
This example demonstrates a minimal MCP server using **UV runtime**. This example demonstrates a minimal MCP server using **UV runtime**.
@ -28,7 +26,7 @@ hello-world-uv/
**UV Runtime** (this example): **UV Runtime** (this example):
- `server.type = "uv"` - `server.type = "uv"`
- No bundled dependencies - No bundled dependencies
- No `mcp_config` needed - `mcp_config` uses `uv run` to auto-resolve deps from `pyproject.toml`
- Small bundle size (~2 KB) - Small bundle size (~2 KB)
- Works on any platform - Works on any platform

View file

@ -10,7 +10,11 @@
"icon": "icon.png", "icon": "icon.png",
"server": { "server": {
"type": "uv", "type": "uv",
"entry_point": "src/server.py" "entry_point": "src/server.py",
"mcp_config": {
"command": "uv",
"args": ["run", "--directory", "${__dirname}", "src/server.py"]
}
}, },
"compatibility": { "compatibility": {
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],

View file

@ -1,5 +1,4 @@
// v0.4: Adds UV runtime support for Python extensions // v0.4: Adds UV runtime support for Python extensions
// NOTE: This schema version is experimental and subject to change.
import * as z from "zod"; import * as z from "zod";
export const MANIFEST_VERSION = "0.4"; export const MANIFEST_VERSION = "0.4";

View file

@ -1,5 +1,4 @@
// v0.4: Adds UV runtime support for Python extensions // v0.4: Adds UV runtime support for Python extensions
// NOTE: This schema version is experimental and subject to change.
import * as z from "zod"; import * as z from "zod";
export const MANIFEST_VERSION = "0.4"; export const MANIFEST_VERSION = "0.4";

View file

@ -15,7 +15,7 @@ export const LATEST_MANIFEST_VERSION = "0.4" as const;
/** /**
* Default manifest version for new packages * Default manifest version for new packages
*/ */
export const DEFAULT_MANIFEST_VERSION = "0.2" as const; export const DEFAULT_MANIFEST_VERSION = "0.3" as const;
/** /**
* Map of manifest versions to their strict schemas * Map of manifest versions to their strict schemas