Classes
GatewayState
6
▼
Bundled discovery results for the gateway.
GatewayState
6
▼
Bundled discovery results for the gateway.
Attributes
| Name | Type | Description |
|---|---|---|
tools |
list[dict[str, Any]]
|
— |
tool_routing |
dict[str, tuple[str, str]]
|
— |
resources |
list[dict[str, Any]]
|
— |
resource_routing |
dict[str, tuple[str, str]]
|
— |
prompts |
list[dict[str, Any]]
|
— |
prompt_routing |
dict[str, tuple[str, str]]
|
— |
_GatewayHandler
8
▼
MCPHandler implementation for the gateway (proxy to children).
_GatewayHandler
8
▼
MCPHandler implementation for the gateway (proxy to children).
Methods
initialize
1
dict[str, Any]
▼
initialize
1
dict[str, Any]
▼
def initialize(self, params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
— |
Returns
dict[str, Any]
list_tools
1
dict[str, Any]
▼
list_tools
1
dict[str, Any]
▼
def list_tools(self, params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
— |
Returns
dict[str, Any]
call_tool
1
dict[str, Any]
▼
call_tool
1
dict[str, Any]
▼
def call_tool(self, params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
— |
Returns
dict[str, Any]
list_resources
1
dict[str, Any]
▼
list_resources
1
dict[str, Any]
▼
def list_resources(self, params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
— |
Returns
dict[str, Any]
read_resource
1
dict[str, Any]
▼
read_resource
1
dict[str, Any]
▼
def read_resource(self, params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
— |
Returns
dict[str, Any]
list_prompts
1
dict[str, Any]
▼
list_prompts
1
dict[str, Any]
▼
def list_prompts(self, params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
— |
Returns
dict[str, Any]
get_prompt
1
dict[str, Any]
▼
get_prompt
1
dict[str, Any]
▼
def get_prompt(self, params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
— |
Returns
dict[str, Any]
Internal Methods 1 ▼
__init__
3
▼
__init__
3
▼
def __init__(self, clis: dict[str, dict[str, Any]], state: GatewayState, children: dict[str, ChildProcess]) -> None
Parameters
| Name | Type | Description |
|---|---|---|
clis |
— |
|
state |
— |
|
children |
— |
Functions
main
0
None
▼
Entry point for ``python -m milo.gateway``.
main
0
None
▼
def main() -> None
_print_registry
0
None
▼
Print all registered CLIs.
_print_registry
0
None
▼
def _print_registry() -> None
_print_status
0
None
▼
Print gateway status (placeholder for F7 observability).
_print_status
0
None
▼
def _print_status() -> None
_run_gateway
0
None
▼
Run the MCP gateway server with persistent child processes.
_run_gateway
0
None
▼
def _run_gateway() -> None
_idle_reaper
1
None
▼
Periodically check and kill idle children.
_idle_reaper
1
None
▼
def _idle_reaper(children: dict[str, ChildProcess]) -> None
Parameters
| Name | Type | Description |
|---|---|---|
children |
dict[str, ChildProcess] |
_discover_one_child
2
tuple[str, list[dict], l…
▼
Discover tools, resources, and prompts from a single child.
_discover_one_child
2
tuple[str, list[dict], l…
▼
def _discover_one_child(cli_name: str, child: ChildProcess) -> tuple[str, list[dict], list[dict], list[dict]]
Parameters
| Name | Type | Description |
|---|---|---|
cli_name |
str |
|
child |
ChildProcess |
Returns
tuple[str, list[dict], list[dict], list[dict]]
_discover_all
2
GatewayState
▼
Discover tools, resources, and prompts from all CLIs in parallel.
_discover_all
2
GatewayState
▼
def _discover_all(clis: dict[str, dict[str, Any]], children: dict[str, ChildProcess]) -> GatewayState
Parameters
| Name | Type | Description |
|---|---|---|
clis |
dict[str, dict[str, Any]] |
|
children |
dict[str, ChildProcess] |
Returns
GatewayState
_proxy_call
3
dict[str, Any]
▼
Proxy a tools/call to the appropriate child process.
_proxy_call
3
dict[str, Any]
▼
def _proxy_call(children: dict[str, ChildProcess], tool_routing: dict[str, tuple[str, str]], params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
children |
dict[str, ChildProcess] |
|
tool_routing |
dict[str, tuple[str, str]] |
|
params |
dict[str, Any] |
Returns
dict[str, Any]
_proxy_resource
3
dict[str, Any]
▼
Proxy a resources/read to the appropriate child process.
_proxy_resource
3
dict[str, Any]
▼
def _proxy_resource(children: dict[str, ChildProcess], resource_routing: dict[str, tuple[str, str]], params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
children |
dict[str, ChildProcess] |
|
resource_routing |
dict[str, tuple[str, str]] |
|
params |
dict[str, Any] |
Returns
dict[str, Any]
_proxy_prompt
3
dict[str, Any]
▼
Proxy a prompts/get to the appropriate child process.
_proxy_prompt
3
dict[str, Any]
▼
def _proxy_prompt(children: dict[str, ChildProcess], prompt_routing: dict[str, tuple[str, str]], params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
children |
dict[str, ChildProcess] |
|
prompt_routing |
dict[str, tuple[str, str]] |
|
params |
dict[str, Any] |
Returns
dict[str, Any]