OCaml MCP SDK
OCaml SDK for Model Context Protocol using Jane Street's oxcaml_effect library
What is OCaml MCP SDK?
OCaml MCP SDK is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to ocaml sdk for model context protocol using jane street's oxcaml_effect library
OCaml SDK for Model Context Protocol using Jane Street's oxcaml_effect library
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- OCaml SDK for Model Context Protocol using Jane Street's oxc
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx ocaml-mcp-sdkConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use OCaml MCP SDK
The OCaml MCP SDK is a complete implementation of the Model Context Protocol for the OCaml programming language, built using Jane Street's oxcaml_effect library for algebraic effects. It provides a typed, effect-based architecture for building both MCP servers and MCP clients in OCaml, with O(1) effect dispatch via handler indices, GADT-typed handler lists, and OCaml 5 mode annotations for safe concurrent programming. OCaml developers use this SDK to write type-safe AI integrations and custom MCP servers that expose resources, tools, and prompts using functional programming idioms rather than callback-based or async frameworks.
Prerequisites
- OCaml 5.0 or later (required for the effects system)
- dune 3.16 or higher as the build system
- opam package manager to install dependencies
- yojson library for JSON handling (installed via opam)
- Jane Street's oxcaml_effect library (vendored in the repository)
Clone the repository
Clone the ocaml-mcp-sdk repository to get the source code, including the vendored oxcaml_effect library from Jane Street's with-extensions branch.
git clone https://github.com/bmorphism/ocaml-mcp-sdk.git
cd ocaml-mcp-sdkInstall dependencies via opam
Install the required opam packages. The oxcaml_effect library is vendored, but yojson and unix are needed from opam.
opam install yojson duneBuild the project
Compile the SDK and example binaries using dune. This builds both the mcp_server_example and mcp_client_example executables.
dune buildRun the example server
Execute the bundled MCP server example to verify the build works. The server listens on stdio and responds to MCP JSON-RPC messages.
dune exec mcp_server_exampleIntegrate the SDK into your own project
Add ocaml_mcp_sdk as a library dependency in your dune project file and use the Mcp_server or Mcp_client modules to build your own server or client. Define resources as (uri, handler) pairs and tools as (name, handler) pairs in the server config.
OCaml MCP SDK Examples
Minimal MCP server in OCaml
A complete OCaml MCP server that exposes one resource and one tool, using the SDK's Mcp_server.run_server function:
open Ocaml_mcp_sdk
let () =
let config = {
Mcp_server.name = "My OCaml Server";
version = "1.0.0";
resources = [
("file:///data.json", fun () ->
`Assoc [("data", `String "Hello from OCaml")]
);
];
tools = [
("echo", fun args ->
match args with
| Some (`Assoc params) ->
`Assoc [("echoed", List.assoc "message" params)]
| _ -> `Assoc [("error", `String "Invalid arguments")]
);
];
prompts = [];
} in
Mcp_server.run_server configPrompts to try
Example tasks you can accomplish by building and running a custom MCP server with the OCaml SDK:
- "List all MCP resources exposed by the OCaml server"
- "Call the echo tool with the message parameter set to 'Hello, World!'"
- "Build a server that reads OCaml source files and returns their module signatures"
- "Expose a tool that compiles an OCaml snippet and returns compiler output"
- "Create an MCP client in OCaml that connects to an external MCP server and calls its tools"Troubleshooting OCaml MCP SDK
Build fails with 'Effects not supported' or 'requires OCaml 5'
The oxcaml_effect library requires OCaml 5.0 or later. Run 'ocaml --version' to check. Install OCaml 5 via opam: 'opam switch create 5.0.0' and then 'eval $(opam env)'.
dune build fails with missing oxcaml_effect library
The oxcaml_effect library should be vendored in the repository under a vendor/ directory. Ensure you cloned the full repository (not a shallow clone) and that the submodule is initialized: 'git submodule update --init --recursive'.
MCP client or server hangs on stdio with no output
The SDK communicates over stdio using JSON-RPC. When running the server manually, input must be valid JSON-RPC messages. Use 'dune exec mcp_client_example' to test the client-server pair together, or connect via an MCP Inspector that handles the protocol framing.
Frequently Asked Questions about OCaml MCP SDK
What is OCaml MCP SDK?
OCaml MCP SDK is a Model Context Protocol (MCP) server that ocaml sdk for model context protocol using jane street's oxcaml_effect library It connects AI assistants to external tools and data sources through a standardized interface.
How do I install OCaml MCP SDK?
Follow the installation instructions on the OCaml MCP SDK GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with OCaml MCP SDK?
OCaml MCP SDK works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is OCaml MCP SDK free to use?
Yes, OCaml MCP SDK is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
OCaml MCP SDK Alternatives — Similar Developer Tools Servers
Looking for alternatives to OCaml MCP SDK? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up OCaml MCP SDK in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use OCaml MCP SDK?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.