hs
Haskell server/client for MCP (Model Context Protocol)
claude mcp add --transport stdio buecking-hs-mcp cabal run mcp-echo-server
How to use
MCP-Haskell (hs-mcp) provides a Haskell implementation of the Model Context Protocol (MCP), enabling Haskell applications to expose resources, tools, and prompts to MCP-compatible clients such as Claude. The server supports a StdIO transport for local process communication and uses JSON-RPC messaging under the hood to handle requests and responses. With this server, you can register resources (readable data endpoints), tools (executable capabilities with input schemas), and prompts, then run the server to accept MCP clients locally or in a test environment. The example in the repository demonstrates a simple echo server that shows how to instantiate the server, register resources and tools, and start listening via StdIO, which is ideal for development and local testing.
To use hs-mcp, start the server process in your environment and connect an MCP client (like Claude Desktop or the MCP Inspector) through the StdIO channel or the appropriate transport you choose to enable. The server provides a straightforward API for registering resources and tools and for handling read or tool-call requests. This makes it suitable for prototyping MCP-compatible interfaces in Haskell and integrating them into Haskell applications that need to expose externalizable capabilities to MCP clients.
How to install
Prerequisites:
- Haskell toolchain (GHC, Cabal) installed on your system
- Optionally Nix for a reproducible development environment as shown by the project
- Git to clone the repository
-
Clone the repository git clone github.com:buecking/hs-mcp.git cd hs-mcp
-
Set up the development environment (optional but recommended)
-
direnv integration (optional):
echo 'use flake' > .envrc
direnv allow
-
Nix development shell (optional but recommended): nix develop
-
-
Build the project cabal update cabal build
-
Run the example server (as shown in the README) to verify: cabal run mcp-echo-server
Notes:
- The repository demonstrates how to create and register resources and tools, then run the server using StdIO transport. If you prefer a different transport, you may need to adapt the run command accordingly.
Additional notes
Tips and common considerations:
- The hs-mcp server uses StdIO as its default transport for local development. This is convenient for testing with MCP Inspector or Claude Desktop.
- When registering resources, provide meaningful URIs, names, and optional descriptions and MIME types to help clients discover how to interact with them.
- Tools require a JSON schema for input; supply a reasonable schema to guide clients on how to call the tool and what inputs are expected.
- Ensure your environment has the required Haskell toolchain installed; building with cabal may pull in a number of dependencies.
- To test protocol compatibility, use the MCP Inspector or Claude Desktop to connect to the StdIO server and exercise resource reads and tool invocations.
- If you run into transport or RPC issues, verify that the server is actually listening and that the client is pointing to the correct IO channel (StdIO in development scenarios).
- The project structure includes src/Network/MCP for core types, and Examples/ for sample implementations you can adapt for your own server behavior.
Related MCP Servers
gemini-cli
An open-source AI agent that brings the power of Gemini directly into your terminal.
Dive
Dive is an open-source MCP Host Desktop Application that seamlessly integrates with any LLMs supporting function calling capabilities. ✨
pluggedin-app
The Crossroads for AI Data Exchanges. A unified, self-hostable web interface for discovering, configuring, and managing Model Context Protocol (MCP) servers—bringing together AI tools, workspaces, prompts, and logs from multiple MCP sources (Claude, Cursor, etc.) under one roof.
mcpcat-python-sdk
MCPcat is an analytics platform for MCP server owners 🐱.
zerodha
Zerodha MCP Server & Client - AI Agent (w/Agno & w/Google ADK)
pty
pty-mcp-server