agent-lsp

A stateful LSP runtime for AI agents: warm language server sessions with 50+ tools for go-to-definition, find-references, diagnostics, rename, and more across 30+ languages.

agent-lsp

Blackwell Systems LSP 3.17 Languages CI Coverage License Agent Skills

agent-lsp makes code operations reliable for AI agents.

It is a stateful runtime over real language servers, not a bridge. It keeps the language server's semantic index warm and adds a skill layer that turns multi-step code operations into single, correct workflows.

Most MCP-LSP tools fail in practice:

  • Stateless bridges — no session, no context, no cross-file awareness
  • Raw tools — agents skip steps or use them incorrectly

The tools exist. The workflow doesn't reliably happen.

agent-lsp fixes both. The persistent session indexes your workspace once and keeps it warm. The skill layer encodes correct tool sequences so workflows actually happen.

Example: call /lsp-rename and it will validate the rename, preview all affected files, show diagnostic impact, and apply atomically. One command. No missed steps.

50 tools. 49 CI-verified end-to-end. 30 languages. Built to LSP 3.17 spec.

curl -fsSL https://raw.githubusercontent.com/blackwell-systems/agent-lsp/main/install.sh | sh
agent-lsp init

Work across all your projects in one session. Point your AI at ~/code/. One agent-lsp process routes .go to gopls, .ts to typescript-language-server, .py to pyright — no reconfiguration when you switch projects.

Skills

Raw tools get ignored. Skills get used. Each skill encodes the correct tool sequence so workflows actually happen without per-prompt orchestration instructions.

SkillPurpose
/lsp-safe-editSpeculative preview before disk write; before/after diagnostic diff; surfaces code actions on errors
/lsp-edit-exportSafe editing of exported symbols — finds all callers first
/lsp-edit-symbolEdit a named symbol without knowing its file or position
/lsp-renameprepare_rename safety gate, preview all sites, confirm, apply atomically
/lsp-verifyDiagnostics + build + tests after every edit
/lsp-simulateTest changes in-memory without touching the file
/lsp-impactBlast-radius analysis before touching a symbol or file
/lsp-dead-codeDetect zero-reference exports before cleanup
/lsp-implementFind all concrete implementations of an interface
/lsp-docsThree-tier documentation: hover → offline toolchain → source
/lsp-explore"Tell me about this symbol": hover + implementations + call hierarchy + references in one pass — for navigating unfamiliar code
/lsp-cross-repoFind all usages of a library symbol across consumer repos
/lsp-local-symbolsFile-scoped symbol list, usage search, and type info
/lsp-test-correlationFind and run only tests that cover an edited file
/lsp-format-codeFormat a file or selection via the language server formatter
cd skills && ./install.sh

Docker

# Go
docker run --rm -i -v /your/project:/workspace ghcr.io/blackwell-systems/agent-lsp:go go:gopls

# TypeScript
docker run --rm -i -v /your/project:/workspace ghcr.io/blackwell-systems/agent-lsp:typescript typescript:typescript-language-server,--stdio

# Python
docker run --rm -i -v /your/project:/workspace ghcr.io/blackwell-systems/agent-lsp:python python:pyright-langserver,--stdio

Images are also mirrored to Docker Hub (blackwellsystems/agent-lsp). See DOCKER.md for full tag list and docker-compose setup.

Installation

# curl | sh (Linux / macOS)
curl -fsSL https://raw.githubusercontent.com/blackwell-systems/agent-lsp/main/install.sh | sh

# Homebrew
brew install blackwell-systems/tap/agent-lsp

# npm
npm install -g @blackwell-systems/agent-lsp

# Go install
go install github.com/blackwell-systems/agent-lsp@latest

Quick start

agent-lsp init

Detects language servers on your PATH, asks which AI tool you use, and writes the correct MCP config. For CI or scripted use: agent-lsp init --non-interactive.

Setup

Step 1: Install language servers

Install the servers for your stack. Common ones:

LanguageServerInstall
TypeScript / JavaScripttypescript-language-servernpm i -g typescript-language-server typescript
Pythonpyright-langservernpm i -g pyright
Gogoplsgo install golang.org/x/tools/gopls@latest
Rustrust-analyzerrustup component add rust-analyzer
C / C++clangdapt install clangd / brew install llvm
Rubysolargraphgem install solargraph

Full list of 30 supported languages in docs/language-support.md.

Step 2: Add to your AI config

{
  "mcpServers": {
    "lsp": {
      "type": "stdio",
      "command": "agent-lsp",
      "args": [
        "go:gopls",
        "typescript:typescript-language-server,--stdio",
        "python:pyright-langserver,--stdio"
      ]
    }
  }
}

Each arg is language:server-binary (comma-separate server args).

Step 3: Start working

start_lsp(root_dir="/your/project")

Then use any of the 50 tools. The session stays warm; no restart needed when switching files.

Why agent-lsp

agent-lspother MCP-LSP implementations
Languages (CI-verified)30 (end-to-end integration tests)config-listed, untested
Tools503–18
Multi-server routing (one process, many languages)varies
LSP spec compliance3.17, built to specad hoc
Connection modelpersistent (warm index)per-request or cold-start
Cross-file referencesrarely
Real-time diagnostic subscriptions
Semantic token classification✗ (only one competitor)
Call hierarchy (single tool, direction param)✗ or 3 separate tools
Type hierarchy (single tool, direction param)✗ or untested
Fuzzy position fallback✗ or partial
Auto-watch (index stays fresh) (always-on, debounced)✗ (manual notify required)
Multi-root / cross-repo (add_workspace_folder)✗ or single-workspace only
Distributionsingle Go binaryNode.js or Bun runtime required

Use Cases

  • Multi-project sessions: point your AI at ~/code/, work across any project without reconfiguring
  • Polyglot development: Go backend + TypeScript frontend + Python scripts in one session
  • Large monorepos: one server handles all languages, routes by file extension
  • Code migration: refactor across repos with full cross-repo reference tracking
  • CI pipelines: validate against real language server behavior

Multi-Language Support

30 languages, CI-verified end-to-end against real language servers on every CI run. No other MCP-LSP implementation has an equivalent test matrix.

See docs/language-support.md for the full coverage matrix and per-language CI notes.

Tools

50 tools covering navigation, analysis, refactoring, speculative execution, and session lifecycle. All CI-verified.

See docs/tools.md for the full reference with parameters and examples.

Further reading

Development

git clone https://github.com/blackwell-systems/agent-lsp.git
cd agent-lsp && go build ./...
go test ./...                   # unit tests
go test ./... -tags integration # integration tests (requires language servers)

Library Usage

The pkg/lsp, pkg/session, and pkg/types packages expose a stable Go API for using agent-lsp's LSP client directly without running the MCP server.

import "github.com/blackwell-systems/agent-lsp/pkg/lsp"

client := lsp.NewLSPClient("gopls", []string{})
client.Initialize(ctx, "/path/to/workspace")
defer client.Shutdown(ctx)

locs, err := client.GetDefinition(ctx, fileURI, lsp.Position{Line: 10, Character: 4})

See docs/architecture.md for the full package API.

License

MIT

Máy chủ liên quan

NotebookLM Web Importer

Nhập trang web và video YouTube vào NotebookLM chỉ với một cú nhấp. Được tin dùng bởi hơn 200.000 người dùng.

Cài đặt tiện ích Chrome