-
Notifications
You must be signed in to change notification settings - Fork 218
Open
Labels
duplicateThis issue or pull request already existsThis issue or pull request already exists
Description
In #168 I reported that the client was showing an error mcp.shared.exceptions.McpError: Cannot read properties of undefined (reading 'vendor')
when a dependency was missing.
Now, I noticed that when there is any issue I get the same error on the client but no error on the server.
This makes it very difficult to debug.
Expected result: both the MCP server and the client must show this errors that occur on the server.
On the client I use FastMCP for Pyhton.
BTW, I'm testing the server with this code:
import {
FastMCP
} from "fastmcp";
// src/simple-http-server.ts
import { z } from "zod";
var server = new FastMCP({
name: "SimpleHTTPMCP",
version: "1.0.0"
});
var AddParams = z.object({
a: z.number().describe("First number"),
b: z.number().describe("Second number")
});
server.addTool({
name: "add",
description: "Add two numbers",
parameters: AddParams,
execute: async (args) => {
const result = args.a + args.b;
return `The sum of ${args.a} and ${args.b} is ${result}`;
}
});
var CountdownParams = z.object({
seconds: z.number().min(1).max(10).describe("Number of seconds to count down from")
});
server.addTool({
name: "countdown",
description: "Count down from a given number with streaming output",
parameters: CountdownParams,
annotations: {
streamingHint: true,
readOnlyHint: true
},
execute: async (args, context) => {
const { seconds } = args;
for (let i = seconds; i >= 0; i--) {
await context.streamContent({
type: "text",
text: `Countdown: ${i}...`
});
if (i > 0) {
await new Promise((resolve) => setTimeout(resolve, 1e3));
}
}
return "Countdown complete!";
}
});
var GreetingParams = z.object({
name: z.string().describe("Name to greet"),
greeting: z.string().optional().default("Hello").describe("Greeting type")
});
server.addTool({
name: "greet",
description: "Generate a personalized greeting",
parameters: GreetingParams,
execute: async (args) => {
return `${args.greeting}, ${args.name}! Welcome to the MCP server.`;
}
});
server.addResource({
name: "Server Info",
uri: "info://server",
mimeType: "application/json",
load: async () => {
return {
text: JSON.stringify({
name: "SimpleHTTPMCP",
version: "1.0.0",
uptime: process.uptime(),
tools: ["add", "countdown", "greet"]
}, null, 2)
};
}
});
var PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3e3;
server.start({
transportType: "httpStream",
httpStream: {
port: PORT
}
});
Metadata
Metadata
Assignees
Labels
duplicateThis issue or pull request already existsThis issue or pull request already exists