Skip to content

Add server-specific heuristics to prevent spawning servers in irrelevant projects #37

@bug-ops

Description

@bug-ops

Summary

Add minimal heuristics to prevent spawning LSP servers in projects where they're not applicable. This prevents the MCP server from exposing useless tools.

Context

Related discussion: #34 (comment)

When servers spawn outside their relevant project contexts (e.g., rust-analyzer in a Python project), they create noise and expose tools that can't be used.

Proposed Solution

Implement server-specific heuristics in spawn_batch() to check for project markers before spawning:

fn should_spawn_server(name: &str, config: &ServerConfig) -> bool {
    match name {
        "rust-analyzer" => Path::new("Cargo.toml").exists(),
        "pyright" => Path::new("pyproject.toml").exists() || Path::new("setup.py").exists(),
        _ => true // unknown servers get a chance
    }
}

Implementation Considerations

  • Check markers from workspace root
  • Graceful fallback for unknown servers (allow them)
  • Document which servers have heuristics
  • Add tests for heuristic logic

Related Issues

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