agent-lsp

agent-lsp

MCP server that keeps language server sessions warm and routes multiple languages through one process. Agents get persistent cross-file awareness, speculative execution (simulate edits before writing to disk), and 20 skills that encode correct multi-step operations like safe rename, blast-radius analysis, and end-to-end refactoring. Single Go binary, no runtime dependencies.

Category
访问服务器

README

agent-lsp

Blackwell Systems LSP 3.17 Languages CI Coverage License Agent Skills

The most complete MCP server for language intelligence. 50 tools, 30 CI-verified languages, 20 agent workflows. Single Go binary.

AI agents make incorrect code changes because they can't see the full picture: who calls this function, what breaks if I rename it, does the build still pass. Language servers have the answers, but existing MCP bridges either cold-start on every request or expose raw tools that agents use incorrectly.

agent-lsp is a stateful runtime over real language servers. It indexes your workspace once, keeps the index warm, and adds a skill layer that encodes correct multi-step operations so they actually complete.

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

How it works

One agent-lsp process manages your language servers. Point your AI at ~/code/. It routes .go to gopls, .ts to typescript-language-server, .py to pyright. No reconfiguration when you switch projects. The session stays warm across files, packages, and repositories.

Tested, not assumed

Every other MCP-LSP implementation lists supported languages in a config file. None of them run the actual language server in CI to verify it works.

agent-lsp CI runs 30 real language servers against real fixture codebases on every push: Go, Python, TypeScript, Rust, Java, C, C++, C#, Ruby, PHP, Kotlin, Swift, Scala, Zig, Lua, Elixir, Gleam, Clojure, Dart, Terraform, Nix, Prisma, SQL, MongoDB, and more. When we say "works with gopls," that's a verified, automated claim, not a hope.

Speculative execution

Simulate changes in memory before writing to disk. No other MCP-LSP implementation has this.

simulate_edit_atomic previews the diagnostic impact of any edit. You see exactly what breaks before the file is touched. simulate_chain evaluates a sequence of dependent edits (rename a function, update all callers, change the return type) and reports which step first introduces an error.

8 speculative execution tools: create_simulation_session, simulate_edit, simulate_chain, evaluate_session, commit_session, discard_session, destroy_session, simulate_edit_atomic.

See docs/speculative-execution.md for the full workflow.

Works with

AI Tool Transport Config
Claude Code stdio mcpServers in .mcp.json
Continue stdio mcpServers in config.json
Cline stdio mcpServers in settings
Cursor stdio mcpServers in settings
Any MCP client HTTP+SSE --http --port 8080 with Bearer token auth

Skills

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

See docs/skills.md for full descriptions and usage guidance.

Before you change anything

Skill Purpose
/lsp-impact Blast-radius analysis before touching a symbol or file
/lsp-implement Find all concrete implementations of an interface
/lsp-dead-code Detect zero-reference exports before cleanup

Editing safely

Skill Purpose
/lsp-safe-edit Speculative preview before disk write; before/after diagnostic diff; surfaces code actions on errors
/lsp-simulate Test changes in-memory without touching the file
/lsp-edit-symbol Edit a named symbol without knowing its file or position
/lsp-edit-export Safe editing of exported symbols, finds all callers first
/lsp-rename prepare_rename safety gate, preview all sites, confirm, apply atomically

Understanding unfamiliar code

Skill Purpose
/lsp-explore "Tell me about this symbol": hover + implementations + call hierarchy + references in one pass
/lsp-understand Deep-dive Code Map for a symbol or file: type info, call hierarchy, references, source
/lsp-docs Three-tier documentation: hover → offline toolchain → source
/lsp-cross-repo Find all usages of a library symbol across consumer repos
/lsp-local-symbols File-scoped symbol list, usage search, and type info

After editing

Skill Purpose
/lsp-verify Diagnostics + build + tests after every edit
/lsp-fix-all Apply quick-fix code actions for all diagnostics in a file
/lsp-test-correlation Find and run only tests that cover an edited file
/lsp-format-code Format a file or selection via the language server formatter

Generating code

Skill Purpose
/lsp-generate Trigger server-side code generation (interface stubs, test skeletons, mocks)
/lsp-extract-function Extract a code block into a named function via code actions

Full workflow

Skill Purpose
/lsp-refactor End-to-end refactor: blast-radius → preview → apply → verify → test
cd skills && ./install.sh

Docker

Stdio mode (MCP client spawns the container directly):

# 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

HTTP mode (persistent service, remote clients connect over HTTP+SSE):

docker run --rm \
  -p 8080:8080 \
  -v /your/project:/workspace \
  -e AGENT_LSP_TOKEN=your-secret-token \
  ghcr.io/blackwell-systems/agent-lsp:go \
  --http --port 8080 go:gopls

Images run as a non-root user (uid 65532) by default. Set AGENT_LSP_TOKEN via environment variable, never --token on the command line. Images are also mirrored to Docker Hub (blackwellsystems/agent-lsp). See DOCKER.md for the full tag list, HTTP mode setup, and security hardening options.

Installation

macOS / Linux

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

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

Windows

# PowerShell (no admin required)
iwr -useb https://raw.githubusercontent.com/blackwell-systems/agent-lsp/main/install.ps1 | iex

# Scoop
scoop bucket add blackwell-systems https://github.com/blackwell-systems/agent-lsp
scoop install blackwell-systems/agent-lsp

# Winget
winget install BlackwellSystems.agent-lsp

All platforms

# 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:

Language Server Install
TypeScript / JavaScript typescript-language-server npm i -g typescript-language-server typescript
Python pyright-langserver npm i -g pyright
Go gopls go install golang.org/x/tools/gopls@latest
Rust rust-analyzer rustup component add rust-analyzer
C / C++ clangd apt install clangd / brew install llvm
Ruby solargraph gem 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-lsp next best competitor
Tools 50 39
Languages (CI-verified) 30 (end-to-end integration tests) 0 (config-listed, untested)
Agent workflows (skills) 20 0 (in MCP space)
Speculative execution 8 tools (simulate before writing) none
Connection model persistent (warm index) per-request or cold-start
Call hierarchy ✓ (single tool, direction param) split across 3 tools or absent
Type hierarchy ✓ (CI-verified) untested or absent
Cross-repo references ✓ (multi-root workspace) single-workspace only
Auto-watch ✓ (always-on, debounced) manual notify required
HTTP+SSE transport ✓ (bearer token auth, non-root Docker) experimental or absent
Distribution single Go binary (8 channels) Node.js/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
  • Niche language stacks: Gleam, Elixir, Prisma, Zig, Clojure, Nix, Dart, Scala, MongoDB, all CI-verified

Multi-Language Support

30 languages, CI-verified end-to-end against real language servers on every CI run. No other MCP-LSP implementation tests a single language in CI.

Go, Python, TypeScript, Rust, Java, C, C++, C#, Ruby, PHP, Kotlin, Swift, Scala, Zig, Lua, Elixir, Gleam, Clojure, Dart, Terraform, Nix, Prisma, SQL, MongoDB, JavaScript, YAML, JSON, Dockerfile, CSS, HTML.

See docs/language-support.md for the full coverage matrix.

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选