Skip to content

VS Code MCP Agent: Server stuck on "Waiting for server to respond to initialize request" with FastMCP #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sandipan1 opened this issue Apr 19, 2025 · 0 comments

Comments

@sandipan1
Copy link

I am trying to use a custom FastMCP server as a backend for the VS Code MCP agent. The server starts successfully, and I can interact with it using the FastMCP Python client. However, when launched via the VS Code MCP agent (using the "servers" config in settings.json), the agent gets stuck on:

Waiting for server to respond to initialize request...

Here is the config


            "test_server": {
                "command": "/Users/sandipan/projects/AI/llm-agents/research_agent/.venv/bin/python",
                "args": [
                    "/Users/sandipan/projects/AI/llm-agents/research_agent/mcp-server-demo/simple_server.py"
                ],
                "env": { "PORT": "8800"}
            }

Here is simple_server.py

from fastmcp import FastMCP, Client
import asyncio
from typing import List
import logging
import os
mcp = FastMCP("test_server")

# mcp_with_instruction= FastMCP("DataAnalysis", instruction="This server provides data analysis tools.Call get_average() to analyse numberical data ")

print(type(mcp))
@mcp.tool()
def greet(name: str) -> str:
    return f"Hello, {name}!"

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

### Resources exposes data sources that client can read 
@mcp.resource("data://config")
def get_config() -> dict:
    """Provide configuration information"""
    return {
        "version": "1.0",
        "author": "x"
    }


if __name__ == "__main__": 
    logging.basicConfig(level=logging.INFO)
    logging.info(type(mcp))

    asyncio.run(mcp.run_sse_async(host="localhost", port=int(os.getenv("PORT", 8800)), log_level="debug"))

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant