python-sdk icon indicating copy to clipboard operation
python-sdk copied to clipboard

Unable to run a minimal MCP server and testing it with mcp inspector.

Open mario-lanzillotta opened this issue 8 months ago • 0 comments

Describe the bug Unable to run a minimal MCP server and testing it with mcp inspector. I tried different url in mcp inspector same problem: http://127.0.0.1:8000/ http://127.0.0.1:8000/mcp http://127.0.0.1:8000/mcp/

=============================================

Created a minimal test server name test_server.py

#!/usr/bin/env python3 """ Minimal FastMCP test server to debug connection issues """

import sys import logging from mcp.server.fastmcp import FastMCP

Configure logging

logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger("test-server")

Create FastMCP server

app = FastMCP("Test Server")

@app.tool() def test_tool() -> str: """A simple test tool""" return "Hello from FastMCP!"

if name == "main": print("Starting FastMCP server...", file=sys.stderr) try: app.run() # Use default settings except Exception as e: print(f"Error starting server: {e}", file=sys.stderr) raise

============================================= Started it using mcp dev test_server.py DEBUG:mcp.server.lowlevel.server:Initializing server 'Test Server' DEBUG:mcp.server.lowlevel.server:Registering handler for ListToolsRequest DEBUG:mcp.server.lowlevel.server:Registering handler for CallToolRequest DEBUG:mcp.server.lowlevel.server:Registering handler for ListResourcesRequest DEBUG:mcp.server.lowlevel.server:Registering handler for ReadResourceRequest DEBUG:mcp.server.lowlevel.server:Registering handler for PromptListRequest DEBUG:mcp.server.lowlevel.server:Registering handler for GetPromptRequest DEBUG:mcp.server.lowlevel.server:Registering handler for ListResourceTemplatesRequest Starting MCP inspector... ⚙️ Proxy server listening on port 6277 🔍 MCP Inspector is up and running at http://127.0.0.1:6274 🚀 Received POST message for sessionId undefined New streamable-http connection Query parameters: [Object: null prototype] { url: 'http://127.0.0.1:8000/', transportType: 'streamable-http' } Connected to Streamable HTTP transport Connected MCP client to backing server transport Created streamable web app transport 39d882dd-0ae5-49c1-a8b2-7cd8a774b28c Error from MCP server: Error: Error POSTing to endpoint (HTTP 404): {"detail":"Not Found"} at StreamableHTTPClientTransport.send (file:///usr/local/lib/node_modules/@modelcontextprotocol/inspector/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js:265:23) at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

============================================= pip show mcp
Name: mcp Version: 1.9.2 Summary: Model Context Protocol SDK Home-page: https://modelcontextprotocol.io Author: Anthropic, PBC. Author-email: License: MIT Location: .../venv/lib/python3.12/site-packages Requires: anyio, httpx, httpx-sse, pydantic, pydantic-settings, python-multipart, sse-starlette, starlette, uvicorn Required-by:

To Reproduce

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

mario-lanzillotta avatar May 30 '25 10:05 mario-lanzillotta