Skip to content

Conversation

@steffen-heil-secforge
Copy link

@steffen-heil-secforge steffen-heil-secforge commented Nov 4, 2025

Summary

Implement complete multi-LSP (Language Server Protocol) infrastructure enabling simultaneous management of multiple language servers in a single session.

Three operational modes:

  • Single-MCP: Single LSP via --workspace/--lsp flags (original behavior)
  • Unbounded: Dynamic LSP start/stop via config file, all management tools available
  • Session: Pre-configured LSPs from session file, limited to lsp_list and lsp_select

Key Changes

Session Management (session.go)

  • Save/load LSP configurations to JSON session files
  • LoadSession combines session file with config defaults
  • Graceful failure handling without stopping other LSPs

Language Tools (lsp_tools.go)

  • Extended tools accept optional id parameter for LSP selection
  • Tools: lsp_start, lsp_stop, lsp_select, lsp_list, lsp_languages
  • Session tools: lsp_save, lsp_load for configuration persistence

Configuration File (config.json)

  • Define default LSP commands and arguments for each language
  • Optional per-language environment variables

Testing

  • 50+ comprehensive test cases across all three modes
  • Config validation and session file serialization
  • Auto-select behavior verified across different scenarios

Documentation (MULTI-LSP.md)

  • Usage examples for each operational mode
  • Configuration file format and field descriptions
  • Tool descriptions and parameters
  • MCP client configuration examples for Claude Desktop

…ection

Add complete multi-LSP infrastructure enabling simultaneous management of
multiple language servers in single session. Three operational modes:

- Single-MCP: Single LSP via --workspace/--lsp flags (original behavior)
- Unbounded: Dynamic LSP start/stop via config file, all tools available
- Session: Pre-configured LSPs from session file, limited tools

Key changes:

LSP Management (lsp_manager.go):
- StartLSP now accepts duringStartup parameter for deterministic selection
- Auto-select single LSP only when starting at runtime (after startup skipped)
- Auto-select cleared when selected LSP is stopped
- Support multiple instances per language via nested map structure

Configuration (config.go):
- Replace fragile composite string keys with proper nested maps
- map[string]map[string]LSPConfig (language -> workspace -> config)
- Eliminates string parsing bugs, handles colons in workspace paths

Session Management (session.go):
- Save/load LSP configurations to JSON session files
- LoadSession combines session file with config defaults
- Properly handles failures without stopping other LSPs

Language Tools (lsp_tools.go):
- Extended tools accept optional id parameter for LSP selection
- lsp_start, lsp_stop, lsp_select, lsp_list, lsp_languages
- lsp_save, lsp_load for session persistence

Configuration File (config.json):
- Define default LSP commands and arguments for each language
- Optional per-language environment variables

Testing:
- Comprehensive test coverage for all three modes
- Config validation and session file serialization
- Auto-select behavior verified across different scenarios

Documentation (MULTI-LSP.md):
- Usage examples for each mode
- Configuration file format and fields
- Tool descriptions and parameters
- MCP client configuration examples

This implementation maintains backward compatibility with single-LSP deployments
while enabling advanced multi-LSP workflows for development environments that
need simultaneous LSP instances across different languages/workspaces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant