A compact STDIO-based MCP server built in Scala 3 + ZIO + Circe, exposing arithmetic and logic tools through a clean modular architecture.
Main.scala– boots the server + assembles ZIO layers.transport/– STDIO JSON-RPC engine.router/– message decoding + handler dispatch.session/– session capabilities + initialization lifecycle.tools/– tool definitions, schemas, calculators.model/– JSON-RPC + MCP data models.config/– server config layer.util/– logging helpers.test/– ZIO test suites.
- Transport – reads/writes JSON-RPC through STDIO.
- Router – matches method names → calls the right handler.
- Tool Registry – exposes available tools + schemas to MCP.
- Tool Executor – validated args → computed result.
- Config Layer – supplies runtime configuration via ZIO.
ZIO layers stack up as:
config → tools → session → router → transport → Main.
VS Code → JSON-RPC → STDIO → Router → Tool → STDIO → VS Code.
docker run -it --rm docker.io/roussalex/almcp:latestZero Scala/JVM setup required.
CTRL+SHIFT+P→ MCP: Add Server- Pick Docker image
- Use
roussalex/almcp:latest - Optionally set
MCP_DEBUG=1
Only Copilot Agent Mode extracts arguments + invokes tools. Chat mode cannot call MCP tools.
- “List the tools” → returns all arithmetic/logic operators.
- “Add 2 and 3” → MCP infers
{a:2, b:3}and executes. - Same for subtract/multiply/divide/bitwise/comparisons.
ZIO test suites cover:
- initialization
- tool discovery
- routing
- JSON-RPC codecs
- session behavior
CI runs them automatically.
- Defaults are embedded in
ServerConfig. - Can override with ZIO layer overrides, no special setup needed.
- Agent Mode is mandatory.