package topup

  1. Overview
  2. Docs
An OCaml toplevel exposed as an MCP server

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1.3.tar.gz
md5=e4790e3bed2adaa833c9872010695530
sha512=674b5aec1a7abb8c9b39d928498a3fe9ce65969937dc02ab559a934ec1651b1ecc4573d49ca1ed308af1a14d765366a8861045d59672115f3a54d5a03f7b41e5

doc/index.html

topup

topup is a persistent OCaml toplevel exposed as a Model Context Protocol (MCP) server. It lets an LLM keep typed working memory across conversation turns: phrases run inside a long-lived toplevel and bindings persist between eval calls, so the model carries only names and types in its context while the toplevel holds the values. The OCaml type system makes that recall sound — the compiler catches a stale or mistyped reference before evaluation.

topup is a command-line program, not a library: it installs two executables and exposes no OCaml API. Everything a client interacts with is the MCP interface described in mcp_protocol.

Installation

opam install topup

This installs two binaries:

  • topup — the bytecode driver (default); #load accepts .cma/.cmo.
  • topup-opt — the native driver (phrases compiled with ocamlopt -shared and dynamically loaded); #load accepts .cmxs.

topup requires OCaml 5.1 or newer.

Registering with an MCP client

topup speaks MCP over stdio by default. With Claude Code:

claude mcp add topup "$(command -v topup)"

or, project-scoped, drop a .mcp.json at the repository root:

{
  "mcpServers": {
    "topup": { "command": "/absolute/path/to/topup" }
  }
}

Alternatively, topup can serve a single client over a Unix domain socket, with toplevel state persisting across successive connections:

topup --socket /path/to/topup.sock

The MCP protocol

See mcp_protocol for the wire transport, the initialize / tools handshake, the full tool catalogue, and the host/session routing model that lets one registration drive local, subprocess, and remote toplevels.