pi-lsp-bridge

A config-driven Pi extension that connects language servers over stdio and exposes them as Pi tools

Packages

Package details

extension

Install pi-lsp-bridge from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-lsp-bridge
Package
pi-lsp-bridge
Version
2.3.0
Published
May 18, 2026
Downloads
1,590/mo · 139/wk
Author
lhufo
License
MIT
Types
extension
Size
237.8 KB
Dependencies
4 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./dist/index.js"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-lsp-bridge

A config-driven Pi extension that connects language servers over stdio and exposes them as Pi tools.

Requirements

  • Pi coding agent
  • Node.js
  • Language server binaries installed on your PATH (e.g. rust-analyzer, gopls)

Install

pi install npm:pi-lsp-bridge

Or add it to your project settings (.pi/settings.json):

pi install -l npm:pi-lsp-bridge

Configuration

Create .pi/lsp.json in your project root, or ~/.pi/agent/lsp.json for a global fallback.

{
  "servers": {
    "rust": {
      "command": "rust-analyzer",
      "extension": "rs"
    },
    "go": {
      "command": "gopls",
      "extension": "go"
    },
    "typescript": {
      "command": "typescript-language-server",
      "args": ["--stdio"],
      "extension": ["ts", "js", "tsx", "jsx"],
      "externalPatterns": ["**/node_modules/**"]
    }
  }
}

If no config is found, the extension loads but does nothing and shows a notice.

externalPatterns

Each server entry may optionally include externalPatterns, an array of glob patterns (e.g. **/node_modules/**). Results from matching files are flagged as (external) in tool output. Tools that return locations also accept an includeExternal parameter — set it to false to hide external results entirely.

Tools

The extension registers these tools when a valid config is present:

  • lsp_hover — type/docs at cursor
  • lsp_definition — go to definition
  • lsp_references — find references
  • lsp_document_symbols — file outline
  • lsp_workspace_symbol — search symbols across workspace

The LLM calls them like any other tool. Results are returned as JSON.

Reloading

Change your config and run /reload. Pi tears down the extension runtime and restarts it, which disconnects all language servers and reconnects them with the new config.

Files

  • config.ts — loads .pi/lsp.json or ~/.pi/agent/lsp.json
  • manager.ts — spawns server processes, manages connections, tracks open files
  • tools.ts — Pi tool definitions
  • index.ts — entry point, wires events