Skip to main content

routeros-lsp

A Language Server Protocol server for MikroTik RouterOS scripts (.rsc files).

It gives editors and AI coding agents immediate feedback while they write RouterOS scripts: syntax errors, unknown menus, commands and parameters, variable scope mistakes, and completion and hover from the RouterOS command list. It follows the RouterOS scripting documentation, and where the documentation is silent or a real router behaves differently, the behaviour was measured on a router and written down in docs/ambiguities.md instead of guessed.

Status: version 0.1, in development. The package is built for PyPI (routeros-lsp) by the release pipeline in .github/workflows/. Until the first release is out, install it from the repository as described below.

What it reports

Area Examples
Syntax Unterminated strings, bad escapes, unbalanced brackets, two values with no space between them, a # comment after a command (RouterOS reads it as an argument and rejects the line), a line break inside ( ), whitespace before =.
Variables :set of a variable that is not declared in scope, a local used on a later line of an imported file (where it is empty), undeclared variables, invalid names.
Menus and commands An unknown menu, command or parameter with a "did you mean", an ambiguous abbreviation, a parameter given twice, too many unnamed arguments, a missing required parameter. The menu path is tracked as RouterOS does, so relative commands after /ip address are checked in that menu.

Hover and completion use the same command list: menus and commands, parameters (required ones first), values after name=, and the variables in scope after $. There is also a symbol outline and folding. docs/features.md has the details and the limits; docs/rules.md lists every rule with its default severity.

A finding is labelled when it rests on RouterOS behaviour that the documentation does not describe, so a quirk of one version is never presented as the language specification.

Install and use

Python 3.10 or newer, no other dependencies. Once a release is on PyPI:

pipx install routeros-lsp      # or: uv tool install routeros-lsp
routeros-lsp --version

Until then, install straight from the repository:

pipx install git+https://github.com/wiresage/routeros-lsp.git

The server speaks LSP over stdio:

routeros-lsp --stdio

uvx routeros-lsp --stdio runs it without installing anything.

Claude Code

plugin/ is a Claude Code plugin that starts the server for .rsc files (language id routeros). It expects the routeros-lsp command on your PATH. Settings go into its .lsp.json; see docs/configuration.md.

Other editors

Start routeros-lsp --stdio for the language id routeros from any LSP client.

The command list

Menus, commands and parameters come from a database generated from a RouterOS 7.21.4 CHR with /console/inspect (src/routeros_lsp/data/routeros-7.21.4.json.gz). A CHR has no wireless, LTE or switch-chip packages and some parameters exist only on some hardware, so unknown-name findings are warnings by default. To cover your own hardware, generate the database from your router (nothing is executed or changed on it) and point the schema setting at it:

pip install paramiko
ROUTEROS_PASSWORD=... python tools/gen_schema.py --host 192.0.2.1 --user admin --out my-router.json.gz

Develop

python -m venv .venv && . .venv/bin/activate     # on Windows: .venv/Scripts/activate
pip install -e ".[dev]"
ruff check . && mypy && pytest

The tests need no router. Releases are cut by the pipeline in docs/releasing.md. See CONTRIBUTING.md, AGENTS.md and docs/architecture.md.

How the language was pinned down

  • docs/grammar.md: the grammar derived from the documentation, each rule tagged as documented, shown by an example, observed on a device, or open.
  • docs/ambiguities.md: every gap and conflict, with evidence from RouterOS 7.21.4 and the default used.
  • research/: the probes that produced that evidence. RouterOS can check a script without running it (/import file.rsc verbose=yes dry-run), which is the test oracle for this project; tests/conformance/ replays more than 800 recorded answers.

License

MIT

Metadata

Release files for routeros-lsp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for routeros-lsp 0.1.0
File Size Uploaded
routeros_lsp-0.1.0.tar.gz 201.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for routeros-lsp 0.1.0
File Interpreter ABI Platform
routeros_lsp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 387.9 kB

Release files / routeros_lsp-0.1.0.tar.gz

Download URL routeros_lsp-0.1.0.tar.gz
Size 201.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c429eeb59fa0c2ee628bc7df0fec0a5471f9c8f5d62e1c9444ce0501ff5f310a
BLAKE2b-256 checksum
How to use checksums
d01d23c861ef0674bc6c7eccd799374809ca52901215c0d9de89dda0a1357e4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Release files / routeros_lsp-0.1.0-py3-none-any.whl

Download URL routeros_lsp-0.1.0-py3-none-any.whl
Size 186.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f5c3a6fb41954dd70fd628c2de77d9c09a45ee8221fb947da0970b96dc20869
BLAKE2b-256 checksum
How to use checksums
6df4c04c4399ecb3d1c9b7218598136d22f85ee73dcce77cf525a4736be6cf14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.1

2 release files

0.2.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page