scala-mcp

[md]CLI client (mcp-client)

modules/example-client · Stdio + HTTP · JVM

A tiny interactive REPL over any MCP server — handy for sanity-checking a server you're writing, and a worked example of using StdioMcpClient and StreamableHttpMcpClient together behind a single decline CLI.

Build and run

# Stdio: spawn a subprocess MCP server
sbt 'exampleClient/run stdio sbt exampleDiceJVM/run'

# HTTP: connect to a networked MCP server
sbt 'exampleClient/run http http://localhost:25000/mcp'

# HTTP with a bearer token
sbt 'exampleClient/run http https://my-server/mcp -H "Authorization: Bearer …"'

--no-sse disables the long-poll SSE GET if you only want plain request/response over HTTP POST.

What it shows

The whole client is ~280 lines in modules/example-client/src/main/scala/net/andimiller/mcp/examples/client/McpCliClient.scala. Main shapes worth lifting into your own code:

For a runnable agent example that drives multiple servers from a Claude-style .mcp.json, see the LLM harness.