Content
# 1C MCP Toolkit
**System for integrating AI-agents with 1C:Enterprise databases via MCP and REST API**
## 📋 Description
1C MCP Toolkit is a solution for connecting AI-agents (Kiro, Claude, etc.) to 1C:Enterprise databases. It supports two operation modes: **embedded server** (HTTP-server starts directly inside the 1C processing, without Python) and **proxy** (Python-server with long polling).
**Key benefits:**
- ✅ No need to change 1C configuration
- ✅ No need to publish 1C server
- ✅ Does not use COM-connection
- ✅ Compatible with 1C:Enterprise 8.2.13+ / 8.3.25
- ✅ **Embedded server**: No Python needed — HTTP-server starts directly in 1C
- ✅ Support for Docker (Proxy mode)
## 🏗️ Architecture
### Option 1: Embedded Server
HTTP-server starts directly inside the 1C processing. No Python needed.
```
┌─────────────────┐ MCP / REST API ┌──────────────────┐
│ AI Agent │ ◄───────────────► │ 1C (.epf) │
│ (Kiro, Claude) │ /mcp /api/* │ Embedded HTTP-server│
└─────────────────┘ └──────────────────┘
│
▼
┌───────────────┐
│ 1C Database │
└───────────────┘
```
### Option 2: Proxy Mode
```
┌─────────────────┐ MCP / REST API ┌─────────────────┐
│ AI Agent │ ◄─────────────────────────► │ │
│ (Kiro, Claude) │ /mcp /api/* │ Python Proxy │
└─────────────────┘ │ Server │
│ │
┌─────────────────┐ HTTP Long Polling │ (FastAPI + │
│ 1C Processing │ ◄─────────────────────────► │ MCP SDK) │
│ (external .epf) │ /1c/poll, /1c/result │ │
└─────────────────┘ └─────────────────┘
│ │
▼ │
┌─────────────────┐ ┌───────┴───────┐
│ 1C Database │ │ Docker │
│ (8.2.13/8.3.25) │ │ Container │
└─────────────────┘ └───────────────┘
```
## 🚀 Quick Start
### Option 0: Embedded Server (without Python, recommended)
1. Open `build/MCP_Toolkit.epf` in 1C:Enterprise
2. Select **Embedded server** mode
3. Click "Start server"
4. Configure AI-agent to `http://<1C-computer-IP>:6003/mcp`
### Option 1: Docker Hub (Proxy mode)
Run proxy-server from a ready Docker Hub image:
```bash
docker run -d -p 6003:6003 -e ALLOW_DANGEROUS_WITH_APPROVAL=true --restart unless-stopped --name 1c-mcp-toolkit-proxy roctup/1c-mcp-toolkit-proxy
```
### Option 2: Docker Compose
```bash
# Clone repository
git clone <repository-url>
cd 1c-mcp-toolkit
# Run via Docker Compose
docker-compose up -d
```
### Option 3: Direct Python Launch
```bash
# Create virtual environment
python -m venv .venv
.venv\Scripts\activate # Windows
# or
source .venv/bin/activate # Linux/Mac
# Install dependencies
pip install -r requirements.txt
# Start server
python -m onec_mcp_toolkit_proxy
```
Server will start at `http://localhost:6003`
## 📦 Installation of 1C Processing
1. Download ready processing from `build` folder **[MCP_Toolkit.epf](./build/MCP_Toolkit.epf)**
2. Open processing in 1C (File → Open)
3. In processing settings, specify:
- Proxy-server URL: `http://localhost:6003`
- (optional) Channel ID for command isolation
4. Click "Connect"
## ⚙️ AI-Agent Configuration
### Kiro IDE
Add to `.kiro/settings/mcp.json`:
```json
{
"mcpServers": {
"onec-mcp-toolkit-proxy": {
"url": "http://localhost:6003/mcp",
"transport": "http",
"type": "streamable-http",
"disabled": false,
"autoApprove": ["execute_query", "get_metadata"]
}
}
}
```
### Claude Desktop
Open configuration file:
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
Add configuration:
```json
{
"mcpServers": {
"onec-mcp-toolkit-proxy": {
"url": "http://localhost:6003/mcp",
"transport": "http"
}
}
}
```
Restart application.
## 🛠️ Available MCP Tools
| Tool | Description |
|-----------|----------|
| **execute_query** | Execute 1C query language queries |
| **execute_code** | Execute arbitrary 1C code |
| **get_metadata** | Get metadata structure information |
| **get_event_log** | Get records from registration log |
| **get_object_by_link** | Get object by navigation link |
| **get_link_of_object** | Generate navigation link to object |
| **find_references_to_object** | Search for all references to object |
| **get_access_rights** | Get access rights to metadata objects |
| **get_bsl_syntax_help** | BSL built-in language reference: search for functions, methods, types, and language constructions |
| **get_screenshot** | Active 1C window screenshot (only Windows) |
| **submit_for_deanonymization** | Send final answer for deanonymization (only with enabled anonymization) |
| **restart_1c_session** | Restart current 1C session (required after configuration update; new session starts automatically) |
| **close_1c_session** | Close current 1C session and return new session launch command (for operations requiring exclusive access to database) |
## 🌐 REST API (alternative to MCP)
For AI-agents that do not support MCP protocol or prefer standard HTTP requests, proxy provides REST API with the same functionality.
**Base URL:** `http://localhost:6003/api/`
### Available Endpoints
| Endpoint | Method | Description |
|----------|-------|----------|
| `/api/execute_query` | POST | Execute 1C queries |
| `/api/execute_code` | POST | Execute 1C code |
| `/api/get_metadata` | GET/POST | Get metadata |
| `/api/get_event_log` | POST | Registration log |
| `/api/get_object_by_link` | POST | Get object by link |
| `/api/get_link_of_object` | POST | Generate object link |
| `/api/find_references_to_object` | POST | Search for object references |
| `/api/get_access_rights` | POST | Get access rights |
| `/api/get_bsl_syntax_help` | POST | BSL language reference |
| `/api/submit_for_deanonymization` | POST | Send text for deanonymization (only with enabled anonymization) |
| `/api/restart_1c_session` | POST | Restart 1C session |
| `/api/close_1c_session` | POST | Close session and get new session launch command |
### Response Format
Most responses follow a unified structure:
**Success:** `{"success": true, "data": <result>}`
**Error:** `{"success": false, "error": "Error description"}`
**Exception:** `submit_for_deanonymization` returns `{"received": true}` on success (without `data` field).
Detailed usage examples of REST API are available in full documentation.
## 🕵️ Data Anonymization
The tool supports automatic anonymization of personal and confidential data. Real values are replaced with stable tokens (`[ORG-00001]`, `[PER-00001]`, `[INN-00001]` etc.). Agent can pass tokens back to queries — server automatically restores real values.
**Embedded server mode:**
- Configuration via 1C processing form: metadata fields tree, dictionary from 1C reference books, regular expressions
**Proxy mode:**
- Managed by environment variables (`ANONYMIZATION_ENABLED=true`)
- Additionally: SpaCy NER, token isolation by channels, smart anonymization of column aliases
Full documentation: **[ANONYMIZATION.md](./ANONYMIZATION.md)**
## 🔒 Security
- Dangerous operations are blocked by a customizable blacklist
- Use `ALLOW_DANGEROUS_WITH_APPROVAL=true` for approval mode
- It is recommended to configure `autoApprove` only for safe tools
## 📝 Channel Isolation
When connecting multiple 1C clients to a single proxy-server, you can isolate command flows using channel IDs.
### Usage with MCP
```json
{
"mcpServers": {
"onec-dev": {
"url": "http://localhost:6003/mcp?channel=dev-environment",
"transport": "http",
"type": "streamable-http"
},
"onec-prod": {
"url": "http://localhost:6003/mcp?channel=prod-environment",
"transport": "http",
"type": "streamable-http"
}
}
}
```
### Usage with REST API
All REST endpoints support channel isolation via `?channel=<id>` query parameter:
```bash
# Development channel
curl -X POST "http://localhost:6003/api/execute_query?channel=dev-environment" \
-H "Content-Type: application/json" \
-d '{"query": "SELECT 1"}'
# Production Channel
```bash
curl -X POST "http://localhost:6003/api/execute_query?channel=prod-environment" \
-H "Content-Type: application/json" \
-d '{"query": "SELECT 1"}'
```
**Important:** Specify the same channel ID in the 1C processing settings for the corresponding environment.
## 🎓 Skills for AI Agents
When using **REST API**, it is recommended to use ready-made skills that contain detailed instructions for working with 1C MCP Toolkit.
### Available Skills
📁 **Folder:** `skills/`
| Skill | Description | Recommended for |
|-------|----------|-------------------|
| **calling-1c-rest-api-via-curl** | A comprehensive guide to using REST API via curl: all endpoints, request/response formats, workflow examples, error handling | REST API clients, automation, scripts |
| **composing-1c-queries** | Rules for composing correct queries in 1C query language: syntax, optimization, virtual tables, temporary tables, JOINs | Working with 1C data via execute_query |
### How to Use
Skills contain detailed instructions and reference documentation for AI agents. Each skill includes:
- Description of capabilities
- Usage examples
- Best practices
- Typical work patterns
For AI agents using REST API, the `calling-1c-rest-api-via-curl` skill is the primary guide and contains all necessary details for efficient work with the API.
## 📚 Documentation
Detailed documentation is available in **[README_FULL](./README_FULL.md)**
MCP Config
Below is the configuration for this MCP Server. You can copy it directly to Cursor or other MCP clients.
mcp.json
Connection Info
You Might Also Like
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
markitdown
Python tool for converting files and office documents to Markdown.
firecrawl
Firecrawl MCP Server enables web scraping, crawling, and content extraction.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
TrendRadar
TrendRadar: Your hotspot assistant for real news in just 30 seconds.
mempalace
The highest-scoring AI memory system ever benchmarked. And it's free.