Skip to content

feat(mcp): expose streamable http tools#71

Merged
HugoSkylight merged 1 commit into
masterfrom
feat/mcp-new-chain-adapter
May 10, 2026
Merged

feat(mcp): expose streamable http tools#71
HugoSkylight merged 1 commit into
masterfrom
feat/mcp-new-chain-adapter

Conversation

@HugoSkylight

Copy link
Copy Markdown
Contributor

Summary

OpenCortex can now be used by MCP clients over the current Streamable HTTP transport. The new /mcp endpoint exposes the cleaned write and recall chain as JSON-RPC tools without reintroducing the legacy HTTP+SSE transport.

The endpoint supports initialize, ping, tools/list, and tools/call. Tool calls are backed by the existing memory/resource/session/forget/search flows, so MCP requests share the same runtime dependencies, identity context, worker side effects, and retrieval behavior as the REST API.

Details

  • Implements a non-streaming Streamable HTTP server shape: POST /mcp returns JSON-RPC JSON responses, while GET /mcp returns 405 because SSE sessions are not implemented.
  • Validates MCP transport headers before resolving runtime dependencies, requiring Content-Type: application/json and Accept: application/json, text/event-stream.
  • Exposes opencortex.search, opencortex.store_memory, opencortex.store_resource, opencortex.forget, opencortex.session_message, and opencortex.session_end with Pydantic-derived input schemas.
  • Keeps MCP protocol models and tool dispatch isolated under src/opencortex/mcp/ so the REST routes stay focused on HTTP API concerns.

Validation

  • uv run --group dev ruff format --check src/opencortex tests/opencortex
  • uv run --group dev ruff check src/opencortex tests/opencortex
  • uv run --group dev pytest -q

Compound Engineering
Codex

@HugoSkylight
HugoSkylight merged commit 2f66543 into master May 10, 2026
1 check passed
@HugoSkylight
HugoSkylight deleted the feat/mcp-new-chain-adapter branch May 10, 2026 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant