[md]Scala MCP Library
A Scala 3 library for building Model Context Protocol (MCP) servers. MCP is a JSON-RPC 2.0 based protocol that allows AI applications like Claude to access tools, resources, and prompts.
Highlights
- Type-safe protocol implementation with Scala 3 enums and opaque types
- Automatic JSON Schema derivation via
derives JsonSchema - Multiple transport layers — stdio for subprocess servers, Streamable HTTP + SSE for networked servers
- Cross-platform —
core,stdio, andhttp4sall run on JVM, Scala.js, and Scala Native - Fluent builder API for servers, tools, resources, and prompts
- Effect-polymorphic, built on Cats Effect
- Zero-boilerplate codec derivation with Scala 3's
derivessyntax
Where to next
- Introduction → MCP feature support — what's implemented vs. what isn't
- Getting Started → Quick start — add the dependency and write your first tool
- Getting Started → Tools, Resources, Prompts — the core building blocks
- Getting Started → JSON schema derivation —
derives JsonSchemaand annotations - Getting Started → Server construction — Stdio + HTTP transports
- Clients —
McpClientover stdio or HTTP, plus handlers for server-initiated sampling / elicitation / roots requests - Modules — one page per module (core, stdio, http4s, openapi, redis, tapir, golden-munit, explorer)
- Tools → OpenAPI MCP Proxy — turn any OpenAPI API into an MCP server
- Testing → Golden testing — snapshot-test your server's spec
- Examples — six runnable example servers covering every transport
- Using an LLM? Point it at
llms.txtfor a structured index of every doc page, orllms-full.txtfor the entire documentation in a single file. Each page is also available as raw Markdown — swap.htmlfor.mdin any URL. Tell your assistant to start atllms.txtand follow the links rather than scraping the HTML.