-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Describe the bug
Trying out latest Python-SDK with FastMCP, error connecting to Claude.
To Reproduce
Steps to reproduce the behavior:
Follow the example at: https://github.com/modelcontextprotocol/python-sdk
created server.py
# server.py
from mcp.server.fastmcp import FastMCP
# Create an MCP server
mcp = FastMCP("Demo")
# Add an addition tool
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
# Add a dynamic greeting resource
@mcp.resource("greeting://{name}")
def get_greeting(name: str) -> str:
"""Get a personalized greeting"""
return f"Hello, {name}!"
@mcp.resource("config://app")
def get_config() -> str:
"""Static configuration data"""
return "App configuration here"
@mcp.resource("users://{user_id}/profile")
def get_user_profile(user_id: str) -> str:
"""Dynamic user data"""
return f"Profile data for user {user_id}"
Note: I added the two resources to the example to test resources (static) and resource_templates...
Expected behavior
It works.... (I can run in inspector with 'mcp dev server.py')
Claude Desktop connection not possible:
Screenshots
Used 'mcp install server.py' and receive error at startup of desktop client.
No messages are logged in mcp-server-Demo.log
Desktop (please complete the following information):
- OS: Monterey 12.7.6
- Browser Chrome
Additional context
Claude Congfiguration: (unchanged)
"Demo": {
"command": "uv",
"args": [
"run",
"--with",
"mcp",
"mcp",
"run",
"/Volumes/Dev12TB/fastmcp-servers-dev/fastmcp-test/server.py"
]
}
The same command, e.g. uv with arguments 'run --with mcp mcp run server.py' are used in inspector