Use this file to discover all available pages before exploring further.
The Model Context Protocol (MCP) is an open standard for connecting AI systems to external tools and data sources. QitOS provides a built-in bridge that discovers tools on an MCP server, converts their JSON Schema into QitOS ToolSpec objects, and wraps each one in a FunctionTool — so MCP tools work just like native QitOS tools.
Each returned FunctionTool wraps a remote MCP call. When the tool is executed, QitOS sends a tools/call JSON-RPC request to the MCP server and returns the result.You can add a name prefix to disambiguate tools when bridging multiple servers into the same registry:
MCP server connections hold resources (subprocesses, HTTP clients) that must be cleaned up. Always pair connect() with cleanup():
from qitos.mcp import MCPServerStdio, mcp_server_to_function_tools, ToolFilterserver = MCPServerStdio( command="npx", args=["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],)try: await server.connect() tools = await mcp_server_to_function_tools( server, tool_filter=ToolFilter(blocked_tool_names={"dangerous_op"}), name_prefix="fs", ) # Use tools in your agent... for tool in tools: print(f"Bridged: {tool.spec.name}")finally: await server.cleanup()
MCPServerStdio.cleanup() terminates the subprocess (first SIGTERM, then SIGKILL after a 5-second timeout). MCPServerStreamableHttp.cleanup() closes the HTTP client session.For the full integration pattern with an agent, see the complete example:
from qitos import ToolRegistryfrom qitos.mcp import MCPServerStdio, mcp_server_to_function_tools, ToolFilterasync def build_registry_with_mcp(): server = MCPServerStdio( command="npx", args=["-y", "@modelcontextprotocol/server-filesystem", "/tmp"], ) await server.connect() try: mcp_tools = await mcp_server_to_function_tools( server, tool_filter=ToolFilter(allowed_tool_names={"read_file", "list_directory"}), name_prefix="fs", ) registry = ToolRegistry() for tool in mcp_tools: registry.register(tool) return registry, server except Exception: await server.cleanup() raise
Remember to call await server.cleanup() when the agent session ends.