fix: repair broken examples and graduate UV runtime from experimental

- hello-world-node: wrap server startup in async main() with proper
  await on server.connect(transport) — fixes crash on initialize in
  Claude Desktop UtilityProcess runtime (closes #200)
- hello-world-uv: add required mcp_config block — v0.4 schema requires
  it but the example omitted it, causing mcpb pack to fail
- file-manager-python: convert from broken v0.1/python to v0.4/uv —
  the old manifest had privacy_policies on v0.1 (schema violation),
  used command "python" (ENOENT on macOS), and had no bundled deps.
  Now uses UV runtime with proper mcp_config (closes #47, closes #72)
- Graduate UV runtime from experimental across docs and schema comments
- Bump DEFAULT_MANIFEST_VERSION from 0.2 to 0.3

All three examples verified: pack succeeds, server responds to MCP
initialize over stdio, tools/list returns expected tools.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Thompson 2026-03-12 11:16:30 -05:00
commit a5d9ae8ed2
No known key found for this signature in database
GPG key ID: 1D66D91917EE02E6
13 changed files with 44 additions and 57 deletions

2
.gitignore vendored
View file

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

View file

@ -403,11 +403,9 @@ Four server types are supported:
- **`node`**: Node.js server with bundled dependencies
- **`python`**: Python server with bundled dependencies
- **`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+)
> **Note:** UV runtime support is experimental and may change in future versions.
### UV Runtime (v0.4+)
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
**UV Runtime (Experimental - v0.4+):**
**UV Runtime (v0.4+):**
- Use `server.type = "uv"` in manifest
- 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.1",
"manifest_version": "0.4",
"name": "file-manager-python",
"display_name": "Python File Manager MCP",
"version": "0.1.0",
"version": "0.2.0",
"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": {
"name": "Anthropic",
"email": "support@anthropic.com",
"url": "https://github.com/anthropics"
},
"server": {
"type": "python",
"type": "uv",
"entry_point": "server/main.py",
"mcp_config": {
"command": "python",
"command": "uv",
"args": [
"${__dirname}/server/main.py",
"run",
"--directory", "${__dirname}",
"server/main.py",
"--workspace=${user_config.workspace_directory}"
],
"env": {
"DEBUG": "${user_config.debug_mode}",
"PYTHONPATH": "${__dirname}/server/lib"
"DEBUG": "${user_config.debug_mode}"
}
}
},
@ -62,8 +62,7 @@
"claude_desktop": ">=0.10.0",
"platforms": ["darwin", "win32", "linux"],
"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]
name = "file-manager-python"
version = "0.1.0"
version = "0.2.0"
description = "A Python MCP server for file operations"
authors = [
{name = "Anthropic", email = "support@anthropic.com"}
requires-python = ">=3.10"
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
const transport = new StdioServerTransport();
server.connect(transport);
async function main() {
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)
> **Note:** UV runtime support is experimental and may change in future versions.
# Hello World UV Runtime Example
This example demonstrates a minimal MCP server using **UV runtime**.
@ -28,7 +26,7 @@ hello-world-uv/
**UV Runtime** (this example):
- `server.type = "uv"`
- No bundled dependencies
- No `mcp_config` needed
- `mcp_config` uses `uv run` to auto-resolve deps from `pyproject.toml`
- Small bundle size (~2 KB)
- Works on any platform

View file

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

View file

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

View file

@ -1,5 +1,4 @@
// v0.4: Adds UV runtime support for Python extensions
// NOTE: This schema version is experimental and subject to change.
import * as z from "zod";
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
*/
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