2026-07-26 23:15:34 +02:00
|
|
|
"""Public contract for the mcp_server plugin.
|
|
|
|
|
|
|
|
|
|
Exposes tool definitions and schemas for other plugins.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from app.plugins.builtins.contracts import get_contract_registry
|
|
|
|
|
from app.plugins.builtins.mcp_server.schemas import (
|
2026-08-16 01:17:18 +02:00
|
|
|
McpServerConfig,
|
2026-07-26 23:15:34 +02:00
|
|
|
McpToolDefinition,
|
|
|
|
|
McpToolExecuteRequest,
|
|
|
|
|
McpToolExecuteResponse,
|
|
|
|
|
McpToolListResponse,
|
|
|
|
|
McpToolParameter,
|
2026-08-16 01:17:18 +02:00
|
|
|
)
|
|
|
|
|
from app.plugins.builtins.mcp_server.tool_definitions import (
|
|
|
|
|
TOOL_DEFINITIONS,
|
|
|
|
|
TOOL_HANDLERS,
|
|
|
|
|
get_all_tool_names,
|
|
|
|
|
get_tool_definition,
|
2026-07-26 23:15:34 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class McpServerContract:
|
|
|
|
|
"""Public API surface for the mcp_server plugin."""
|
|
|
|
|
|
|
|
|
|
contract_name = "mcp_server"
|
|
|
|
|
|
|
|
|
|
# ─── tool_definitions ───
|
|
|
|
|
ToolDefinitions = TOOL_DEFINITIONS
|
|
|
|
|
ToolHandlers = TOOL_HANDLERS
|
|
|
|
|
get_tool_definition = staticmethod(get_tool_definition)
|
|
|
|
|
get_all_tool_names = staticmethod(get_all_tool_names)
|
|
|
|
|
|
|
|
|
|
# ─── schemas ───
|
|
|
|
|
McpToolDefinition = McpToolDefinition
|
|
|
|
|
McpToolExecuteRequest = McpToolExecuteRequest
|
|
|
|
|
McpToolExecuteResponse = McpToolExecuteResponse
|
|
|
|
|
McpToolListResponse = McpToolListResponse
|
|
|
|
|
McpToolParameter = McpToolParameter
|
|
|
|
|
McpServerConfig = McpServerConfig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ─── self-registration ───
|
|
|
|
|
|
|
|
|
|
_contract = McpServerContract()
|
|
|
|
|
get_contract_registry().register("mcp_server", _contract)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__all__ = [
|
|
|
|
|
"McpServerContract",
|
|
|
|
|
"McpToolDefinition",
|
|
|
|
|
"McpToolParameter",
|
|
|
|
|
"McpServerConfig",
|
|
|
|
|
]
|