DH

drshade/haskell-mcp-server

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

51 stars 17 forks 품질 76 트렌드 20BSD-3-Clause

drshade/haskell-mcp-server는 MCP 서버 후보가 https://github.com/drshade/haskell-mcp-server.에서 수입되었습니다

개요

drshade/haskell-mcp-server는 MCP 서버 후보가 https://github.com/drshade/haskell-mcp-server.에서 수입되었습니다

개요(AI 번역)

Model Context Protocol 서버 구축 일반 데이터 유형의 Haskell. 도구, 프롬프트 및 리소스를 수정하십시오. ADTs, 타입별 handler를 작성하고, 라이브러리는 JSON schemas를 파생합니다. 인수 decoding, validation and wire protocol for you — 그 후에 그것을 위에 봉사한다 stdio 또는 Streamable HTTP를 Claude Code, Codex, Claude Desktop, Cursor 및 기타 다른 MCP 클라이언트.

MCP 서버가 두 가지 도구를 폭발하는 완전한 작업이다, current_weather 그리고 forecast, 각 JSON schema는 생성자의 필드에서 파생.

당신은 무료로 얻을

derivation는 당신의 유형을 읽습니다, 그래서 철사에 스키마는 항상 일치합니다 인수를 받는 핸들러. 이 constructor를 호출합니다. examples/Complete:

tools/list는 정확히 돌려줍니다 (시작 예에서 캡처; a 설명없이 필드는 그 이름에 의해 설명된다) :

와 a tools/call 일치하는 인수는 완전히 핸들러에 도착 Checkout Express (Address "1 Main St" "Springfield" Nothing)를 수정했습니다. Malformed 인수는 결코 도달하지 않습니다; 적절한 라이브러리 답변 JSON-RPC 오류. 동일한 기계장치는 유형 결과를 위한 반전에서 작동합니다 (see 구조 출력).

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

원문 README의 일부입니다. 원문 보기.

mcp-server

Build Model Context Protocol servers in Haskell from plain data types. Declare your tools, prompts and resources as ADTs, write one handler per type, and the library derives the JSON schemas, argument decoding, validation and wire protocol for you — then serves it over stdio or Streamable HTTP to Claude Code, Codex, Claude Desktop, Cursor and any other MCP client.

{-# LANGUAGE OverloadedStrings, TemplateHaskell #-}

import Data.Text (Text)
import MCP.Server
import MCP.Server.Derive

data Units = Celsius | Fahrenheit

data WeatherTool
    = CurrentWeather { city :: Text, units :: Maybe Units }
    | Forecast       { city :: Text, days :: Int }

handleTool :: ClientContext -> WeatherTool -> IO Content
handleTool _ (CurrentWeather c _) = pure $ ContentText $ "Sunny in " <> c
handleTool _ (Forecast c n)       = pure $ ContentText $ "Forecast for " <> c

$(pure [])  -- end the declaration group so the splice below can see the types

main :: IO ()
main = runMcpServerStdio serverInfo noHandlers
    { tools = Just $(deriveToolHandler ''WeatherTool 'handleTool) }
  where
    serverInfo = McpServerInfo
      { serverName = "weather", serverVersion = "1.0.0"
      , serverInstructions = "Weather lookups" }

That is a complete, working MCP server exposing two tools, current_weather and forecast, each with a JSON schema derived from its constructor’s fields.

What you get for free

The derivation reads your types, so the schema on the wire always matches the handler that receives the arguments. Given this constructor from examples/Complete:

data ShippingSpeed = Standard | Express | Overnight

data Address = Address
    { street  :: Text
    , city    :: Text
    , zipCode :: Maybe Text
    }

data MyTool
    = Checkout { speed :: ShippingSpeed, shipTo :: Address }
    | ...

tools/list returns exactly this (captured from the running example; a field without a description is described by its name):

{
  "name": "checkout",
  "description": "Checkout",
  "annotations": { "destructiveHint": true },
  "inputSchema": {
    "type": "object",
    "required": ["speed", "shipTo"],
    "properties": {
      "speed":  { "type": "string", "enum": ["standard", "express", "overnight"],
                  "description": "speed" },
      "shipTo": {
        "type": "object",
        "description": "shipTo",
        "required": ["street", "city"],
        "properties": {
          "street":  { "type": "string", "description": "street" },
          "city":    { "type": "string", "description": "city" },
GitHub에서 전체 README 보기

설치

docker run -i --entrypoint=/usr/local/bin/simple-example haskell-mcp-server
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "my-server": { "type": "stdio", "command": "/path/to/my-server", "env": { "API_KEY": "${API_KEY}" } } } }