Skip to content

feat: multi-session MCP-over-HTTP — one connection, N tole sessions (D3 lanjutan) #137

Description

@ajianaz

What problem does this solve?

tole's tools are currently reachable via three hosts (CLI, tole mcp stdio, tole serve REST) — but all require the client to be on the same machine. MCP Streamable HTTP would make tole reachable from any MCP client on the network, and the multi-session routing design (one MCP connection → N tole sessions) is the flexible model: the agent opens/closes/switches sessions without reconnecting.

Proposed solution

A tole serve --transport mcp mode (or tole mcp-http) that serves the session host as MCP tools over Streamable HTTP (rmcp transport-streamable-http-server):

MCP tools exposed

Tool Params What it does
tole_session_new {cwd} Open a durable tole session, return session_id
tole_session_prompt {session_id, text} Run one tole turn; returns stop_reason + final_text
tole_session_status {session_id} entries count, busy flag
tole_session_list — all active session ids
(plus the registry tools: read_file, write_file, git, etc. — routed to the session's workspace)

Design decisions

  • Multi-session routing by session_id in tool arguments (approved 2026-09-28): one MCP connection authenticates once (bearer token), then the agent addresses sessions explicitly — no hidden per-connection state
  • Sessions are durable server-side (JSONL in the session's workspace jail)
  • The tool registry is cached per session (jail = session's workspace)
  • Auth: static bearer token (same as D3 v1); TLS documented as reverse-proxy concern
  • Busy session → 409-equivalent MCP error (turn serialized per session)

Implementation

Acceptance criteria

  • MCP client connects over HTTP with bearer token, lists tools, calls tole_session_new + tole_session_prompt
  • Multiple sessions concurrently from one client
  • Durable sessions survive server restart (JSONL on disk)
  • Token auth enforced on all MCP endpoints
  • Integration test: MCP client over HTTP → full round-trip

Estimate

~1 day (rmcp server-side HTTP is well-supported; the session_host machinery is already tested).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions