Building OCaml MCP - what features would you want?

What excellent timing, Thibaut! @sadiq @jonludlam @ryang and I just wrote up our recent experiments in this direction as well; draft here: https://www.cl.cam.ac.uk/~avsm2/2025-ocaml-ai-draft1.pdf. Our intention with this is to just add people working in this space into this and keep it as updated as possible (probably a fool’s errand given the pace of developments), but do ping me if you’d like to join the Overleaf and add notes in.

Our own experiments started off aimed at open models that we plausibly could use alongside teaching OCaml (taught in the first year undergraduate course here at Cambridge). But since then, frontier models like Claude’s have been storming away in terms of capabilities so we’ve been using those too.

I hacked up an OCaml MCP implementation a few months ago that @mseri has been using, but I can retire that in favour of yours. In addition to the MCP tools you suggest above, we’ve been building a package embedding of the entire opam ecosystem so that you can search for relevant packages from within the assistant.

E.g. for an ocaml-jmap implementation I tried to code entirely from scratch from the RFCs, the agent (Claude Code) could scan the embeddings and come up with the following recommendations (screenshotted to avoid pasting LLM-generated text into this forum):

I’ve not yet played with fine-grained use of MCP for types. Is your ocaml-mcp-server ready to try out? It seems to hang in Claude Code in stdio mode for me after a quick attempt, but I’ll debug further…

3 Likes