bsl-context
bsl-context
Русский | English
Published on Infostart: bsl-context — проверка ИИ-кода 1С на соответствие API платформы
An MCP server providing 1C:Enterprise 8.3 platform context: types, methods, properties, constructors, system enumeration values — plus static validation of BSL expressions against a real platform index.
The data source is the platform's syntax assistant (shcntx_ru.hbk), parsed by a
custom reader (running 1C is not required).
Why
Language models and linters handle BSL syntax well but are "blind" to referential
correctness against the platform: whether a system enumeration value exists,
whether a platform type has a given method, whether a global function's argument
count fits its overloads. bsl-context covers exactly that layer — it checks code
against the actual API of a specific platform version.
Related MCP server: 1C Buddy
Features
Reference tools — search and details for platform types, methods, properties, constructors, and enumeration values.
Expression validation (validate_expression) — parses a BSL fragment and
returns findings with line, column, kind, and confidence:
Finding kind | confidence | Meaning |
| high | System enumeration value does not exist |
| high | Global function argument count outside its overloads |
| low | Platform type has no such method/property |
| low |
|
| low | Unknown global function |
high-confidence findings have a false-positive rate near zero; low-confidence ones
depend on the accuracy of type inference and the completeness of the hbk.
Validation levels
Analysis depth is set via the level parameter (or default_validation_level in
the config), clamped to [1..=3]:
1 — references with an explicit type name in the source (
Новый TypeX,TypeY.ValueZ, global function argument counts). Low noise, safe default.2 — additionally, local type inference within a procedure:
X = Новый TypeX,X = TypeY.ValueZ, the// @type TypeXannotation.3 — additionally, return-type tracking: a variable's type from the return type of a method/property, including chains like
Query.Execute().Select().
The higher the level, the more findings — and the more potential false positives.
Profiles
The profile parameter (or default_profile in the config):
full(default) — all findings,levelas passed. For a strong model that discards questionable findings itself.strict— only high-confidence findings and a forcedlevel=1. For weaker models, so a false positive does not cause a feedback loop.
Architecture
A Cargo workspace of five crates:
Crate | Purpose |
| Reads the binary |
| Parses help HTML pages (types, methods, enumerations) |
| Platform index: loading, storage, search |
| BSL expression validator (tree-sitter) |
| HTTP MCP server (axum + rmcp), config, PID lock |
Requirements
Rust (edition 2021), built with
cargo build --release.The
shcntx_ru.hbkfile from an installed 1C:Enterprise platform (C:\Program Files\1cv8\<version>\bin\shcntx_ru.hbk). Not included in the repo.
Build
cargo build --releaseThe binary is target/release/bsl-context-rs (.exe on Windows).
Configuration
Copy configs/config.toml.example to
configs/config.toml and adjust it for your machine. Key fields:
host = "127.0.0.1" # bind, loopback by default
port = 8007 # MCP server port
platform_path = 'C:\Program Files\1cv8\8.3.27.1786' # platform version directory
default_validation_level = 1Choosing the platform version when several are installed
If multiple platform versions are installed side by side, the server does not
pick a version automatically — the path is set explicitly via platform_path.
Inside that directory it looks for shcntx_ru.hbk at two paths:
<platform_path>/shcntx_ru.hbk and <platform_path>/bin/shcntx_ru.hbk.
This is deliberate: method signatures and the set of system enumerations differ
between platform versions, so code must be validated against the version it is
written for. If platform_path is unset, the server starts and /health
responds, but the MCP tools return 503 with a hint to set the path.
Network deployment
By default the server listens on loopback. With host = "0.0.0.0" you must add
the external address to allowed_hosts (rmcp's DNS-rebinding protection),
otherwise networked requests get 403 Forbidden: Host header is not allowed:
allowed_hosts = ["localhost", "127.0.0.1", "::1", "<server-ip>"]Running
bsl-context-rs --config /path/to/config.tomlHealthcheck — GET http://127.0.0.1:8007/health (no MCP handshake required).
MCP tools
Transport — Streamable HTTP at http://127.0.0.1:8007/mcp (stateless).
Tool | Purpose |
| Fuzzy search across types, global methods, properties |
| Details by exact name |
| A specific method/property of a type |
| All members of a type (methods + properties + enum values) |
| A type's constructors with signatures |
| Values of a system enumeration |
| Validate an enumeration value |
| Validate a global function's argument count |
| Validate a BSL fragment against the platform |
Connecting an MCP client
{
"mcpServers": {
"bsl-context": {
"type": "http",
"url": "http://127.0.0.1:8007/mcp"
}
}
}Changelog
See CHANGELOG.md (in Russian).
License
MIT.
This server cannot be installed
Maintenance
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Regsorm/bsl-context'
If you have feedback or need assistance with the MCP directory API, please join our Discord server