Skip to content

Getting Internal Server Error 500 When trying to connect to Local Server #115

@badrinathvm

Description

@badrinathvm

Hi MCP team,

I have MCP tool called weather.py which is running under the http://127.0.0.1:8000, See below screenshot

Image

I am connecting to http://127.0.0.1:8000 , However when the code is executed i am seeing the Internal error: Server error: 500

Any help is appreciated.

func connectToMCP() async {
        let client = Client(name: "weather", version: "1.0.0")
        
        // Create a streaming HTTP transport
        let transport = HTTPClientTransport(
            endpoint: URL(string: "http://127.0.0.1:8000")!,
            streaming: false  // Enable Server-Sent Events for real-time updates
        )
        
        do {
            try await client.connect(transport: transport)
      
  
            // List of available Tools
            let tools = try await client.listTools()
            print("Available tools: \(tools.tools.map { $0.name })")
        } catch let error {
            print(error.localizedDescription)
        }
    }

On inspecting the server side logs i see like below

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/Users/XXX/Documents/projects/mcp-server-basic/.venv/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXX/Documents/projects/mcp-server-basic/.venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXX/Documents/projects/mcp-server-basic/.venv/lib/python3.11/site-packages/uvicorn/middleware/asgi2.py", line 14, in __call__
    instance = self.app(scope)
               ^^^^^^^^^^^^^^^
TypeError: 'FastMCP' object is not callable
INFO:     127.0.0.1:59075 - "POST / HTTP/1.1" 500 Internal Server Error

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions