Skip to content

Commit cf1f956

Browse files
Merge pull request #206 from modelcontextprotocol/worktree-fix-examples-uv-graduation
fix: repair broken examples and graduate UV runtime
2 parents 8f5f210 + a5d9ae8 commit cf1f956

File tree

13 files changed

+44
-57
lines changed

13 files changed

+44
-57
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ typings/
8888
# Claude files
8989
.claude.json
9090
.claude/
91+
CLAUDE.md
92+
PROJECT_STATUS.md
9193

9294
# Vite
9395
.vite/

MANIFEST.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,9 @@ Four server types are supported:
403403
- **`node`**: Node.js server with bundled dependencies
404404
- **`python`**: Python server with bundled dependencies
405405
- **`binary`**: Compiled executable
406-
- **`uv`**: Python server using UV runtime (experimental, v0.4+)
406+
- **`uv`**: Python server using UV runtime (v0.4+)
407407

408-
### UV Runtime (Experimental, v0.4+)
409-
410-
> **Note:** UV runtime support is experimental and may change in future versions.
408+
### UV Runtime (v0.4+)
411409

412410
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.
413411

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ bundle.mcpb (ZIP file)
109109

110110
### Bundling Dependencies
111111

112-
**UV Runtime (Experimental - v0.4+):**
112+
**UV Runtime (v0.4+):**
113113

114114
- Use `server.type = "uv"` in manifest
115115
- Include `pyproject.toml` with dependencies (no bundled packages needed)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.venv/
2+
__pycache__/
3+
*.pyc
4+
.pytest_cache/
5+
.mypy_cache/
6+
*.egg-info/
7+
uv.lock

examples/file-manager-python/manifest.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
{
2-
"$schema": "../../dist/mcpb-manifest.schema.json",
3-
"manifest_version": "0.1",
2+
"manifest_version": "0.4",
43
"name": "file-manager-python",
54
"display_name": "Python File Manager MCP",
6-
"version": "0.1.0",
5+
"version": "0.2.0",
76
"description": "A Python MCP server for file operations",
8-
"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.",
7+
"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.",
98
"author": {
109
"name": "Anthropic",
1110
"email": "support@anthropic.com",
1211
"url": "https://github.com/anthropics"
1312
},
1413
"server": {
15-
"type": "python",
14+
"type": "uv",
1615
"entry_point": "server/main.py",
1716
"mcp_config": {
18-
"command": "python",
17+
"command": "uv",
1918
"args": [
20-
"${__dirname}/server/main.py",
19+
"run",
20+
"--directory", "${__dirname}",
21+
"server/main.py",
2122
"--workspace=${user_config.workspace_directory}"
2223
],
2324
"env": {
24-
"DEBUG": "${user_config.debug_mode}",
25-
"PYTHONPATH": "${__dirname}/server/lib"
25+
"DEBUG": "${user_config.debug_mode}"
2626
}
2727
}
2828
},
@@ -62,8 +62,7 @@
6262
"claude_desktop": ">=0.10.0",
6363
"platforms": ["darwin", "win32", "linux"],
6464
"runtimes": {
65-
"python": ">=3.8.0 <4"
65+
"python": ">=3.10.0 <4"
6666
}
67-
},
68-
"privacy_policies": []
67+
}
6968
}
Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,8 @@
1-
[build-system]
2-
requires = ["setuptools>=42", "wheel"]
3-
build-backend = "setuptools.build_meta"
4-
51
[project]
62
name = "file-manager-python"
7-
version = "0.1.0"
3+
version = "0.2.0"
84
description = "A Python MCP server for file operations"
9-
authors = [
10-
{name = "Anthropic", email = "support@anthropic.com"}
5+
requires-python = ">=3.10"
6+
dependencies = [
7+
"mcp>=1.0.0",
118
]
12-
license = {text = "MIT"}
13-
classifiers = [
14-
"Private :: Do Not Upload" # Prevents accidental uploads to PyPI
15-
]
16-
17-
[project.dependencies]
18-
mcp = ">=1.0.0"
19-
trio = ">=0.22.0"
20-
21-
[tool.setuptools]
22-
packages = ["server"]
23-
24-
[project.scripts]
25-
bundle-deps = "python:install_deps"
26-
27-
# Custom scripts section for DXT development
28-
[tool.dxt]
29-
bundle = "pip install \"mcp[all]\" --target server/lib --upgrade --force-reinstall"
30-
test = "python server/main.py --debug"
31-
pack = "npx @anthropic-ai/dxt pack"

examples/file-manager-python/requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

examples/hello-world-node/server/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
6464
});
6565

6666
// Start the server
67-
const transport = new StdioServerTransport();
68-
server.connect(transport);
67+
async function main() {
68+
const transport = new StdioServerTransport();
69+
await server.connect(transport);
70+
console.error("Hello World MCP server running...");
71+
}
6972

70-
console.error("Hello World MCP server running...");
73+
main().catch((error) => {
74+
console.error("Fatal error in main():", error);
75+
process.exit(1);
76+
});

examples/hello-world-uv/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Hello World UV Runtime Example (Experimental)
2-
3-
> **Note:** UV runtime support is experimental and may change in future versions.
1+
# Hello World UV Runtime Example
42

53
This example demonstrates a minimal MCP server using **UV runtime**.
64

@@ -28,7 +26,7 @@ hello-world-uv/
2826
**UV Runtime** (this example):
2927
- `server.type = "uv"`
3028
- No bundled dependencies
31-
- No `mcp_config` needed
29+
- `mcp_config` uses `uv run` to auto-resolve deps from `pyproject.toml`
3230
- Small bundle size (~2 KB)
3331
- Works on any platform
3432

examples/hello-world-uv/manifest.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
"icon": "icon.png",
1111
"server": {
1212
"type": "uv",
13-
"entry_point": "src/server.py"
13+
"entry_point": "src/server.py",
14+
"mcp_config": {
15+
"command": "uv",
16+
"args": ["run", "--directory", "${__dirname}", "src/server.py"]
17+
}
1418
},
1519
"compatibility": {
1620
"platforms": ["darwin", "linux", "win32"],

0 commit comments

Comments
 (0)