Principle:1Panel dev MaxKB MCP Tool Exposure
| Knowledge Sources | |
|---|---|
| Domains | MCP, API |
| Last Updated | 2026-10-10 00:00 GMT |
Overview
A protocol bridge pattern that exposes AI applications as MCP-compatible tool servers via JSON-RPC 2.0, enabling interoperability with MCP-aware clients and orchestrators.
Description
The Model Context Protocol (MCP) is an open standard for AI tool communication. MaxKB's MCP Tool Exposure pattern wraps a MaxKB application as an MCP server, exposing it as a single tool that accepts a `message` parameter. The pattern implements three JSON-RPC methods:
- initialize — Protocol handshake returning version `2025-06-18` and capabilities
- tools/list — Returns the application as a tool with input schema
- tools/call — Executes application chat and returns the text response
Authentication uses ApplicationApiKey validation. The handler decodes base64-encoded chat files and form data from headers, forwarding them to the application chat pipeline. This enables MaxKB applications to be used as tools by external MCP clients (e.g., other MaxKB apps, Claude Desktop, etc.).
Usage
Use this principle when designing:
- MCP-compatible tool servers for AI interoperability
- JSON-RPC 2.0 API endpoints
- Application-as-a-tool patterns for agent orchestration
Theoretical Basis
The MCP exposure pattern follows the JSON-RPC 2.0 protocol specification:
# Abstract algorithm description (NOT real implementation)
def handle_mcp_request(request):
method = request["method"]
params = request.get("params", {})
request_id = request["id"]
if method == "initialize":
result = {"protocolVersion": "2025-06-18", "capabilities": {"tools": {}}}
elif method == "tools/list":
result = {"tools": [{"name": f"agent_{app_id}", "inputSchema": {...}}]}
elif method == "tools/call":
message = params["arguments"]["message"]
response = application_chat(message)
result = {"content": [{"type": "text", "text": response}]}
else:
return error(code=-32601, message="Method not found")
return {"jsonrpc": "2.0", "id": request_id, "result": result}
Error codes follow the JSON-RPC 2.0 spec: `-32601` (method not found), `-32603` (internal error).