Problem auf dem Call FastMCP -Server mit dem PostmanPython

Python-Programme
Anonymous
 Problem auf dem Call FastMCP -Server mit dem Postman

Post by Anonymous »

Ich habe diesen einfachen MCP-Server: < /p>

Code: Select all

from fastmcp import FastMCP, Context

mcp = FastMCP("Demo 🚀")

@mcp.tool
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b

@mcp.tool
def hello(ctx: Context):
ctx.info("in Hello!")
return {"Respone": "Hello!"}

# Static resource
@mcp.resource("config://version")
def get_version(ctx: Context):
ctx.info("Sono in get_version!")
return "2.0.1"

if __name__ == "__main__":
mcp.run(transport='streamable-http')
< /code>
Und [url=viewtopic.php?t=14917]ich möchte[/url] es mit einem Rastanruf testen, aber wenn ich es versuche: < /p>
curl --request POST \
--url http://localhost:8000/mcp/tool/hello \
--header 'accept: application/json, text/event-stream' \
--header 'content-type: application/json' \
--header 'x-session-id: my-test-session-123' \
--data '{
"jsonrpc": "2.0",
"method": "hello",
"id": 1
}
< /code>
Ich habe diesen Fehler erhalten: < /p>
{
"jsonrpc": "2.0",
"id": "server-error",
"error": {
"code": -32600,
"message": "Bad Request: Missing session ID"
}
}
Wie kann ich es beheben?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post