Skip to content

feat(config): explicit tool routing when multiple LSP servers target the same file extension #174

Description

@eejd

Problem

When two [[lsp_servers]] entries share a language_id (or overlapping file_patterns), there is currently no way to specify which server handles which tool calls. This makes it impossible to run complementary servers side-by-side — for example:

  • pyright for navigation (get_hover, get_definition, get_references, workspace_symbol_search)
  • pylsp for lint diagnostics (get_diagnostics, get_cached_diagnostics) with pycodestyle/flake8/mypy plugins

Both servers target *.py. Today, with two entries present, it is undefined which server responds to any given tool call.

Desired behaviour

A name field on [[lsp_servers]] and a routing table (or per-server handles list) that lets users express which tools are dispatched to which server:

[[lsp_servers]]
name = "pyright"
language_id = "python"
command = "pyright-langserver"
args = ["--stdio"]
file_patterns = ["**/*.py"]
handles = ["hover", "definition", "references", "completions", "workspace_symbols"]

[[lsp_servers]]
name = "pylsp"
language_id = "python"
command = "pylsp"
args = []
file_patterns = ["**/*.py"]
handles = ["diagnostics"]

Alternatively, a [[routing]] top-level section could map tool names → server names for each language.

Use case

Navigation (pyright: full type-aware hover, cross-file definition, workspace symbols) and lint diagnostics (pylsp: pycodestyle, flake8, mypy via plugins) are genuinely complementary. pyright does not expose pycodestyle/flake8 style diagnostics; pylsp's navigation is weaker than pyright's. Being able to pair them in a single mcpls process — without one silently shadowing the other — would make the Python story meaningfully stronger.

Current workaround

Run a separate mcp-language-server (isaacphi) entry alongside mcpls just for pylsp diagnostics. This works but introduces a second bridge process and loses mcpls's single-process TOML model.

Context

  • mcpls v0.3.6, macOS arm64
  • [[lsp_servers]] TOML fields: language_id, command, args, env, file_patterns, initialization_options, timeout_seconds, heuristics — no name or routing fields currently

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions