lsprotocol
Python types for Language Server Protocol.
What it is and what it does
lsprotocol is a Python library that provides object-oriented type definitions for the Language Server Protocol (LSP), a standardized protocol used by code editors to communicate with language tools. It includes both the type classes themselves and built-in converters to serialize and deserialize LSP messages to and from JSON.
You use it by importing type classes from lsprotocol.types to construct protocol messages, and optionally using lsprotocol.converters to handle JSON serialization. It depends on attrs and cattrs for class definitions and conversion logic. The library is kept up to date with the latest version of LSP.
Use it for:
- Building a language server that needs to send and receive LSP protocol messages with type safety
- Creating an LSP client that communicates with language servers using standardized message structures
- Serializing LSP types to JSON for transmission over a network or stdio connection
- Validating protocol messages against the official LSP specification types
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Python object types and converters for the Language Server Protocol, enabling you to build LSP clients and servers with standardized message structures.
Yes. lsprotocol is actively maintained with no known vulnerabilities, carries a permissive license, and installs with minimal friction. It is the standard way to work with LSP types in Python. Install it if you are building any LSP-based tool.
Install
lsprotocol on PyPI
pip
pip install lsprotocoluv
uv add lsprotocolpoetry
poetry add lsprotocolInstalling lsprotocol
Before you install
Low friction install with only two runtime dependencies. Active maintenance with recent commits since first release in 2022.
License in practice
Permissive license allows free use, modification, and distribution with minimal restrictions.
Quickstart
python -m pip install lsprotocol
from lsprotocol import types
position = types.Position(line=10, character=3)
Verify before relying
- Whether the generated types stay synchronized with the official LSP specification across all versions
- Performance characteristics when serializing/deserializing large or deeply nested protocol messages
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — attrs, cattrs |
| Maintenance | actively maintained — 423 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,346,046/month — #3,119 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lsprotocol-2025.0.0-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
jedi-language-serverA Language Server Protocol implementation for…
permissive · top 15,000 on PyPI
jupyterlab-lspAdds Language Server Protocol (LSP) integration…
permissive · top 15,000 on PyPI
ruff-lspProvides a Language Server Protocol bridge to…
permissive · top 15,000 on PyPI
leanclientInteract with a Lean 4 language server running…
permissive · top 5,000 on PyPI
pyglspygls is a Python framework for building…
permissive · top 5,000 on PyPI
python-lsp-serverImplements the Language Server Protocol for…
permissive · top 5,000 on PyPI
python-language-serverImplements the Language Server Protocol for…
unclear · top 15,000 on PyPI
zubanZuban is a Rust-based Python language server…
agpl · top 15,000 on PyPI
python-lsp-jsonrpcImplements a JSON RPC 2.0 server for Python…
permissive · top 5,000 on PyPI
pylsp-mypyIntegrates mypy static type checking into the…
permissive · top 15,000 on PyPI