bsl-context
MCP server that validates AI-generated 1C:Enterprise (BSL) code against the real platform API. Catches unknown enum values, wrong argument counts, and missing type members by parsing the platform syntax-helper (shcntx_ru.hbk) — independent Rust implementation with built-in expression validator.
README
bsl-context
Русский | English
<a href="https://infostart.ru/1c/articles/2698363/" title="Published on Infostart"> <img src="https://infostart.ru/bitrix/templates/sandbox_empty/assets/tpl/abo/img/logo.svg" alt="Infostart" height="32"> </a>
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.
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 |
|---|---|---|
unknown_enum_value |
high | System enumeration value does not exist |
wrong_argument_count |
high | Global function argument count outside its overloads |
unknown_type_member |
low | Platform type has no such method/property |
unknown_new_type |
low | Новый TypeX constructor unknown to the platform |
unknown_global_method |
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 |
|---|---|
hbk-reader |
Reads the binary shcntx_ru.hbk container |
hbk-parser |
Parses help HTML pages (types, methods, enumerations) |
platform-index |
Platform index: loading, storage, search |
bsl-validator |
BSL expression validator (tree-sitter) |
server |
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 --release
The 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 = 1
Choosing 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.toml
Healthcheck — 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 |
|---|---|
search |
Fuzzy search across types, global methods, properties |
info |
Details by exact name |
get_member |
A specific method/property of a type |
get_members |
All members of a type (methods + properties + enum values) |
get_constructors |
A type's constructors with signatures |
get_enum_values |
Values of a system enumeration |
validate_enum |
Validate an enumeration value |
validate_method_call |
Validate a global function's argument count |
validate_expression |
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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.