Skip to main content
The MCP Server gives any MCP-compatible agent (Claude Code, Codex, etc.) access to contexts stored in the Context API — whether ingested automatically via the CLI or created programmatically via the SDKs and REST API. Ask Claude Code what Codex did last, filter sessions by project, machine, or time range.

Prerequisites

  • Node.js >= 22
  • A Context API key configured in ~/.ultracontext/config.json (set up by ultracontext config)
  • CLI running to ingest sessions (see CLI)

Setup

Claude Code

bash

Codex

Add to ~/.codex/config.toml:
TOML
The MCP server reads your API key from ~/.ultracontext/config.json automatically — the same config file used by the CLI.

Tools

The MCP server exposes three tools:

list_contexts

List recent agent contexts with optional filters.

get_context_messages

Retrieve all messages from a specific context.

get_recent_activity

Shortcut for “what happened last?” — fetches the latest context and returns its most recent messages.

Examples

Once set up, you can ask your agent natural language questions:
  • “What did Codex do last?”
  • “Show me Claude Code sessions in /Users/alice/Code/myapp”
  • “What happened on my Mac mini today?”
  • “List all sessions from the last 24 hours”

Remote mode (HTTP)

The Context API has a built-in MCP endpoint at /mcp. Any MCP-compatible client that supports Streamable HTTP can connect directly — no separate server needed.
bash
Self-hosted APIs include the MCP endpoint automatically. The same Bearer token used for the REST API authenticates MCP requests.

Standalone HTTP server

For cases where you need a dedicated MCP server (e.g. running on a different port or machine), you can run the standalone HTTP transport:
bash
This starts an HTTP server on port 3100 (configurable via MCP_PORT) with the MCP endpoint at /mcp and a health check at /health.

CLI

Set up automatic session ingestion.

API Reference

Full Context API documentation.