Skip to content
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

MCP Client connecting to an already running MCP Server? #145

Open
sidharthrajaram opened this issue Jan 9, 2025 · 0 comments
Open

MCP Client connecting to an already running MCP Server? #145

sidharthrajaram opened this issue Jan 9, 2025 · 0 comments

Comments

@sidharthrajaram
Copy link

In the example, the MCP Client is responsible for starting the MCP server process like:

from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

# Create server parameters for stdio connection
server_params = StdioServerParameters(
    command="python", # Executable
    args=["example_server.py"], # Optional command line arguments
    env=None # Optional environment variables
)

async def run():
    async with stdio_client(server_params) as (read, write):
        async with ClientSession(read, write) as session:
            # Initialize the connection
            await session.initialize()
            ...

Let's say I have the MCP server running already (i.e. uv run example_server.py).

How can MCP clients connect to that server?

Thank you!

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