refactor: finish MCP SDK v2 migration
This commit is contained in:
parent
a76e3a7691
commit
f94cb38b0b
1 changed files with 684 additions and 540 deletions
|
|
@ -3,11 +3,11 @@ import {
|
|||
registerAppTool,
|
||||
RESOURCE_MIME_TYPE,
|
||||
} from "@modelcontextprotocol/ext-apps/server";
|
||||
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import type {
|
||||
CallToolResult,
|
||||
ReadResourceResult,
|
||||
} from "@modelcontextprotocol/sdk/types.js";
|
||||
import {
|
||||
McpServer,
|
||||
type CallToolResult,
|
||||
type ReadResourceResult,
|
||||
} from "@modelcontextprotocol/server";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { z } from "zod";
|
||||
|
|
@ -33,7 +33,7 @@ export function createServer(): McpServer {
|
|||
{
|
||||
title: "Get Time",
|
||||
description: "Returns the current server time.",
|
||||
inputSchema: {},
|
||||
inputSchema: z.object({}),
|
||||
outputSchema: z.object({
|
||||
time: z.string(),
|
||||
}),
|
||||
|
|
@ -72,7 +72,7 @@ export function createServer(): McpServer {
|
|||
);
|
||||
|
||||
// Sample downloadable resource — used to demo ResourceLink in ui/download-file
|
||||
server.resource(
|
||||
server.registerResource(
|
||||
SAMPLE_DOWNLOAD_URI,
|
||||
SAMPLE_DOWNLOAD_URI,
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue