refactor: route all mcp operations through runtime pool

This commit is contained in:
lda
2026-06-08 18:29:22 +07:00 Verified
parent 929103219e
commit 0a8cc4190f
14 changed files with 961 additions and 30 deletions
+2
View File
@@ -10,6 +10,7 @@ from .converters import (
)
from .protocols import (
BackendAdapter,
McpSourceOperations,
PromptRuntime,
ResourceRuntime,
StatefulMcpRuntime,
@@ -21,6 +22,7 @@ from .protocols import (
__all__ = [
"BackendAdapter",
"McpSdkAdapter",
"McpSourceOperations",
"PromptRuntime",
"ResourceRuntime",
"StatefulMcpRuntime",
+10 -3
View File
@@ -17,7 +17,9 @@ class ToolCallResult:
meta: dict[str, Any] = field(default_factory=dict)
class BackendAdapter(Protocol):
class McpSourceOperations(Protocol):
"""Full MCP operation surface shared by one-shot adapters and persistent runtimes."""
async def list_tools(
self,
connection: McpSourceConnection,
@@ -82,6 +84,10 @@ class BackendAdapter(Protocol):
) -> ToolCallResult: ...
class BackendAdapter(McpSourceOperations, Protocol):
"""One-shot or adapter-style MCP operation executor."""
class ToolRuntime(Protocol):
"""Runtime boundary for executing MCP tools from workflow nodes."""
@@ -133,8 +139,8 @@ class PromptRuntime(Protocol):
) -> dict[str, Any]: ...
class StatefulMcpRuntime(ToolRuntime, ResourceRuntime, PromptRuntime, Protocol):
"""Stateful execution/read/list boundary for configured MCP sources.
class StatefulMcpRuntime(McpSourceOperations, Protocol):
"""Persistent MCP operation executor for configured sources.
Implementations keep source session state across calls. Catalog refresh may
still use one-shot adapters by policy.
@@ -143,6 +149,7 @@ class StatefulMcpRuntime(ToolRuntime, ResourceRuntime, PromptRuntime, Protocol):
__all__ = [
"BackendAdapter",
"McpSourceOperations",
"PromptRuntime",
"ResourceRuntime",
"StatefulMcpRuntime",