Content
1c-context
[](https://modelcontextprotocol.io)
[](kotlinlang.org)
[](https://spring.io/projects/spring-boot)
[](LICENSE)
[](https://github.com/phill752/1c-bsp-context/actions/workflows/build.yml)
MCP server providing AI agents with ** and verifiable** reference to the API of [Standard Subsystem Libraries (BSP) 1C:Enterprise 8.3](https://its.1c.ru/db/bspdoc).
The server parses the BSP configuration export in EDT format (XML) and indexes all common modules (procedures, functions, parameters, descriptions, subsystem bindings), and then responds to model queries through **6 MCP tools**.
## Architecture
```
LLM (ChatGPT, Claude, Cascade, Kilo Code)
│
MCP-client (SSE / stdio)
│
1c-bsp-context (Kotlin + Spring AI)
│
-export of BSP (CommonModules/ + Subsystems/)
```
On startup, the server indexes ~800 modules and ~20,000 procedures in memory in < 2 seconds. Each query returns precise data from the with file and line number.
## Key Features
- **Precise search** — by procedure name, module, substring, subsystem
Structured docblock** — parameters with types, return value, examples, warnings
- **Verifiable** — each fact is accompanied by path and line number (`sourcePath:startLine`)
- **Raw docblock** — original comment text in a collapsed `<details>` block for verification
- **Compact mode** — description + parameters + signature without source code (saves ~80% tokens)
- **Explicit absence of data** — `_no description_` instead of empty fields, so the model doesn't make assumptions
- **APK filtering** — service marks `APK:*` are excluded from description but preserved in raw doc- **In-memory index** — ~800 modules / ~20,000 procedures in < 2 seconds
## Tech Stack
- **Kotlin 2.1** + **Spring Boot 3.5** + **Spring AI 1.0.0**
- **Jackson XML** (dataformat-xml) for parsing EDT metadata
- **Gradle 8.5** (Kotlin DSL)
- **Java 17** (eurin)
- Transports: **SSE** (HTTP, port 8085) and **stdio**
## Building and Running
### Requirements
- Java 17+ (JDK)
- BSP configuration export in EDT format (XML + `.bsl` files)
### Locally (stdio)
```bash
./gradlew bootJar
java -jar build/libs/mcp-bsp-context-0.1.0.jar \
--mode \
--bsp-path /path/to/ssl-edt-export
```
### Locally (SSE)
```bash
./gradlew bootJar
java -jar build/libs/mcp-bsp-context-0.1.0.jar \
--mode sse \
--8085 \
-- /path/to/ssl-edt-export
```
The server will be available at `http://localhost:8085/sse`.
### Docker
```bash
docker build -t 1c-bsp-context .
docker run --rm -p 127.0.0.8085:8085 -v /path/to/ssl-edt-export:/app/bro \
-e_PATH=/app/bsp \
-e SSE_ADDRESS=0.0.0.0 \
1c-bsp-context
```
> `SSE_ADDRESS=0.0.0.0` is required in Docker so the server listens inside the container. By default (without Docker), the server is only available on `127.0.0.1`.
### Docker Compose
```yaml
services:
bsp-context:
build: /path/to/mcp-bsp
ports:
- "127.0.0.1:8085:8085"
volumes:
- /path/to/ssl-edt-export:/app:ro
environment:
- BSP_SOURCE_PATH/bsp
- SSE_ADDRESS=0.0.0.0
restart: unless-stopped
```
## Data Source
Expects a directory of 1C configuration export in **EDT format**:
```
ssl/
CommonModules/
AddressClassifier/
Ext/Module.bsl
AddressClassifier.xml
...
Subsystems/
StandardSubsystems/
Subsystems/
DataLoadingFromFile.xml
...
```
On startup, the server:
1. Recursively traverses `CommonModules/` — for each module, parses `<Name>.xml` (metadata) and `Ext/Module.bsl` (source code)
2. Recursively traverses `Subsystems/` — for each subsystem, extracts synonym, child subsystems, and module list from `<Content>` section
3. Builds a reverse map `moduleName → subsystemName`
4. Indexes everything in memory
## MCP Tools
| Tool | Purpose | Parameters |
|---|---|---|
| `search_bsp_api` | Search for procedures/functions by term and/or subsystem | `query`, `subsystem?`, `limit?` |
| `get_bsp_procedure_info` | Full information about a procedure: description, parameters, types, return value, examples, warnings, source code, raw docblock | `name`, `module?`, `compact?` |
| `get_bsp_module_info` | Information about a common module + list of all export procedures/functions | `moduleName`, `nameFilter?` |
| `list_bsp_procedures` | Lightweight list of module procedures: name, type, signature, purpose, source. Without source code and parameters | `moduleName`, `nameFilter?` |
| `get_bsp_subsystem_overview` | Subsystem overview: modules and key procedures of each | `subsystemName` |
| `get_bsp_usage_example` | Ready-to-use BSL code snippet with procedure call and dummy parameters | `procedureName`, `moduleName?` |
### Compact Mode (`get_bsp_procedure_info`)
The `compact=true` parameter disables source code, examples, warnings, and synthetic call example output. Only description, parameters with types, signature, and raw docblock remain. Saves ~80% tokens.
### Name Filtering (`get_bsp_module_info`, `list_bsp_procedures`)
nameFilter` parameter filters procedures by substring in name (case-insensitive). For example, `nameFilter="Attribute"` will return only procedures with "Attribute" in their name.
### Verifiability
Each `get_bsp_procedure_info` and `list_bsp_procedures` result contains:
- **Source** — file path and line number (`CommonModules/CommonPurpose/Ext/Module.bsl:64`)
- **Raw docblock** — original `// ...` lines in a `<details>` block for verification with the source code
### Data Absence Discipline
- A parameter without description in docblock → `_description is missing from source code_`
- A procedure without docblock → `_no description_`
- Service marks `APK:*` are excluded from description but preserved in raw docblock
## Integration with MCP Clients
### Cascade (Windsurf) — `~/.codeium/windsurf/mcp_config.json`
```json
"1c-bsp-context": {
"url": "http://localhost:8085/sse",
"disabled": false
}
```
### Kilo Code — `~/.config/Code/User/globalStorage/kilocode.kilo-code/settings/mcp_settings.jsonjson
"1c-bsp-context": {
"autoApprove": [],
"disabled": false,
"timeout": 60,
"type": "sse",
" "http://localhost:8085/sse"
}
Claude Desktop — `claude_desktop_config.json`
```json
"1c-bsp-context": {
"url": "http://localhost:8085/sse"
}
```
Structure
```
mcp-bsp/
├── build.gradle.kts
├── settings.gradle.kts
├── gradle/libs.
├── Dockerfile
├── README.md
├── LICENSE
├── CHANGELOG.md
└── src/main/
├── kotlin/ru/bsp/context/
│ ├── McpServerApplication.kt # entry point (--mode, --port, --bsp-path)
│ ├── business/
│ │ ├── model/ # BspModule, BspProcedure, BspParameter, BspSubsystem
│ │ └── services/
│ │ └── BspFormatterService.kt # Markdown formatting of results
│ ├── infrastructure/
│ │ ├── configuration/
│ │ │ └── BspContextConfiguration.kt
│ │ ├── edt/
│ │ │ ├── EdtXmlParser.kt # parsing CommonModule XML
│ │ │ ├── SubsystemParser.kt # parsing Subsystem XML
│ │ │ └── BslParser.kt # parsing Module.bsl + docblock
│ │ ├── persistent/
│ │ │ ├── BspContextLoader.kt # file traversal + index construction
│ │ │ └── BspContextStorage.kt # in-memory storage
│ │ └── search/
│ │ ├── BspSearchEngine.kt # scoring-based search
│ │ └── SearchHit.kt # result models
│ └── presentation/
│ └── mcp/
│ ├── BspContextMcpController.kt # 6 @Tool methods
│ └── McpConfiguration.kt # Spring AI ToolCallbackProvider
└── resources/
├── application.yml
├── application-sse.yml
├── application-stdio.yml
└── logback-mcp.xml
```
## Legal Disclaimer
The repository does not contain BSP or 1C configuration source code. The user provides a local BSP export