[Python] Issue on call FastMCP Server using POSTMAN

Discussão em 'Python' iniciado por Stack, Julho 24, 2025.

  1. Stack

    Stack Membro Participativo

    I can't understand how to resolve this issue. I have this simple MCP Server:

    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')


    And I wish test it using a rest call, but when i try:
    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 }

    I got this error:

    {
    "jsonrpc": "2.0",
    "id": "server-error",
    "error": {
    "code": -32600,
    "message": "Bad Request: Missing session ID"
    }
    }


    How can I resolve it?

    Continue reading...

Compartilhe esta Página