pw.xpacks.llm.mcp_server

class McpConfig(name='pathway-mcp-server', transport='streamable-http', host=None, port=None)

[source]

A configuration class for the McpServer.

class McpServable

[source]

Abstract base class for objects that can be registered with an McpServer.

Implement this class to define a component compatible with PathwayMcp.

class McpServer(config)

[source]

A server implementing MCP (Model Context Protocol).

It is encouraged to use the py:class:~pathway.xpacks.llm.mcp_server.PathwayMcp class for easier configuration.

classmethod get(config)

sourceReturns an instance of the MCP server with the given configuration.

tool(name, *, request_handler, schema, autocommit_duration_ms=50, delete_completed_queries=False, cache_strategy=None)

sourceRegisters a callable as an MCP tool.

class PathwayMcp(transport='streamable-http', host=None, port=None, name='pathway-mcp-server', serve=<factory>)

[source]

A configuration class that simplifies the definition of MCP servers with compatible servables.

  • Parameters
    • transport (Literal['streamable-http', 'stdio']) – The transport protocol used by the server. The ‘stdio’ transport is unstable and experimental. It may change or be removed in future releases. Defaults to “streamable-http”.
    • None (host The hostname or IP address to bind the server to. If) –
    • binding. (uses default) –
    • port (int | None) – The port number to bind the server to. If None, uses default port.
    • name (str) – The name of the MCP server instance. Defaults to “pathway-mcp-server”.
    • serve (list[McpServable]) – A list of McpServable objects to register with the MCP server.