-
Notifications
You must be signed in to change notification settings - Fork 826
Open
Description
Inspector Version
- 0.16.7
Describe the bug
The inspector does not show the sampling approval popup with transport mode "http" instead of transport mode "stdio".
To Reproduce
- start an mcp server with transport streaming-http and a tool (see below) with mcpServer.server.createMessage
- run the inspector and connect via transport type streaming-http
- Run the tool
- See timeout error and no popup to approve the sampling request.
Expected behavior
There should be a sampling request like with transport mode "stdio" resulting in no timeout in mcpServer.server.createMessage.
Environment
- OS: windows
- Browser chrome
Additional context
mcpServer.registerTool(
"create-random-user",
{
title: "Create Random User Tool",
description: "Create a random user with fake data",
annotations: {
readOnlyHint: false,
destructiveHint: false,
idempotentHint: false,
openWorldHint: true
}
},
async () => {
try {
const caps = mcpServer.server.getClientCapabilities() ?? {};
console.error("Client capabilities", caps);
if (!caps.sampling) {
return {
isError: true,
content: [{ type: "text", text: "Client does not support MCP sampling." }]
};
}
const response = await mcpServer.server.createMessage({
messages: [
{
role: "user",
content: {
type: "text",
text: `Generate fake user data. The user should have a realistic name and email.
Return this data as a json object with name and email fields only. No other text so it can be used with JSON.parse.`,
},
},
],
maxTokens: 1024,
});
console.error("createMessage response", response);
//create user etc. and return content object.
Metadata
Metadata
Assignees
Labels
No labels