Haskell Mcp Server banner
drshade drshade

Haskell Mcp Server

Development community

Description

An Awesome MCP Server Framework for Haskell

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

mcp-server

A fully-featured Haskell library for building [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) servers.

Features

  • Complete MCP Implementation: Supports MCP 2025-06-18 specification
  • Type-Safe API: Leverage Haskell's type system for robust MCP servers
  • Multiple Abstractions: Both low-level fine-grained control and high-level derived interfaces
  • Template Haskell Support: Automatic handler derivation from data types
  • Multiple Transports: STDIO and HTTP Streaming transport (MCP 2025-06-18 Streamable HTTP)

Supported MCP Features

  • Prompts: User-controlled prompt templates with arguments
  • Resources: Application-controlled readable resources
  • Tools: Model-controlled callable functions
  • Initialization Flow: Complete protocol lifecycle with version negotiation
  • Error Handling: Comprehensive error types and JSON-RPC error responses

Quick Start

Add the library `mcp-server` to your cabal file:

build-depends:
  mcp-server

Create a simple module, such as this example below:

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}

import MCP.Server
import MCP.Server.Derive

-- Define your data types
data MyPrompt = Recipe { idea :: Text } | Shopping { items :: Text }
data MyResource = Menu | Specials
data MyTool = Search { query :: Text } | Order { item :: Text }

-- Implement handlers
handlePrompt :: MyPrompt -> IO Content
handlePrompt (Recipe idea) = pure $ ContentText $ "Recipe for " <> idea
handlePrompt (Shopping items) = pure $ ContentText $ "Shopping list: " <> items

handleResource :: MyResource -> IO Content
handleResource Menu = pure $ ContentText "Today's menu..."
handleResource Specials = pure $ ContentText "Daily specials..."

handleTool :: MyTool -> IO Content
handleTool (Search query) = pure $ ContentText $ "Search results for " <> query
handleTool (Order item) = pure $ ContentText $ "Ordered " <> item

-- Derive handlers auto