feat: add UV runtime support in manifest v0.4
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>
This commit is contained in:
parent
dd9502e8ec
commit
d90365e626
3 changed files with 913 additions and 4 deletions
145
src/schemas/0.4.ts
Normal file
145
src/schemas/0.4.ts
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
// v0.4: Adds UV runtime support for Python extensions
|
||||
import * as z from "zod";
|
||||
|
||||
export const MANIFEST_VERSION = "0.4";
|
||||
|
||||
const LOCALE_PLACEHOLDER_REGEX = /\$\{locale\}/i;
|
||||
const BCP47_REGEX = /^[A-Za-z0-9]{2,8}(?:-[A-Za-z0-9]{1,8})*$/;
|
||||
const ICON_SIZE_REGEX = /^\d+x\d+$/;
|
||||
|
||||
export const McpServerConfigSchema = z.strictObject({
|
||||
command: z.string(),
|
||||
args: z.array(z.string()).optional(),
|
||||
env: z.record(z.string(), z.string()).optional(),
|
||||
});
|
||||
|
||||
export const McpbManifestAuthorSchema = z.strictObject({
|
||||
name: z.string(),
|
||||
email: z.string().email().optional(),
|
||||
url: z.string().url().optional(),
|
||||
});
|
||||
|
||||
export const McpbManifestRepositorySchema = z.strictObject({
|
||||
type: z.string(),
|
||||
url: z.string().url(),
|
||||
});
|
||||
|
||||
export const McpbManifestPlatformOverrideSchema =
|
||||
McpServerConfigSchema.partial();
|
||||
|
||||
export const McpbManifestMcpConfigSchema = McpServerConfigSchema.extend({
|
||||
platform_overrides: z
|
||||
.record(z.string(), McpbManifestPlatformOverrideSchema)
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export const McpbManifestServerSchema = z.strictObject({
|
||||
type: z.enum(["python", "node", "binary", "uv"]),
|
||||
entry_point: z.string(),
|
||||
// mcp_config is optional for UV type (UV handles execution)
|
||||
mcp_config: McpbManifestMcpConfigSchema.optional(),
|
||||
});
|
||||
|
||||
export const McpbManifestCompatibilitySchema = z.strictObject({
|
||||
claude_desktop: z.string().optional(),
|
||||
platforms: z.array(z.enum(["darwin", "win32", "linux"])).optional(),
|
||||
runtimes: z
|
||||
.strictObject({
|
||||
python: z.string().optional(),
|
||||
node: z.string().optional(),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export const McpbManifestToolSchema = z.strictObject({
|
||||
name: z.string(),
|
||||
description: z.string().optional(),
|
||||
});
|
||||
|
||||
export const McpbManifestPromptSchema = z.strictObject({
|
||||
name: z.string(),
|
||||
description: z.string().optional(),
|
||||
arguments: z.array(z.string()).optional(),
|
||||
text: z.string(),
|
||||
});
|
||||
|
||||
export const McpbUserConfigurationOptionSchema = z.strictObject({
|
||||
type: z.enum(["string", "number", "boolean", "directory", "file"]),
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
required: z.boolean().optional(),
|
||||
default: z
|
||||
.union([z.string(), z.number(), z.boolean(), z.array(z.string())])
|
||||
.optional(),
|
||||
multiple: z.boolean().optional(),
|
||||
sensitive: z.boolean().optional(),
|
||||
min: z.number().optional(),
|
||||
max: z.number().optional(),
|
||||
});
|
||||
|
||||
export const McpbManifestLocalizationSchema = z.strictObject({
|
||||
resources: z
|
||||
.string()
|
||||
.regex(
|
||||
LOCALE_PLACEHOLDER_REGEX,
|
||||
'resources must include a "${locale}" placeholder',
|
||||
),
|
||||
default_locale: z
|
||||
.string()
|
||||
.regex(
|
||||
BCP47_REGEX,
|
||||
"default_locale must be a valid BCP 47 locale identifier",
|
||||
),
|
||||
});
|
||||
|
||||
export const McpbManifestIconSchema = z.strictObject({
|
||||
src: z.string(),
|
||||
size: z
|
||||
.string()
|
||||
.regex(
|
||||
ICON_SIZE_REGEX,
|
||||
'size must be in the format "WIDTHxHEIGHT" (e.g., "16x16")',
|
||||
),
|
||||
theme: z.string().min(1, "theme cannot be empty when provided").optional(),
|
||||
});
|
||||
|
||||
export const McpbManifestSchema = z
|
||||
.strictObject({
|
||||
$schema: z.string().optional(),
|
||||
dxt_version: z
|
||||
.literal(MANIFEST_VERSION)
|
||||
.optional()
|
||||
.describe("@deprecated Use manifest_version instead"),
|
||||
manifest_version: z.literal(MANIFEST_VERSION).optional(),
|
||||
name: z.string(),
|
||||
display_name: z.string().optional(),
|
||||
version: z.string(),
|
||||
description: z.string(),
|
||||
long_description: z.string().optional(),
|
||||
author: McpbManifestAuthorSchema,
|
||||
repository: McpbManifestRepositorySchema.optional(),
|
||||
homepage: z.string().url().optional(),
|
||||
documentation: z.string().url().optional(),
|
||||
support: z.string().url().optional(),
|
||||
icon: z.string().optional(),
|
||||
icons: z.array(McpbManifestIconSchema).optional(),
|
||||
screenshots: z.array(z.string()).optional(),
|
||||
localization: McpbManifestLocalizationSchema.optional(),
|
||||
server: McpbManifestServerSchema,
|
||||
tools: z.array(McpbManifestToolSchema).optional(),
|
||||
tools_generated: z.boolean().optional(),
|
||||
prompts: z.array(McpbManifestPromptSchema).optional(),
|
||||
prompts_generated: z.boolean().optional(),
|
||||
keywords: z.array(z.string()).optional(),
|
||||
license: z.string().optional(),
|
||||
privacy_policies: z.array(z.string().url()).optional(),
|
||||
compatibility: McpbManifestCompatibilitySchema.optional(),
|
||||
user_config: z
|
||||
.record(z.string(), McpbUserConfigurationOptionSchema)
|
||||
.optional(),
|
||||
_meta: z.record(z.string(), z.record(z.string(), z.any())).optional(),
|
||||
})
|
||||
.refine((data) => !!(data.dxt_version || data.manifest_version), {
|
||||
message:
|
||||
"Either 'dxt_version' (deprecated) or 'manifest_version' must be provided",
|
||||
});
|
||||
|
|
@ -3,13 +3,15 @@ import * as z from "zod";
|
|||
import * as v0_1 from "./0.1.js";
|
||||
import * as v0_2 from "./0.2.js";
|
||||
import * as v0_3 from "./0.3.js";
|
||||
import * as v0_4 from "./0.4.js";
|
||||
|
||||
/**
|
||||
* Union schema that accepts any supported manifest version (0.1, 0.2, 0.3).
|
||||
* Union schema that accepts any supported manifest version.
|
||||
* Use this when you need to validate manifests of any version.
|
||||
*/
|
||||
export const McpbManifestSchema = z.union([
|
||||
v0_1.McpbManifestSchema,
|
||||
v0_2.McpbManifestSchema,
|
||||
v0_3.McpbManifestSchema,
|
||||
v0_4.McpbManifestSchema,
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
import { McpbManifestSchema as ManifestSchemaV0_1 } from "./0.1.js";
|
||||
import { McpbManifestSchema as ManifestSchemaV0_2 } from "./0.2.js";
|
||||
import { McpbManifestSchema as ManifestSchemaV0_3 } from "./0.3.js";
|
||||
import { McpbManifestSchema as ManifestSchemaV0_4 } from "./0.4.js";
|
||||
|
||||
export * as v0_1 from "./0.1.js";
|
||||
export * as v0_2 from "./0.2.js";
|
||||
export * as v0_3 from "./0.3.js";
|
||||
export * as v0_4 from "./0.4.js";
|
||||
export * as vAny from "./any.js";
|
||||
|
||||
/**
|
||||
|
|
@ -14,4 +16,5 @@ export const VERSIONED_MANIFEST_SCHEMAS = {
|
|||
"0.1": ManifestSchemaV0_1,
|
||||
"0.2": ManifestSchemaV0_2,
|
||||
"0.3": ManifestSchemaV0_3,
|
||||
"0.4": ManifestSchemaV0_4,
|
||||
} as const;
|
||||
|
|
|
|||
Loading…
Reference in a new issue