The served server¶
octomate.mcp.server ¶
Compose gateway, history, and user-installed MCP tools under one server.
Runtimes use the same discovery and call helpers for every installed MCP.
Inkling already has gateway and history tools in process, so it mounts only
tentacles_mcp; the other runtimes mount the combined server.
history_tool ¶
tentacle_instructions ¶
Source code in octomate/mcp/server.py
octomate_instructions ¶
tentacles_mcp ¶
tentacles_mcp(
resolve_session: Callable[
[], Awaitable[OctomateSession]
],
*,
manager: McpManager,
) -> FastMCP
Serve discovery, calls, and authorization for the current user's MCPs.
Source code in octomate/mcp/server.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
octomate_mcp ¶
octomate_mcp(
resolve_session: Callable[
[], Awaitable[OctomateSession]
],
thread_manager: ThreadManager,
kick: Callable[
[NativeGatewaySignal],
Awaitable[Task[ReflexGraphResult] | None],
]
| None = None,
*,
bearers: KnownBearers | None = None,
manager: McpManager,
) -> FastMCP
Compose the gateway, history, and user-scoped MCP tools over one session resolver.
Source code in octomate/mcp/server.py
octomate.mcp.gateway ¶
The gateway as MCP: the routing spells, served to every runtime that is not Inkling.
One family on the server octomate.mcp.server composes. Its tools are typed functions whose
contracts are Inkling's own tool docstrings and whose schemas come from the same
shapes, so no two runtimes read two different tools; all that differs is the session
a call runs against, which each tool takes as a FastMCP dependency the mounting side
supplied — Depends(...) of a fixed session for a server mounted in-process for one
turn, of a per-request lookup for a server that answers over HTTP.
Refusals are spoken as the model reads them: the GatewayRefusal policy raises
becomes a ToolError carrying the same sentence, as it becomes a ModelRetry for
Inkling, so every runtime corrects from one wording.
TELEPORT_RECORDED
module-attribute
¶
TELEPORT_RECORDED = "Teleporting — this turn ends here; you continue over there, with your context intact."
NATIVE_TELEPORT_STARTED
module-attribute
¶
NATIVE_TELEPORT_STARTED = "Teleporting — this conversation continues at the destination, its history with it, in a session Octomate runs there. This session stays as it is."
spoken ¶
A spell with its refusal spoken as the model reads it: a ToolError carrying
the gateway's sentence verbatim, as ModelRetry does for Inkling. A refusal is
ordinary traffic, not a failure, and is logged as such — anything else that
escapes a spell is a real error and keeps FastMCP's own handling.
Source code in octomate/mcp/gateway.py
served_session ¶
The session a call served over HTTP runs against.
Every call speaks for the registered user its verified bearer names. A driven
turn names its conversation with CONVERSATION_HEADER, written into its
launch config by Octomate itself along with the kicker's own secret, and
resolves to the session registered while that run is in flight — a bearer
other than the kicker's is refused, so no user can drive another's turn. A
native session names its runtime with CLIENT_HEADER, written once at
install time, and gets native_session built for the bearer's user.
Identity is asserted by config and credential either way, never chosen by
the model, so a call carrying neither header is refused outright rather than
guessed at.
Source code in octomate/mcp/gateway.py
native_session
async
¶
An ephemeral gateway for one native call, never registered.
username is the verified bearer's owner, so the session speaks for that
person: anchored on a transient profile of theirs, its destinations are
their own linked accounts. The call is still attributed to a runtime, never
to a terminal session, so the session has no thread and no address — every
destination is a crossing. A static MCP config puts the tools in every
session once installed, and the bearer is the only control.
Source code in octomate/mcp/gateway.py
caller_thread ¶
The native session a call came from, where its runtime says so itself:
Codex names its thread in every call's _meta.
Source code in octomate/mcp/gateway.py
mount_gateway ¶
mount_gateway(
mcp: FastMCP,
octomate_session: OctomateSession,
thread_manager: ThreadManager,
kick: Callable[
[NativeGatewaySignal],
Awaitable[Task[ReflexGraphResult] | None],
]
| None = None,
) -> None
Register the gateway's spells on mcp.
octomate_session is the FastMCP dependency each call resolves its session
through — Depends(...) of a fixed session for a server mounted in-process for
one turn, of a per-request lookup for a server that answers over HTTP.
thread_manager is the ledger a delivering spell writes through. kick is how
a native session's teleport or scheme becomes its own turn at once, so only the
served mount — the one place a native session can arrive — needs one.
Source code in octomate/mcp/gateway.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | |
octomate.mcp.history ¶
The history tools as MCP: the thread ledger of the person a session speaks for, served beside the spells.
A family of its own on the one server, mounted under the history namespace.
Every return is text and bounded — a page of at most HISTORY_PAGE_LIMIT
messages, each clipped to HISTORY_LINE_CHARS — because these runtimes have none
of the spill bands that catch an oversized return for Inkling.
HISTORY_TOOL_NAMES
module-attribute
¶
HISTORY_TOOL_NAMES: dict[str, str] = {
"search_thread_history": "search",
"read_thread_history_before": "read_before",
"read_thread_history_after": "read_after",
}
mount_history ¶
mount_history(
mcp: FastMCP,
octomate_session: OctomateSession,
thread_manager: ThreadManager,
) -> None
Register the history tools on mcp, every call reading as the person the
session octomate_session resolves to speaks for — a driven turn's user, or the
registered person a native session's bearer named.
Source code in octomate/mcp/history.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
octomate.mcp.oauth ¶
Link the current channel profile and authorize the user's installed MCPs.
Authorization links and device codes go to the user's direct messages.
The model receives status only; device flows finish through confirm.
ProviderId
module-attribute
¶
mount_oauth ¶
Link profiles and authorize MCPs for the person driving the current turn.
Source code in octomate/mcp/oauth.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
octomate.mcp.base ¶
What every Octomate MCP server shares: the bearer verifier for scoped API tokens, and the docstring projection that keeps a spell's MCP tool and its Inkling tool identical.
KnownBearers ¶
Bases: TokenVerifier
Verify scoped API tokens through the application's auth manager.
Source code in octomate/mcp/base.py
owner
async
¶
Source code in octomate/mcp/base.py
verify_token
async
¶
capability_contract ¶
The docstring Inkling's toolset compiles, verbatim — a copy here would give two models two different tools and drift silently.
Source code in octomate/mcp/base.py
octomate.mcp.transport ¶
An httpx transport for MCP endpoints that connects only to public addresses and refuses redirects.
PublicMcpNetwork ¶
Bases: AnyIOBackend
Resolve and pin each connection to a public address, including reconnects.
Source code in octomate/mcp/transport.py
connect_tcp
async
¶
connect_tcp(
host: str,
port: int,
timeout: float | None = None,
local_address: str | None = None,
socket_options: Iterable[SOCKET_OPTION] | None = None,
) -> AsyncNetworkStream
Source code in octomate/mcp/transport.py
PublicMcpTransport ¶
Bases: AsyncHTTPTransport
Source code in octomate/mcp/transport.py
handle_async_request
async
¶
Source code in octomate/mcp/transport.py
mcp_http_client ¶
mcp_http_client(
headers: dict[str, str] | None = None,
timeout: Timeout | None = None,
auth: Auth | None = None,
follow_redirects: bool = False,
) -> httpx2.AsyncClient
Source code in octomate/mcp/transport.py
octomate.mcp.routes ¶
The HTTP API for a user's MCP installations: listing, installing, authorizing, enabling and removing them.
mcp_router
module-attribute
¶
available_tentacles
async
¶
available_tentacles(
user: Annotated[User, Depends(current_user)],
manager: Annotated[McpManager, Depends(mcp_manager)],
) -> list[McpTentacleInfo]
Source code in octomate/mcp/routes.py
list_instances
async
¶
install
async
¶
install(
body: McpInstallRequest,
user: Annotated[User, Depends(current_user)],
manager: Annotated[McpManager, Depends(mcp_manager)],
) -> Mcp
Source code in octomate/mcp/routes.py
pending_authorization
async
¶
pending_authorization(
mcp_id: UUID7,
user: Annotated[User, Depends(current_user)],
manager: Annotated[McpManager, Depends(mcp_manager)],
) -> JSONResponse
Source code in octomate/mcp/routes.py
cancel_authorization
async
¶
cancel_authorization(
mcp_id: UUID7,
user: Annotated[User, Depends(current_user)],
manager: Annotated[McpManager, Depends(mcp_manager)],
) -> None
Source code in octomate/mcp/routes.py
connect
async
¶
connect(
mcp_id: UUID7,
user: Annotated[User, Depends(current_user)],
manager: Annotated[McpManager, Depends(mcp_manager)],
flow: OAuthFlowKind | None = None,
) -> JSONResponse
Source code in octomate/mcp/routes.py
confirm
async
¶
confirm(
mcp_id: UUID7,
user: Annotated[User, Depends(current_user)],
manager: Annotated[McpManager, Depends(mcp_manager)],
) -> McpAuthorizationResult
Source code in octomate/mcp/routes.py
enable
async
¶
enable(
mcp_id: UUID7,
user: Annotated[User, Depends(current_user)],
manager: Annotated[McpManager, Depends(mcp_manager)],
) -> Mcp
Source code in octomate/mcp/routes.py
disable
async
¶
disable(
mcp_id: UUID7,
user: Annotated[User, Depends(current_user)],
manager: Annotated[McpManager, Depends(mcp_manager)],
) -> Mcp
Source code in octomate/mcp/routes.py
uninstall
async
¶
uninstall(
mcp_id: UUID7,
user: Annotated[User, Depends(current_user)],
manager: Annotated[McpManager, Depends(mcp_manager)],
) -> None