OCaml MCP SDK

v1.0.0Developer Toolsstable

OCaml SDK for Model Context Protocol using Jane Street's oxcaml_effect library

ocaml-mcp-sdkmcpai-integration
Share:
61
Stars
0
Downloads
0
Weekly
0/5

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

Create MCP servers using OCaml with Jane Street's effect system.
Build type-safe AI integrations in OCaml.
Develop MCP clients with functional programming.
bmorphism

Maintainer

LicenseMIT
Languageocaml
Versionv1.0.0
UpdatedMay 8, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx ocaml-mcp-sdk

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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)
1

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-sdk
2

Install 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 dune
3

Build the project

Compile the SDK and example binaries using dune. This builds both the mcp_server_example and mcp_client_example executables.

dune build
4

Run 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_example
5

Integrate 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 config

Prompts 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.

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.

Quick Config Preview

{ "mcpServers": { "ocaml-mcp-sdk": { "command": "npx", "args": ["-y", "ocaml-mcp-sdk"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides