MCPSERV.CLUB
TJC-LP

FastMCP-Scala

MCP Server

A Scala 3 library for building developer‑friendly MCP servers

Active(80)
15stars
2views
Updated 29 days ago

About

FastMCP-Scala is a Scala 3 library that simplifies creating Model Context Protocol (MCP) servers with ZIO, annotation‑driven APIs, macro‑generated JSON schemas, and seamless Java MCP SDK integration. It currently supports STDIO execution.

Capabilities

Resources
Access data sources
Tools
Execute functions
Prompts
Pre-built templates
Sampling
AI model interactions

FastMCP‑Scala – A Developer‑Friendly MCP Server for Scala 3

FastMCP‑Scala tackles the common pain point of wiring an AI assistant to a custom data source or computation engine: the boilerplate required to expose methods, prompts, and resources over the Model Context Protocol. By providing a lightweight, annotation‑driven API built on ZIO, it lets developers turn ordinary Scala 3 code into a fully‑featured MCP server with minimal effort. The result is a server that can be launched from the command line, integrated into Claude Desktop, or used as part of a larger AI workflow without writing any JSON schema or handler logic by hand.

The core idea is simple yet powerful: annotate functions with , , or and let FastMCP‑Scala generate the MCP contract automatically. The library uses Scala 3 macros to introspect these annotations, build JSON schemas for parameters and return types, and register handlers that ZIO can execute asynchronously. This means developers can focus on business logic while the framework handles serialization, error handling, and protocol compliance. The server also supports a clean separation between tools (stateless operations), prompts (text generation requests), and resources (data fetching or stateful endpoints) through a unified annotation model.

Key capabilities include:

  • ZIO‑based effect handling: All server operations run inside the ZIO runtime, giving you access to composable effects, fibers, and robust error management.
  • Automatic schema generation: No manual JSON definitions are needed; the macro system derives schemas from method signatures, ensuring type safety across the protocol boundary.
  • Seamless Java SDK integration: FastMCP‑Scala can interoperate with existing MCP tooling written in Java, making it easy to embed into mixed‑language ecosystems.
  • STDIO server mode: The current implementation runs over standard input/output, allowing quick experimentation and integration with local tools like Claude Desktop. Future releases plan to add streamable HTTP support.

Typical use cases span a wide range of AI‑enabled applications. For example, an enterprise might expose internal business logic (e.g., calculating discounts or retrieving customer data) as tools that Claude can invoke on demand. A research lab could turn a computational notebook into an MCP server, enabling AI assistants to run simulations or data analyses. Even simple prototypes benefit from the rapid iteration loop: define a few annotated methods, launch the server with , and immediately see it available to an AI client.

Integrating FastMCP‑Scala into an AI workflow is straightforward. Once the server is running, any MCP‑compliant client—such as Claude Desktop or a custom chatbot framework—can discover its tools, prompts, and resources via the standard MCP discovery protocol. The server’s annotations expose clear names, descriptions, and parameter metadata, making it trivial for the client to present these capabilities in a user interface or use them programmatically. Because the server is written in Scala 3, developers can leverage the full type system and modern language features while still delivering a robust, protocol‑compliant service.

In summary, FastMCP‑Scala removes the friction of building MCP servers in Scala. By combining ZIO’s effect model, macro‑driven schema generation, and an intuitive annotation API, it empowers developers to expose powerful, typed services to AI assistants with minimal boilerplate. Whether you’re prototyping a new chatbot feature or integrating complex business logic into an existing AI platform, FastMCP‑Scala provides a clean, maintainable path from Scala code to a fully‑functional MCP server.