Skip to main content
Glama

MCP-сервер для Контур.Диадок — электронный документооборот (ЭДО) через ИИ

CI

Если вы искали, как подключить Диадок к нейросети, достать счета-фактуры и УПД из ЭДО не кликая по кабинету или подписать документ из чата — это оно. 12 инструментов: поиск контрагентов по ИНН, список и содержимое документов, отправка и подписание (счета-фактуры, акты, УПД, ТОРГ-12 и др.). Пишете «покажи входящие УПД за март» — получаете список, а не инструкцию, куда нажать.

MCP server for Kontur.Diadoc electronic document interchange (EDI). Search organizations and counterparties, list/fetch documents, send and sign them — straight from your AI assistant.


Инструменты / Tools

Tool

Назначение

Ключевые параметры

authenticate

Проверить аутентификацию, вернуть превью токена

—

list_organizations

Поиск организаций по ИНН/КПП

inn (обяз.), kpp, include_relations

get_organization

Детали организации

один из: org_id / box_id / inn (+kpp)

list_documents

Список документов в ящике с фильтрами и пагинацией

box_id, filter_category, timestamp_from/to, count, after_index_key

get_document

Конкретный документ

box_id, message_id, entity_id, inject_entity_content

send_document

Отправить документ контрагенту

from_box_id, to_box_id, type_named_id, content_base64, signature_base64?

sign_document

Подписать входящий документ

box_id, message_id, entity_id, signature_base64? / sign_with_test_signature?

list_counterparties

Список контрагентов

box_id (myBoxId), counteragent_status, query, page_size

Related MCP server: DottedSign MCP

Установка / Install

Claude Desktop / Cline / Cursor

{
  "mcpServers": {
    "kontur-diadoc": {
      "command": "npx",
      "args": ["-y", "@theyahia/kontur-diadoc-mcp"],
      "env": {
        "DIADOC_API_CLIENT_ID": "<YOUR_DEVELOPER_KEY>",
        "DIADOC_LOGIN": "<YOUR_LOGIN>",
        "DIADOC_PASSWORD": "<YOUR_PASSWORD>"
      }
    }
  }
}

Переменные окружения / Environment variables

Variable

Обяз.

Описание

DIADOC_API_CLIENT_ID

да

Ключ разработчика (ddauth_api_client_id), выдаётся при регистрации для доступа к API

DIADOC_LOGIN

да

Логин учётной записи Diadoc

DIADOC_PASSWORD

да

Пароль учётной записи Diadoc

DIADOC_BASE_URL

нет

Альтернативный хост API (напр. песочница). По умолчанию https://diadoc-api.kontur.ru

⚠️ Изменение совместимости (v1.1.0): ключ разработчика теперь читается из DIADOC_API_CLIENT_ID. Старое имя DIADOC_CLIENT_ID всё ещё принимается как fallback. Прежняя переменная DIADOC_API_KEY больше не требуется (раньше она читалась, но никуда не отправлялась).

Как получить доступ / Getting credentials

  1. Зарегистрируйте приложение и получите ключ разработчика (ddauth_api_client_id) на портале разработчика Контура.

  2. Используйте логин и пароль вашей учётной записи Diadoc.

  3. Для экспериментов запросите доступ к тестовому контуру (песочнице) и укажите его хост в DIADOC_BASE_URL.

Основные понятия / Key concepts

  • box_id — идентификатор «ящика» организации в Diadoc; адресат отправки и контекст большинства операций.

  • ИНН/КПП — проверяются на формат (ИНН 10 или 12 цифр, КПП 9 цифр) до обращения к API.

  • filter_category — обязательный фильтр в list_documents, формат <DocumentType>.<DocumentClass><Status>, напр. Any.Inbound, Any.InboundNotFinished, XmlTorg12.OutboundWithRecipientSignature.

  • Пагинация — курсорная: ответ содержит ключ, который передаётся в after_index_key следующего запроса (count 0–100). Сдвиг по offset Diadoc не использует.

  • Время — timestamp_from/timestamp_to принимаются как ISO-8601 и автоматически конвертируются в .NET-тики (timestampFromTicks/timestampToTicks), которых ждёт API.

Подписание документов / Signing — важно

Diadoc API не создаёт криптографическую подпись сам. Боевую подпись (КЭП, формат CAdES/PKCS#7) формирует клиент — например, через КриптоПро CSP — и передаёт её сюда в base64:

  • send_document — поле signature_base64 (можно опустить для неподписанных/неформализованных документов: тогда отправляется только содержимое).

  • sign_document — поле signature_base64; либо sign_with_test_signature: true для тестовой подписи в песочнице (в проде не работает).

Генерация самой подписи — вне зоны ответственности этого сервера. Он корректно формирует структуру запроса (DocumentAttachments / SignedContent для отправки, Signatures для подписания) и прокидывает вашу подпись в Diadoc.

Обработка ошибок / Error handling

Ошибки API (HTTP-статус и тело ответа Diadoc) возвращаются как результат инструмента с флагом isError: true и понятным текстом, а не роняют сессию. Клиент сам делает: повтор с экспоненциальной задержкой на 429/5xx, одну прозрачную ре-аутентификацию на 401, таймаут 15 с на запрос.

Примеры запросов / Demo prompts

  • «Найди организацию по ИНН 7707083893 в Diadoc»

  • «Покажи входящие неподписанные документы за этот месяц»

  • «Открой документ по message_id … и entity_id …»

  • «Отправь неформализованный документ контрагенту box-456»

  • «Подпиши входящий акт тестовой подписью (песочница)»

  • «Список моих контрагентов со статусом IsMyCounteragent»

Разработка / Development

npm install
npm run dev        # запуск из исходников (tsx)
npm run build      # компиляция в dist/
npm test           # vitest
npm run typecheck  # tsc --noEmit
npm run lint       # biome check .
npm run format     # biome check --write . (автоформат + фиксы)

Справочник API / API reference

Документация: developer.kontur.ru/doc/diadoc-api

Лицензия / License

MIT


Часть WWmcp · Telegram: @vhodvai

Available Tools

8 tools
authenticateB

Аутентификация в Kontur.Diadoc API (возвращает превью токена). / Authenticate with Diadoc.

Inputs: no named parameters.

get_documentC

Получить конкретный документ по box/message/entity ID. / Get a specific document.

Inputs: box_id (required), entity_id (required), message_id (required), inject_entity_content.

get_organizationC

Детали организации по orgId / boxId / ИНН. / Get organization details.

Inputs: inn, kpp, box_id, org_id.

list_counterpartiesC

Список контрагентов организации (myBoxId). / List counterparties for an organization.

Inputs: box_id (required), query, page_size, after_index_key, +1 more.

list_documentsC

Список документов в ящике с фильтрами и пагинацией. / List documents in a box.

Inputs: box_id (required), count, timestamp_to, sort_direction, +5 more.

list_organizationsC

Поиск организаций по ИНН/КПП в Diadoc. / Search organizations by INN/KPP.

Inputs: inn (required), kpp, include_relations.

send_documentB

Отправить документ контрагенту. Подпись (base64) формирует клиент; для песочницы шлите без подписи. / Send a document; the client supplies the signature.

Inputs: to_box_id (required), from_box_id (required), type_named_id (required), content_base64 (required), +3 more.

sign_documentB

Подписать входящий документ. Нужна готовая подпись (base64) или sign_with_test_signature в песочнице. / Sign a received document with a client-supplied signature.

Inputs: box_id (required), entity_id (required), message_id (required), signature_base64, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 8 tools

    Disambiguation4/5

    Each tool targets a fairly distinct resource+action (auth, org lookup, document listing/get, sign, send, counterparties). The main potential confusion is between list_organizations and list_counterparties, and between sign_document and send_document, but the descriptions clarify that counterparties are trading partners of a box and that signing is for received documents while send transmits to a counterparty.

    Naming Consistency4/5

    The set follows a predictable snake_case verb_noun pattern: list_*, get_*, sign_document, send_document. The only deviation is the bare verb 'authenticate' with no noun, which is a minor inconsistency rather than a structural one.

    Tool Count4/5

    Eight tools is a reasonable, well-scoped surface for a document-exchange API, and each tool maps to a real workflow step. It sits slightly on the thin side given the breadth of Diadoc (messages, events, document content retrieval are absent), but nothing is redundant.

    Completeness3/5

    Core flows (auth, org/counterparty lookup, list/get documents, sign, send) are covered, but notable operations are missing: retrieving a document's actual content/file (print/download), listing messages/events, and rejecting or deleting documents. These gaps will force agents to dead-end on common lifecycle tasks like inspecting document bodies or tracking new incoming documents.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to manage eSignature workflows, including creating signing tasks, tracking document status, and managing templates via natural language.
      142
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to generate DOCX and PDF documents from DocMake templates through natural language, including template listing, field inspection, document rendering, DOCX import, and usage tracking.
      6
      46 npm
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to validate Russian business requisites (INN, OGRN, bank accounts) via checksums, extract them from text, and retrieve counterparty details by INN using DaData.
      5
      MIT