Skip to main content

run

Method
This is a method of the MCPToolRunner class in the mcp module.
Main thread function that processes MCP requests. On Windows the stdio transport must spawn a child process (e.g. npx) and talk to it over pipes. A non-main thread gets a SelectorEventLoop by default there, which does not support subprocesses and fails with an opaque fileno error during init (issue #5598). Use a dedicated ProactorEventLoop on Windows so subprocess stdio works; other platforms keep the standard asyncio.run behaviour.

Signature

Returns

Any
The result of the operation.

Uses

  • platform.system
  • asyncio.ProactorEventLoop
  • asyncio.set_event_loop
  • loop.run_until_complete
  • loop.shutdown_asyncgens
  • loop.shutdown_default_executor
  • loop.close
  • asyncio.run

Used By

Source

View on GitHub

praisonaiagents/mcp/mcp.py at line 70