OCaml SDK for Model Context Protocol using Jane Street's oxcaml_effect library
{
"mcpServers": {
"ocaml-mcp-sdk": {
"command": "<see-readme>",
"args": []
}
}
}No install config available. Check the server's README for setup instructions.
Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
OCaml SDK for Model Context Protocol using Jane Street's oxcaml_effect library
Is it safe?
No package registry to scan.
No authentication — any process on your machine can connect.
MIT. View license →
Is it maintained?
Last commit 24 days ago. 60 stars.
Will it work with my client?
Transport: stdio. Works with Claude Desktop, Cursor, Claude Code, and most MCP clients.
No automated test available for this server. Check the GitHub README for setup instructions.
No known vulnerabilities.
This server is missing a description. Tools and install config are also missing.If you've used it, help the community.
Add informationHave you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Dynamic problem-solving through sequential thought chains
A Model Context Protocol server for searching and analyzing arXiv papers
An open-source AI agent that brings the power of Gemini directly into your terminal.
The official Python SDK for Model Context Protocol servers and clients
MCP Security Weekly
Get CVE alerts and security updates for Ocaml Mcp Sdk and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
An OCaml implementation of the Model Context Protocol (MCP) using Jane Street's oxcaml_effect library for algebraic effects.
This SDK provides a complete implementation of MCP using OCaml 5's effect system through Jane Street's oxcaml_effect library, which provides:
@@ portable, @ local, @ unique, @ contended)The SDK is organized into several effect modules:
Handles low-level I/O operations:
type 'a t =
| Read : string t
| Write : string -> unit t
| Close : unit t
Manages JSON-RPC protocol:
type 'a t =
| Send_request : { method_: string; params: json option } -> json t
| Send_notification : { method_: string; params: json option } -> unit t
| Receive_message : message t
| Send_response : { id: json option; result: json option } -> unit t
| Send_error : { id: json option; code: int; message: string; data: json option } -> unit t
Implement MCP capabilities:
(* Resource operations *)
type 'a t =
| List_resources : json list t
| Read_resource : string -> json t
(* Tool operations *)
type 'a t =
| List_tools : json list t
| Call_tool : { name: string; arguments: json option } -> json t
open Ocaml_mcp_sdk
let () =
let client_info = {
Mcp_client.name = "My Client";
version = "1.0.0";
} in
Mcp_client.run_client ~client_info (fun protocol_handler server_info ->
(* List and read resources *)
let resources = Mcp_client.list_resources_client protocol_handler in
(* Call tools *)
let result = Mcp_client.call_tool_client protocol_handler
~name:"my_tool"
~arguments:(Some (`Assoc [("param", `String "value")])) in
Printf.printf "Result: %s\n" (Yojson.Safe.to_string result)
)
open Ocaml_mcp_sdk
let () =
let config = {
Mcp_server.name = "My 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
The project uses dune and requires OCaml 5.0 or later:
# Build the project
dune build
# Run examples
dune exec mcp_server_example
dune exec mcp_client_example
The SDK uses oxcaml_effect's typed handler lists to compose multiple effects:
Transport.fiber_with [Handler.List.Length.X; Handler.List.Length.X]
(fun handlers ->
match handlers with
| protocol_h :: resource_h :: _ ->
(* Use handlers here *)
| _ -> failwith "Invalid handler list"
)
The implementation leverages OCaml 5's mode system through oxcaml_effect:
@ local - Stack-allocated values@ unique - Linear/affine types@@ portable - Thread-safe values@ contended - Values that may be accessed concurrentlyEffect dispatch is O(1) using handler indices, making the system efficient even with many active effects.
MIT