-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
43 lines (28 loc) · 1.32 KB
/
Copy pathserver.py
File metadata and controls
43 lines (28 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""Reference MCP transport for a cartridge.
A cartridge = a local MCP server exposing the slot contract as three tools. Any
MCP-capable host (Claude today; others as MCP spreads) consumes it through the tool
boundary, which hides the encoder for free -- satisfying the portability boundary rule.
Run standalone (stdio): .venv/Scripts/python.exe server.py
"""
from __future__ import annotations
from mcp.server.fastmcp import FastMCP
from stub_cartridge import StubCartridge
mcp = FastMCP("aporia-engine")
# v1: one cartridge loaded at a time (local resource constraint). Swap this line to
# load a different cartridge; lifecycle = the process itself (start=load, stop=free).
CARTRIDGE = StubCartridge()
@mcp.tool()
def describe() -> dict:
"""Identity + routing descriptor for the loaded cartridge."""
return dict(CARTRIDGE.describe())
@mcp.tool()
def assess(raw_input: str) -> dict:
"""(a) Calibration: energy = how well raw_input fits the cartridge's world.
LOW energy = fits (in-domain). HIGH energy = out-of-domain / doesn't fit."""
return dict(CARTRIDGE.assess(raw_input))
@mcp.tool()
def predict(raw_input: str, horizon: int = 1) -> dict:
"""(b) Reasoning: latent rollout. STUBBED in v1 (shape reserved)."""
return dict(CARTRIDGE.predict(raw_input, horizon))
if __name__ == "__main__":
mcp.run()