Skip to content

Can't make it work with Claude Code #2

@jdvor

Description

@jdvor

Summary

  • Installed both csharp-ls and csharp-lsp-mcp as donet tools
  • Can run them from command line with no errors and they stay open; I assume they are listening
  • I run csharp-lsp-mcp with verbose and traces on
  • Claude Code (2.1.41) never successfully calls the csharp_set_workspace; the call timeouts after 30s.
  • I have attached both the Claude Code MCP server config and the logs I was able to locate regarding the situation (again from Claude Code)

Details

Environment:

  • OS: Windows 11 Pro 10.0.26200
  • csharp-lsp-mcp: Latest version (installed via dotnet tool)
  • MCP Client: Claude Code 2.1.41
  • Configuration: MCP_DEBUG=1, --verbose flag enabled
dotnet tool update csharp-ls -g
dotnet tool update csharplspmcp -g

Configuration (.claude.json):

"csharp-lsp-mcp": {
  "type": "stdio",
  "command": "csharp-lsp-mcp",
  "args": ["--verbose"],
  "env": {
    "MCP_DEBUG": "1"
  }
}

Issue:
When calling the csharp_set_workspace tool, the MCP server hangs for exactly 30 seconds with no log output, then times out with "MCP error -32603: An error occurred."

Expected behavior:

  • Tool should execute and set workspace
  • Should see trace logs about tool execution (method handler called, parameters received, csharp-ls launch attempts, etc.)
  • Should complete in < 1 second or fail with descriptive error

Actual behavior:

  • Server initializes successfully
  • Tool call is received
  • No trace logs after tool call (despite MCP_DEBUG=1 and --verbose)
  • Hangs silently for 30 seconds
  • Times out with generic error -32603

Logs showing the issue:

2026-02-13T16:26:04.511Z [ERROR] MCP server "csharp-lsp-mcp" Server stderr: dbug: Microsoft.Extensions.Hosting.Internal.Host[1]
Hosting starting
info: ModelContextProtocol.Server.StdioServerTransport[857250842]
Server (stream) (csharp-lsp-mcp) transport reading messages.
trce: ModelContextProtocol.Server.StdioServerTransport[551200620]
Server (stream) (csharp-lsp-mcp) transport received message. Message: '{"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{"roots":{}},"clientInfo":{"name":"claude-code","version":"2.1.41"}},"jsonrpc":"2.0","id":0}'.
dbug: ModelContextProtocol.Server.StdioServerTransport[1000831420]
Server (stream) (csharp-lsp-mcp) transport received message with ID '0'.
trce: ModelContextProtocol.Server.McpServer[1361998181]
Server (csharp-lsp-mcp 1.0.0) session 5a5f09a2d4e84b599dbcef6b6c86f12b created with transport stdio
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\dev\terraverse-trading
dbug: Microsoft.Extensions.Hosting.Internal.Host[2]
Hosting started
dbug: ModelContextProtocol.Server.McpServer[330297028]
Server (csharp-lsp-mcp 1.0.0) read JsonRpcRequest message from channel.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (csharp-lsp-mcp 1.0.0) method 'initialize' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (csharp-lsp-mcp 1.0.0), Client (claude-code 2.1.41) method 'initialize' request handler completed.
trce: ModelContextProtocol.Server.McpServer[1672174748]
Server (csharp-lsp-mcp 1.0.0), Client (claude-code 2.1.41) sending message. Message: '{"result":{"protocolVersion":"2025-06-18","capabilities":{"logging":{},"tools":{"listChanged":true}},"serverInfo":{"name":"csharp-lsp-mcp","version":"1.0.0"}},"id":0,"jsonrpc":"2.0"}'.

[SERVER INITIALIZED SUCCESSFULLY AT 16:26:04.511]

2026-02-13T16:26:04.511Z [DEBUG] MCP server "csharp-lsp-mcp": Successfully connected to stdio server in 286ms
2026-02-13T16:26:04.511Z [DEBUG] MCP server "csharp-lsp-mcp": Connection established with capabilities: {"hasTools":true,"hasPrompts":false,"hasResources":false,"serverVersion":{"name":"csharp-lsp-mcp","version":"1.0.0"}}

[TOOL CALLED AT 16:26:04.511]

2026-02-13T16:26:04.511Z [DEBUG] MCP server "csharp-lsp-mcp": Calling MCP tool: csharp_set_workspace

[NO MORE LOGS FROM MCP SERVER - HANGING SILENTLY]
[UNRELATED LOGS FROM OTHER SERVICES OMITTED - SHOWING JUST ELAPSED TIME]

... 5 seconds elapsed ...
... 10 seconds elapsed ...
... 15 seconds elapsed ...
... 20 seconds elapsed ...
... 25 seconds elapsed ...
... 30 seconds elapsed ...

[TIMEOUT AT 16:26:34.534 - EXACTLY 30 SECONDS LATER]

2026-02-13T16:26:34.534Z [DEBUG] MCP server "csharp-lsp-mcp": Tool 'csharp_set_workspace' still running (30s elapsed)
2026-02-13T16:26:34.833Z [DEBUG] MCP server "csharp-lsp-mcp": Tool 'csharp_set_workspace' failed after 30s: MCP error -32603: An error occurred.

Key observations:

  1. ✅ Server starts and initializes successfully
  2. ✅ Session created, capabilities exchanged
  3. ❌ After tool call, zero log output from tool handler
  4. ❌ Should see "method 'tools/call' request handler called" - but don't
  5. ❌ Should see trace logs about launching csharp-ls - but don't
  6. ❌ Hangs for exactly 30 seconds (likely client timeout)
  7. ❌ Generic error -32603 with no details

Reproduction:

  1. Configure csharp-lsp-mcp in Claude Code with --verbose and MCP_DEBUG=1
  2. Call csharp_set_workspace with path parameter
  3. Observe 30-second hang with no logs
  4. Receive timeout error

Tool call parameters:

{
  "name": "csharp_set_workspace",
  "arguments": {
    "path": "C:\\dev\\terraverse-trading"
  }
}

Additional context:

  • csharp-ls is installed and available in PATH
  • Directory exists and is a valid C# workspace with .sln file
  • Same issue occurs on multiple calls
  • Killing and restarting MCP server doesn't help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions