MCPcopy
hub / github.com/modelcontextprotocol/python-sdk / main

Function main

src/mcp/client/__main__.py:51–62  ·  view source on GitHub ↗
(command_or_url: str, args: list[str], env: list[tuple[str, str]])

Source from the content-addressed store, hash-verified

49
50
51async def main(command_or_url: str, args: list[str], env: list[tuple[str, str]]):
52 env_dict = dict(env)
53
54 if urlparse(command_or_url).scheme in ("http", "https"):
55 # Use SSE client for HTTP(S) URLs
56 async with sse_client(command_or_url) as streams:
57 await run_session(*streams)
58 else:
59 # Use stdio client for commands
60 server_parameters = StdioServerParameters(command=command_or_url, args=args, env=env_dict)
61 async with stdio_client(server_parameters) as streams:
62 await run_session(*streams)
63
64
65def cli():

Callers

nothing calls this directly

Calls 4

sse_clientFunction · 0.90
stdio_clientFunction · 0.90
run_sessionFunction · 0.85

Tested by

no test coverage detected