
OCaml
STDIOOCaml implementation of Model Context Protocol for AI assistant integration with development tools
OCaml implementation of Model Context Protocol for AI assistant integration with development tools
Supercharge OCaml development with AI coding agents. This MCP server gives AI assistants deep integration with your OCaml projects through Dune, Merlin, and other OCaml Platform tools.
MCP is an open protocol that enables AI models to securely access local services and tools. This project provides both the core protocol implementation for OCaml and a ready-to-use development server.
This repository contains:
Protocol Libraries - Build your own MCP servers and clients in OCaml
OCaml Development Server
opam install ocaml-mcp-server
# Using stdio ocaml-mcp-server # As an HTTP server ocaml-mcp-server --socket 8080
The ocaml-mcp-server
provides comprehensive OCaml development tools:
Dune Build System Integration
dune/build-status
- Real-time build status with error reportingdune/build-target
- Build specific targets with streaming outputdune/run-tests
- Execute tests with detailed results (🚧 WIP - no tests)OCaml Code Analysis
ocaml/module-signature
- Get module signatures from compiled artifactsocaml/find-definition
- Jump to symbol definitions (🚧 WIP - no tests)ocaml/find-references
- Find all usages of a symbol (🚧 WIP - no tests)ocaml/type-at-pos
- Get type information at cursor position (🚧 WIP - no tests)ocaml/project-structure
- Analyze project layout and dependenciesocaml/eval
- Evaluate OCaml expressions in project contextFile System Tools (with OCaml superpowers)
fs/read
- Read files with automatic Merlin diagnostics for OCaml codefs/write
- Write files with automatic OCaml formattingfs/edit
- Edit files while preserving OCaml syntax validityThe server integrates with Merlin, Dune RPC, ocamlformat, and other OCaml Platform tools.
High Priority:
Feature Parity:
$/cancel
notifications, but implementing proper cancellation requires thread-safe cancellation tokens and checking cancellation status during long operationsContributions are welcome! Please feel free to submit issues and pull requests.
ocaml-mcp
is available under the ISC License.