From b22914eb2e37ae11b96f6b941eb5eda6e089ab8a Mon Sep 17 00:00:00 2001 From: Andy Adams-Moran Date: Thu, 14 Aug 2025 14:14:36 +0100 Subject: [PATCH 1/5] [clean-up] Fix pragma lint Obey the linter! --- app/Main.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index a7cecfa..7c9729f 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,8 +1,8 @@ {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RecordWildCards #-} - -- hlint is wrong; this is needed to permit this module to create +{-# LANGUAGE DisambiguateRecordFields #-} + -- This pragma is needed to permit this module to create -- values in types that share field names, such as every type - -- that has a "_meta" field; is this expected behavior? + -- that has a "_meta" field {-# OPTIONS_GHC -fno-warn-orphans #-} module Main where From fb543e4fdaecfc29c07516a7b91819e51740adf7 Mon Sep 17 00:00:00 2001 From: Andy Adams-Moran Date: Mon, 18 Aug 2025 12:18:55 +0100 Subject: [PATCH 2/5] [clean-up] Remove old test Superceded `test-mcp-servers.sh`. --- examples/test-mcp-server.sh | 62 ------------------------------------- 1 file changed, 62 deletions(-) delete mode 100755 examples/test-mcp-server.sh diff --git a/examples/test-mcp-server.sh b/examples/test-mcp-server.sh deleted file mode 100755 index f52a12c..0000000 --- a/examples/test-mcp-server.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -# Test script for MCP Haskell server -# This script sends basic MCP messages to test server functionality - -set -e - -echo "Testing MCP Haskell Server..." -echo "==============================" - -# Build the server first -echo "Building server..." -cabal build - -echo "" -echo "Testing server startup..." - -# Create a temporary file for test messages -TEST_FILE=$(mktemp) - -# Write test JSON-RPC messages (each on its own line as required by JSON-RPC) -cat > "$TEST_FILE" << 'EOF' -{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {"roots": {"listChanged": true}}, "clientInfo": {"name": "test-client", "version": "1.0.0"}}} -{"jsonrpc": "2.0", "id": 2, "method": "ping"} -{"jsonrpc": "2.0", "id": 3, "method": "resources/list"} -{"jsonrpc": "2.0", "id": 4, "method": "prompts/list"} -{"jsonrpc": "2.0", "id": 5, "method": "tools/list"} -EOF - -echo "" -echo "Sending test messages to server..." -echo "Input messages:" -cat "$TEST_FILE" - -echo "" -echo "Server responses:" -echo "==================" - -# Run the server with test input and capture output -OUTPUT=$(timeout 10s cabal run mcp < "$TEST_FILE" 2>&1) -echo "$OUTPUT" - -# Clean up -rm "$TEST_FILE" - -echo "" -echo "Test Analysis:" -echo "==============" - -# Check if we got JSON responses -if echo "$OUTPUT" | grep -q '"jsonrpc":"2.0"'; then - echo "✅ Server responded with valid JSON-RPC messages" - echo "✅ Protocol negotiation successful" - echo "✅ All test endpoints responding correctly" - echo "" - echo "🎉 MCP Haskell server is working perfectly!" - echo "You can now configure Claude Desktop to use this server." -else - echo "❌ No valid JSON-RPC responses detected" - echo "Check the output above for errors." - exit 1 -fi \ No newline at end of file From 3eec884497e00fcaa3a24cfe737fd18de5249f19 Mon Sep 17 00:00:00 2001 From: Andy Adams-Moran Date: Mon, 18 Aug 2025 12:19:42 +0100 Subject: [PATCH 3/5] [clean-up] Harmonise example configs Use `/Users/username/projects/mcp-haskell` everywhere we need to refer to the user's local copy of the project. --- examples/README.md | 5 ++++- examples/claude-desktop-config.json | 4 ++-- examples/cursor-config-examples.json | 21 --------------------- examples/cursor-config.json | 24 ++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 24 deletions(-) delete mode 100644 examples/cursor-config-examples.json create mode 100644 examples/cursor-config.json diff --git a/examples/README.md b/examples/README.md index 1260f4a..877e371 100644 --- a/examples/README.md +++ b/examples/README.md @@ -141,6 +141,7 @@ Demonstrates how to run an MCP server using HTTP transport instead of StdIO. ### Building and Running **Using Cabal (recommended):** + ```bash # From the project root cabal build mcp-http @@ -148,6 +149,7 @@ cabal run mcp-http ``` **Manual compilation:** + ```bash # From the project root ghc -package-env=. -o examples/http-server examples/http-server.hs @@ -156,6 +158,7 @@ cd examples ``` **Using cabal exec:** + ```bash cabal exec ghc -- -package-env=. -o examples/http-server examples/http-server.hs cd examples @@ -250,4 +253,4 @@ The HTTP server returns appropriate HTTP status codes: - **400 Bad Request**: Invalid JSON or malformed JSON-RPC - **500 Internal Server Error**: Server-side processing errors -JSON-RPC errors are returned within the 200 response body following the JSON-RPC 2.0 specification. \ No newline at end of file +JSON-RPC errors are returned within the 200 response body following the JSON-RPC 2.0 specification. diff --git a/examples/claude-desktop-config.json b/examples/claude-desktop-config.json index 5bef617..1b99d70 100644 --- a/examples/claude-desktop-config.json +++ b/examples/claude-desktop-config.json @@ -3,7 +3,7 @@ "haskell-mcp-development": { "command": "cabal", "args": ["run", "mcp"], - "cwd": "/absolute/path/to/mcp-haskell", + "cwd": "/Users/username/projects/mcp-haskell", "env": { "GHC_ENVIRONMENT": "-" } @@ -17,7 +17,7 @@ "haskell-mcp-stack": { "command": "stack", "args": ["exec", "mcp"], - "cwd": "/path/to/mcp-haskell", + "cwd": "/Users/username/projects/mcp-haskell", "env": {} } } diff --git a/examples/cursor-config-examples.json b/examples/cursor-config-examples.json deleted file mode 100644 index 801ca63..0000000 --- a/examples/cursor-config-examples.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "mcpServers": { - "haskell-stdio-server-dev": { - "command": "cabal", - "args": ["run", "--project-dir", "/Users/username/projects/mcp-haskell", "-v0", "mcp-stdio", "--", "--log"], - "cwd": "/Users/username/projects/mcp-haskell", - "env": { - "GHC_ENVIRONMENT": "-" - } - }, - "haskell-stdio-server-prod": { - "command": "/path/to/bin/mcp-stdio", - "args": ["--log"], - "cwd": "/path/to/system/lib/mcp", - "env": { - "MCP_TOOLS_PATH": "/path/to/system/share/mcp-tools", - "MCP_RESOURCES_PATH": "/path/to/system/lib/mcp/resources" - } - } - } -} diff --git a/examples/cursor-config.json b/examples/cursor-config.json new file mode 100644 index 0000000..b52ad15 --- /dev/null +++ b/examples/cursor-config.json @@ -0,0 +1,24 @@ +{ + "mcpServers": { + "haskell-mcp-development": { + "command": "cabal", + "args": ["run", "--project-dir", "/Users/username/projects/mcp-haskell", "-v0", "mcp-stdio", "--", "--log"], + "cwd": "/Users/username/projects/mcp-haskell", + "env": { + "GHC_ENVIRONMENT": "-" + } + }, + "haskell-mcp-production": { + "command": "/usr/local/bin/mcp-stdio", + "args": [], + "cwd": "/opt/mcp-servers", + "env": {} + }, + "haskell-mcp-stack": { + "command": "stack", + "args": ["exec", "--cwd", "/Users/username/projects/mcp-haskell", "--package", "mcp", "mcp-stdio"], + "cwd": "/Users/username/projects/mcp-haskell", + "env": {} + } + } +} From 7413a9f8711e409d824cad47fae7ce56e3163bbf Mon Sep 17 00:00:00 2001 From: Andy Adams-Moran Date: Mon, 18 Aug 2025 12:22:54 +0100 Subject: [PATCH 4/5] [clean-up] Add stdio server example to cabal Under "extra-source-files". --- mcp.cabal | 1 + 1 file changed, 1 insertion(+) diff --git a/mcp.cabal b/mcp.cabal index 3d3ae2a..f766e67 100644 --- a/mcp.cabal +++ b/mcp.cabal @@ -68,6 +68,7 @@ extra-source-files: schema.ts examples/README.md examples/http-server.hs + examples/stdio-server.hs examples/claude-desktop-config.json examples/full-config-example.json From 5323928f79cd84c2985b44186edef186cc04956e Mon Sep 17 00:00:00 2001 From: Andy Adams-Moran Date: Wed, 20 Aug 2025 17:07:18 +0100 Subject: [PATCH 5/5] [clean-up] Fix up "extra-source-files" in cabal file Under "extra-source-files": add missing files, remove incorrect files. --- mcp.cabal | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mcp.cabal b/mcp.cabal index f766e67..edf9638 100644 --- a/mcp.cabal +++ b/mcp.cabal @@ -70,7 +70,9 @@ extra-source-files: examples/http-server.hs examples/stdio-server.hs examples/claude-desktop-config.json - examples/full-config-example.json + examples/claude-desktop-full-config.json + examples/cursor-config-examples.json + examples/test-mcp-servers.sh homepage: https://github.com/Tritlo/mcp