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 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": {} + } + } +} 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 diff --git a/mcp.cabal b/mcp.cabal index 3d3ae2a..edf9638 100644 --- a/mcp.cabal +++ b/mcp.cabal @@ -68,8 +68,11 @@ 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 + examples/claude-desktop-full-config.json + examples/cursor-config-examples.json + examples/test-mcp-servers.sh homepage: https://github.com/Tritlo/mcp