Model Context Protocol in OCaml

more

Changed files
+53 -5
lib
+18
dune-project
···
(lang dune 3.17)
+
(name mcp)
+
+
(license ISC)
+
(authors "Anil Madhavapeddy")
+
(maintainers "anil@recoil.org")
+
+
(generate_opam_files true)
+
+
(package
+
(name mcp)
+
(synopsis "Model Context Protocol for LLMs")
+
(description "This is all still a work in progress")
+
(depends
+
(ocaml (>= "5.2.0"))
+
jsonrpc
+
eio_main
+
eio))
+
+4 -1
lib/dune
···
(library
(name mcp)
+
(public_name mcp)
(libraries jsonrpc unix yojson)
(modules mcp))
(library
(name mcp_sdk)
+
(public_name mcp.sdk)
(libraries mcp jsonrpc unix yojson)
(modules mcp_sdk)
(flags (:standard -w -67 -w -27 -w -32)))
(library
(name mcp_server)
+
(public_name mcp.server)
(libraries mcp_sdk jsonrpc eio_main eio)
(modules mcp_server)
-
)
+
)
+2 -4
lib/mcp.mli
···
a large dataset that the client can later reference or update. *)
type t = {
resource: [ `Text of TextResourceContents.t | `Blob of BlobResourceContents.t ];
-
(** The resource content, either as text or binary blob.
-
This polymorphic variant allows handling both text and binary resources
-
with a unified interface, while maintaining type safety. *)
+
(** The resource content, either as text or binary blob. *)
annotations: Annotated.annotation option;
(** Optional annotations for audience targeting and priority.
Annotations can restrict resource visibility to specific roles (user/assistant)
···
@param data Optional additional error data providing more context
@return A new JSON-RPC error message
*)
-
val create_error : id:RequestId.t -> code:int -> message:string -> ?data:Json.t option -> unit -> JSONRPCMessage.t
+
val create_error : id:RequestId.t -> code:int -> message:string -> ?data:Json.t option -> unit -> JSONRPCMessage.t
+29
mcp.opam
···
+
# This file is generated by dune, edit dune-project instead
+
opam-version: "2.0"
+
synopsis: "Model Context Protocol for LLMs"
+
description: "This is all still a work in progress"
+
maintainer: ["anil@recoil.org"]
+
authors: ["Anil Madhavapeddy"]
+
license: "ISC"
+
depends: [
+
"dune" {>= "3.17"}
+
"ocaml" {>= "5.2.0"}
+
"jsonrpc"
+
"eio_main"
+
"eio"
+
"odoc" {with-doc}
+
]
+
build: [
+
["dune" "subst"] {dev}
+
[
+
"dune"
+
"build"
+
"-p"
+
name
+
"-j"
+
jobs
+
"@install"
+
"@runtest" {with-test}
+
"@doc" {with-doc}
+
]
+
]