1c-mcp
Give an AI agent eyes into your 1C:Enterprise 8.3 base — read metadata & data, run queries, and diagnose why a document won't post — over one extension HTTP service.
README
<div align="center">
1c-mcp
Give an AI agent eyes into your 1C:Enterprise 8.3 base — read metadata & data, run queries, and diagnose why a document won't post — over one extension HTTP service.
</div>
Why
Most 1C automation tooling either reads metadata or reads data. The thing an analyst actually gets stuck on — "this document won't post, why?" — needs both, plus the ability to run the posting logic and capture the error. 1c-mcp does exactly that.
It exposes your base as MCP tools through a thin HTTP service in a configuration extension. The MCP server stays a small, strict TypeScript client; the reasoning about how to fix a broken document is left to the agent (Claude) — no LLM baked into the server, no API keys to manage.
- 🔎 Metadata introspection — objects, attributes, tabular sections, register records
- 📄 Data & queries — read objects by ref, run 1C query-language, list documents, read register movements
- 🩺 Document diagnosis — test-post a document inside a rolled-back transaction, capture the fill errors, the exception text, the failing attribute, and the movements it tried to make — the whole context an agent needs to explain and fix it
- 🔒 Read-only by default — write tools (
object_update,document_post) exist but only register whenONEC_ALLOW_WRITE=1 - 🪶 TypeScript, ESM, MIT — 2 runtime deps (
@modelcontextprotocol/sdk,zod), no 1C secrets in the repo
How document diagnosis works
document_diagnose(ref) is the headline. The extension runs, inside a transaction it always rolls back:
ПроверитьЗаполнение()— collects required-field / validation problemsЗаписать(…Проведение)in aПопытка/Исключение— captures the posting exception and everyСообщить()- reads back the register movements it would have made
…then returns one structured object. The agent gets the error text, the exact attribute/row that failed, the document data, the object's metadata, and the attempted movements — and works out the fix:
document_diagnose # ref → { filled, fillErrors, posts, errorText, messages, wouldMove, data, metadata }
# agent reads it, explains the cause, proposes the change
object_update # (if ONEC_ALLOW_WRITE=1) apply the fix
document_post # (if ONEC_ALLOW_WRITE=1) post for real
Because the transaction is always rolled back, diagnosis has zero side effects on the base.
Requirements
- 1C:Enterprise 8.3 base published on a web server with HTTP services enabled.
- A configuration extension exposing the HTTP service
mcp(see The 1C side — this is the part you build, against a fixed contract). - A 1C user for the MCP to authenticate as (Basic Auth).
- Node ≥ 18.
Setup
npm install
cp .env.example .env # set ONEC_URL / ONEC_USER / ONEC_PASSWORD
npm run build
Register it with your MCP client:
{
"mcpServers": {
"1c": {
"command": "node",
"args": ["D:/projects/1c-mcp/dist/index.js"],
"env": {
"ONEC_URL": "http://localhost/mybase/hs/mcp",
"ONEC_USER": "mcp",
"ONEC_PASSWORD": "secret",
"ONEC_ALLOW_WRITE": "0"
}
}
}
}
| Env | Meaning |
|---|---|
ONEC_URL |
HTTP-service root: http://<host>/<base>/hs/<rootURL> |
ONEC_USER / ONEC_PASSWORD |
1C user for Basic Auth |
ONEC_ALLOW_WRITE |
1 registers the write tools; anything else = read-only |
The env prefix is
ONEC_(not1C_) on purpose — a var name starting with a digit breaks in POSIX shells.
Tools
| Tool | Purpose |
|---|---|
metadata_list |
List metadata objects (Catalogs / Documents / Registers …) with a filter. |
metadata_get |
Full structure of one object: attributes, tabular sections, register records. |
metadata_search |
Search objects by name/synonym across all kinds. |
object_get |
Read an object by GUID ref — attributes + tabular sections. |
query_run |
Run a 1C query-language query and return rows. |
document_list |
List documents by type / period / filter. |
register_records |
Register movements / balances by document or filter. |
document_diagnose |
Test-post in a rolled-back transaction → fill errors, exception text, failing attribute, movements, data, metadata. |
document_check_fill |
Fill check only (no test-post). |
object_update ⚑ |
Write an object's attributes / tabular sections. |
document_post ⚑ |
Post a document for real. |
⚑ — registered only when ONEC_ALLOW_WRITE=1.
The 1C side
The MCP talks to one HTTP service. You implement it in a configuration extension, against this contract.
Root: http://<host>/<base>/hs/mcp. Every method: POST, JSON body, Basic Auth. Errors: non-2xx with body { "error": { "code": string, "message": string } } (the client turns this into a tool error).
| Method | Request | Response (key fields) |
|---|---|---|
/metadata/list |
{ kind?, filter? } |
{ objects: [{ fullName, name, synonym, kind }] } |
/metadata/get |
{ fullName } |
{ fullName, synonym, attributes[], tabularSections[], registerRecords[] } |
/query/run |
{ text, params?, limit? } |
{ columns[], rows[][] } |
/object/get |
{ ref } |
{ ref, presentation, fields{}, tabularSections{} } |
/document/list |
{ type, period?, filter?, limit? } |
{ documents: [{ ref, number, date, presentation, posted }] } |
/register/records |
{ register, filter?, ref? } |
{ records[] } |
/document/diagnose |
{ ref } |
see below |
/document/checkfill |
{ ref } |
{ filled, fillErrors[] } |
/object/update ⚑ |
{ ref, fields{}, tabularSections? } |
{ ok, ref } |
/document/post ⚑ |
{ ref } |
{ ok, posts, errorText? } |
/document/diagnose response
{
"ref": "guid",
"presentation": "Реализация 0001 от 01.01.2026",
"filled": false,
"fillErrors": [{ "field": "Организация", "message": "Поле не заполнено" }],
"posts": false,
"errorText": "Недостаточно 5 шт номенклатуры X на складе Y",
"messages": [{ "text": "...", "field": "Товары", "dataPath": "Товары[2].Количество" }],
"wouldMove": [{ "register": "ТоварыНаСкладах", "records": [{ "...": "..." }] }],
"data": { "Организация": null, "Товары": [{ "...": "..." }] },
"metadata": { "attributes": [], "tabularSections": [], "registerRecords": [] }
}
Extension setup checklist
-
Create a configuration extension, add an HTTP service with root URL
mcp. -
Implement the URL templates from the contract (method POST, JSON in/out).
-
The key handler
/document/diagnose— a side-effect-free test-post:Объект = Ссылка.ПолучитьОбъект(); Результат = Новый Структура("filled, fillErrors, posts, errorText, messages, wouldMove, data, metadata"); НачатьТранзакцию(); Попытка Результат.filled = Объект.ПроверитьЗаполнение(); // messages collected below Попытка Объект.Записать(РежимЗаписиДокумента.Проведение); Результат.posts = Истина; Исключение Результат.posts = Ложь; Результат.errorText = ОписаниеОшибки(); КонецПопытки; Результат.messages = ПолучитьСообщенияПользователю(Истина); Исключение Результат.errorText = ОписаниеОшибки(); КонецПопытки; ОтменитьТранзакцию(); // always roll back — the base is never changedFill
data/metadata/wouldMoveand return the JSON above. -
Publish the base on a web server, enable HTTP services, create the
ONEC_USERuser. -
Smoke test:
curl -u user:pass -X POST http://host/base/hs/mcp/metadata/list -d "{}".
Development
npm test # vitest — config, HTTP client, write-tool gating (no live 1C needed)
npm run build # tsc → dist/
npx tsc --noEmit # typecheck
The design spec and implementation plan live in docs/superpowers/.
Security
document_diagnosealways runs inside a rolled-back transaction — zero side effects.- Write tools register only when
ONEC_ALLOW_WRITE=1. - 1C credentials come from the environment only;
.envis git-ignored and never committed.
Contributing
PRs welcome. Good first ideas:
- a bundled reference extension (
.xmlsources of the HTTP-service module) - OData transport as a read-only fallback (no extension required)
- richer
wouldMoveshaping / typed diagnose result - Russian README
- Fork and branch:
git checkout -b feature/my-change npm install;npm run buildandnpx tsc --noEmitmust pass;npm testgreen- Never commit secrets (
.env, passwords) or real base data - Open a PR describing what and why
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。