Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@ jobs:
if: '!startsWith(github.ref, ''refs/tags/'')'
env:
CARGO_PROFILE_DEV_DEBUG: 0
run: cargo test --locked --lib -p deno -p denort -p node_shim -p bsdiff_helper -p deno_lib -p deno_snapshots -p deno_bundle_runtime -p deno_cache -p deno_canvas -p deno_cron -p deno_crypto -p deno_fetch -p deno_ffi -p deno_fs -p deno_http -p deno_image -p deno_io -p deno_kv -p deno_napi -p napi_sym -p deno_net -p deno_node -p deno_node_crypto -p deno_node_sqlite -p denort_helper -p deno_signals -p deno_telemetry -p deno_url -p deno_web -p deno_webgpu -p deno_webidl -p deno_websocket -p deno_webstorage -p deno_cache_dir -p deno_config -p deno_crypto_provider -p deno_dotenv -p eszip -p deno_http_h1 -p deno_inspector_server -p deno_lockfile -p deno_maybe_sync -p napi_sys -p node_resolver -p deno_npm -p deno_npm_cache -p deno_npm_installer -p deno_npmrc -p deno_package_json -p deno_resolver -p deno_typescript_go_client_rust -p deno_runtime -p deno_features -p deno_permissions -p deno_subprocess_windows
run: cargo test --locked --lib -p deno -p denort -p node_shim -p bsdiff_helper -p deno_lib -p deno_snapshots -p deno_bundle_runtime -p deno_cache -p deno_canvas -p deno_cron -p deno_crypto -p deno_fetch -p deno_ffi -p deno_fs -p deno_http -p deno_image -p deno_io -p deno_kv -p deno_mcp -p deno_napi -p napi_sym -p deno_net -p deno_node -p deno_node_crypto -p deno_node_sqlite -p denort_helper -p deno_signals -p deno_telemetry -p deno_url -p deno_web -p deno_webgpu -p deno_webidl -p deno_websocket -p deno_webstorage -p deno_cache_dir -p deno_config -p deno_crypto_provider -p deno_dotenv -p eszip -p deno_http_h1 -p deno_inspector_server -p deno_lockfile -p deno_maybe_sync -p napi_sys -p node_resolver -p deno_npm -p deno_npm_cache -p deno_npm_installer -p deno_npmrc -p deno_package_json -p deno_resolver -p deno_typescript_go_client_rust -p deno_runtime -p deno_features -p deno_permissions -p deno_subprocess_windows
- name: Cache cargo home
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
Expand Down Expand Up @@ -2572,7 +2572,7 @@ jobs:
if: '!startsWith(github.ref, ''refs/tags/'')'
env:
CARGO_PROFILE_DEV_DEBUG: 0
run: cargo test --locked --lib -p deno -p denort -p node_shim -p bsdiff_helper -p deno_lib -p deno_snapshots -p deno_bundle_runtime -p deno_cache -p deno_canvas -p deno_cron -p deno_crypto -p deno_fetch -p deno_ffi -p deno_fs -p deno_http -p deno_image -p deno_io -p deno_kv -p deno_napi -p napi_sym -p deno_net -p deno_node -p deno_node_crypto -p deno_node_sqlite -p denort_helper -p deno_signals -p deno_telemetry -p deno_url -p deno_web -p deno_webgpu -p deno_webidl -p deno_websocket -p deno_webstorage -p deno_cache_dir -p deno_config -p deno_crypto_provider -p deno_dotenv -p eszip -p deno_http_h1 -p deno_inspector_server -p deno_lockfile -p deno_maybe_sync -p napi_sys -p node_resolver -p deno_npm -p deno_npm_cache -p deno_npm_installer -p deno_npmrc -p deno_package_json -p deno_resolver -p deno_typescript_go_client_rust -p deno_runtime -p deno_features -p deno_permissions -p deno_subprocess_windows
run: cargo test --locked --lib -p deno -p denort -p node_shim -p bsdiff_helper -p deno_lib -p deno_snapshots -p deno_bundle_runtime -p deno_cache -p deno_canvas -p deno_cron -p deno_crypto -p deno_fetch -p deno_ffi -p deno_fs -p deno_http -p deno_image -p deno_io -p deno_kv -p deno_mcp -p deno_napi -p napi_sym -p deno_net -p deno_node -p deno_node_crypto -p deno_node_sqlite -p denort_helper -p deno_signals -p deno_telemetry -p deno_url -p deno_web -p deno_webgpu -p deno_webidl -p deno_websocket -p deno_webstorage -p deno_cache_dir -p deno_config -p deno_crypto_provider -p deno_dotenv -p eszip -p deno_http_h1 -p deno_inspector_server -p deno_lockfile -p deno_maybe_sync -p napi_sys -p node_resolver -p deno_npm -p deno_npm_cache -p deno_npm_installer -p deno_npmrc -p deno_package_json -p deno_resolver -p deno_typescript_go_client_rust -p deno_runtime -p deno_features -p deno_permissions -p deno_subprocess_windows
- name: Cache cargo home
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
Expand Down Expand Up @@ -5807,7 +5807,7 @@ jobs:
if: '!startsWith(github.ref, ''refs/tags/'')'
env:
CARGO_PROFILE_DEV_DEBUG: 0
run: cargo test --locked --lib -p deno -p denort -p node_shim -p bsdiff_helper -p deno_lib -p deno_snapshots -p deno_bundle_runtime -p deno_cache -p deno_canvas -p deno_cron -p deno_crypto -p deno_fetch -p deno_ffi -p deno_fs -p deno_http -p deno_image -p deno_io -p deno_kv -p deno_napi -p napi_sym -p deno_net -p deno_node -p deno_node_crypto -p deno_node_sqlite -p denort_helper -p deno_signals -p deno_telemetry -p deno_url -p deno_web -p deno_webgpu -p deno_webidl -p deno_websocket -p deno_webstorage -p deno_cache_dir -p deno_config -p deno_crypto_provider -p deno_dotenv -p eszip -p deno_http_h1 -p deno_inspector_server -p deno_lockfile -p deno_maybe_sync -p napi_sys -p node_resolver -p deno_npm -p deno_npm_cache -p deno_npm_installer -p deno_npmrc -p deno_package_json -p deno_resolver -p deno_typescript_go_client_rust -p deno_runtime -p deno_features -p deno_permissions -p deno_subprocess_windows
run: cargo test --locked --lib -p deno -p denort -p node_shim -p bsdiff_helper -p deno_lib -p deno_snapshots -p deno_bundle_runtime -p deno_cache -p deno_canvas -p deno_cron -p deno_crypto -p deno_fetch -p deno_ffi -p deno_fs -p deno_http -p deno_image -p deno_io -p deno_kv -p deno_mcp -p deno_napi -p napi_sym -p deno_net -p deno_node -p deno_node_crypto -p deno_node_sqlite -p denort_helper -p deno_signals -p deno_telemetry -p deno_url -p deno_web -p deno_webgpu -p deno_webidl -p deno_websocket -p deno_webstorage -p deno_cache_dir -p deno_config -p deno_crypto_provider -p deno_dotenv -p eszip -p deno_http_h1 -p deno_inspector_server -p deno_lockfile -p deno_maybe_sync -p napi_sys -p node_resolver -p deno_npm -p deno_npm_cache -p deno_npm_installer -p deno_npmrc -p deno_package_json -p deno_resolver -p deno_typescript_go_client_rust -p deno_runtime -p deno_features -p deno_permissions -p deno_subprocess_windows
- name: Cache cargo home
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
if: '!startsWith(github.ref, ''refs/tags/'') && github.ref == ''refs/heads/main'''
Expand Down
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ members = [
"ext/image",
"ext/io",
"ext/kv",
"ext/mcp",
"ext/napi",
"ext/napi/sym",
"ext/net",
Expand Down Expand Up @@ -123,6 +124,7 @@ deno_http = { version = "0.249.0", path = "./ext/http" }
deno_image = { version = "0.27.0", path = "./ext/image" }
deno_io = { version = "0.161.0", path = "./ext/io" }
deno_kv = { version = "0.159.0", path = "./ext/kv" }
deno_mcp = { version = "0.1.0", path = "./ext/mcp" }
deno_napi = { version = "0.182.0", path = "./ext/napi" }
deno_net = { version = "0.243.0", path = "./ext/net" }
deno_node = { version = "0.189.0", path = "./ext/node" }
Expand Down
175 changes: 175 additions & 0 deletions cli/tsc/dts/lib.deno.unstable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,181 @@ declare namespace Deno {
handler: () => Promise<void> | void,
): Promise<void>;

/** **UNSTABLE**: New API, yet to be vetted.
*
* Options for creating a {@linkcode Deno.McpServer}.
*
* @category MCP
* @experimental
*/
export interface McpServerOptions {
/** The server name reported to clients during the initialize
* handshake. */
name: string;
/** The server version reported to clients during the initialize
* handshake. */
version: string;
/** Optional usage instructions surfaced to the client (and typically to
* the model) after initialization. */
instructions?: string;
}

/** **UNSTABLE**: New API, yet to be vetted.
*
* Definition of an MCP tool, as reported by `tools/list`.
*
* @category MCP
* @experimental
*/
export interface McpToolDefinition {
/** Optional human-readable title of the tool. */
title?: string;
/** Description of what the tool does. Used by models to decide when to
* call the tool. */
description?: string;
/** JSON schema describing the tool input. Defaults to
* `{ "type": "object" }`. */
inputSchema?: Record<string, unknown>;
/** JSON schema describing the structured output of the tool. */
outputSchema?: Record<string, unknown>;
/** Optional tool annotations (e.g. `readOnlyHint`). */
annotations?: Record<string, unknown>;
}

/** **UNSTABLE**: New API, yet to be vetted.
*
* Metadata of an MCP resource, as reported by `resources/list`.
*
* @category MCP
* @experimental
*/
export interface McpResourceMetadata {
/** Resource name. Defaults to the resource URI. */
name?: string;
/** Optional human-readable title of the resource. */
title?: string;
/** Description of the resource. */
description?: string;
/** MIME type of the resource contents. */
mimeType?: string;
}

/** **UNSTABLE**: New API, yet to be vetted.
*
* Definition of an MCP prompt, as reported by `prompts/list`.
*
* @category MCP
* @experimental
*/
export interface McpPromptDefinition {
/** Optional human-readable title of the prompt. */
title?: string;
/** Description of the prompt. */
description?: string;
/** Arguments accepted by the prompt. */
arguments?: {
name: string;
description?: string;
required?: boolean;
}[];
}

/** **UNSTABLE**: New API, yet to be vetted.
*
* A Model Context Protocol (MCP) server. Register tools, resources and
* prompts, then serve them over the stdio transport with
* {@linkcode Deno.McpServer.serve}, or over the streamable HTTP transport
* by passing {@linkcode Deno.McpServer.fetch} to {@linkcode Deno.serve}.
*
* ```ts
* const server = new Deno.McpServer({
* name: "calculator",
* version: "1.0.0",
* });
*
* server.tool("add", {
* description: "Add two numbers",
* inputSchema: {
* type: "object",
* properties: { a: { type: "number" }, b: { type: "number" } },
* required: ["a", "b"],
* },
* }, ({ a, b }: { a: number; b: number }) => `${a + b}`);
*
* await server.serve();
* ```
*
* @category MCP
* @experimental
*/
export class McpServer {
constructor(options: McpServerOptions);

/** Register a tool. The handler receives the tool call arguments and may
* return a string, a JSON-serializable value (reported as structured
* content), or a full MCP `CallToolResult` object. Errors thrown by the
* handler are reported to the client as tool execution errors. */
tool(
name: string,
definition: McpToolDefinition,
// deno-lint-ignore no-explicit-any
handler: (args: any) => unknown | Promise<unknown>,
): this;
/** Register a tool without a definition. */
// deno-lint-ignore no-explicit-any
tool(
name: string,
handler: (args: any) => unknown | Promise<unknown>,
): this;

/** Register a resource. The handler may return a string, a
* `Uint8Array` (reported as a base64 blob), or a full MCP
* `ReadResourceResult` object. */
resource(
uri: string,
metadata: McpResourceMetadata,
handler: (uri: string) => unknown | Promise<unknown>,
): this;
/** Register a resource without metadata. */
resource(
uri: string,
handler: (uri: string) => unknown | Promise<unknown>,
): this;

/** Register a prompt. The handler receives the prompt arguments and may
* return a string (used as a single user message), an array of messages,
* or a full MCP `GetPromptResult` object. */
prompt(
name: string,
definition: McpPromptDefinition,
// deno-lint-ignore no-explicit-any
handler: (args: any) => unknown | Promise<unknown>,
): this;
/** Register a prompt without a definition. */
// deno-lint-ignore no-explicit-any
prompt(
name: string,
handler: (args: any) => unknown | Promise<unknown>,
): this;

/** Serve the MCP server over the stdio transport (newline-delimited
* JSON-RPC messages on stdin/stdout). Resolves when stdin is closed.
*
* Note: when using the stdio transport nothing else may write to stdout;
* use `console.error` for logging. */
serve(options?: { transport?: "stdio" }): Promise<void>;

/** Handler for the streamable HTTP transport. Pass it to
* {@linkcode Deno.serve}:
*
* ```ts
* const server = new Deno.McpServer({ name: "demo", version: "1.0.0" });
* Deno.serve(server.fetch);
* ```
*/
fetch: (request: Request) => Promise<Response>;
}

/** **UNSTABLE**: New API, yet to be vetted.
*
* A key to be persisted in a {@linkcode Deno.Kv}. A key is a sequence
Expand Down
Loading