Spring Boot MCP Server for 1C:Напарник logo

Spring Boot MCP Server for 1C:Напарник

Community
SteelMorgan

МСР-сервер для обращения к 1С.Напарник (поддержка SSE и docker-контейнеризации)

PublisherSteelMorgan
Repositoryspring-mcp-1c-copilot
LanguageKotlin
Forks
4
Stars
46
Available tools
0
Transport typestdio, streamable-http
Categories
Links
  • Connect tools to AI workflows

    Spring Boot MCP Server for 1C:Напарник exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    46 stars and 4 forks from the linked repository.

🚀 Spring Boot MCP Server для 1С:Напарник

Полнофункциональный MCP (Model Context Protocol) сервер для интеграции с 1С:Напарник API

Spring Boot Kotlin Docker MCP License

📄 Лицензия: Open Source для личного и некоммерческого использования. Коммерческое использование только с разрешения автора.

✨ Возможности

  • 🎯 MCP Protocol Support: Полная поддержка протокола MCP для интеграции с AI ассистентами
  • 🤖 1С:Напарник Integration: Прямая интеграция с API 1С:Напарник через правильные endpoints
  • ⚡ Dual Transport Support: Streamable HTTP по умолчанию для Codex и SSE-профиль для клиентов, которым нужен классический transport
  • 🌐 REST API: Дополнительные REST endpoints для прямого взаимодействия
  • 📚 Swagger UI: Интерактивная документация API
  • 🐳 Docker Ready: Готовые Docker конфигурации для развертывания
  • 🔐 Авторизация: Поддержка Bearer токенов для 1С:Напарник API

🛠️ Инструменты MCP

1. ask_1c_ai

Задать вопрос ИИ 1С:Напарник

  • question (обязательный): Вопрос для ИИ
  • programming_language (опционально): Язык программирования; для 1С/BSL используйте 1c
  • create_new_session (опционально): Создать новую сессию

2. explain_1c_syntax

Объяснить синтаксис элемента 1С

  • syntax_element (обязательный): Элемент синтаксиса для объяснения
  • context (опционально): Контекст использования

3. check_1c_code

Проверить код 1С на ошибки

  • code (обязательный): Код 1С для проверки
  • check_type (опционально): Тип проверки (syntax, logic, performance)

🚀 Быстрый старт

Требования

  • Java 17+
  • Docker (рекомендуется)
  • Токен доступа к 1С:Напарник API

1. Получение токена 1С:Напарник

  1. Зарегистрируйтесь на code.1c.ai
  2. Получите токен доступа в личном кабинете
  3. Сохраните токен для использования в переменных окружения

2. Локальный запуск

bash
# Клонируйте репозиторий
git clone <repository-url>
cd spring-mcp-1c-copilot

# 1. Скопируйте пример переменных окружения
cp env.example .env

# 2. Вставьте токен в файл .env в строку:
# ONEC_AI_TOKEN=your_token_here

# 3. Перенесите токен из .env в локальный secret-файл
./scripts/prepare-token-secret.sh

# 4. Запустите приложение
export ONEC_AI_TOKEN_FILE="$PWD/.secrets/onec_ai_token"
export ONEC_AI_BASE_URL="https://code.1c.ai"
export ONEC_AI_SKILL_NAME="raw"

./gradlew bootRun

3. Docker запуск (рекомендуется)

bash
# 1. Скопируйте env и вставьте токен в .env в строку ONEC_AI_TOKEN=...
cp env.example .env

# 2. Перенесите токен в локальный secret-файл
./scripts/prepare-token-secret.sh

# 3. Сборка образа
docker build -f Dockerfile.build -t spring-mcp-1c-copilot .

# 4. Запуск контейнера
docker compose up -d

4. Сеть Docker

Текущий docker-compose.yml подключает контейнер к внешней сети infra.

Это актуально при работе в песочнице из репозитория SteelMorgan/1c-agent-based-dev-framework, где такая сеть уже существует и используется для взаимодействия контейнеров между собой.

В этом случае MCP endpoint внутри docker-сети будет доступен по адресу:

text
http://spring-mcp-1c-copilot:8000/mcp

Если вы запускаете сервис вне этой песочницы, попросите своего агента помочь вам настроить сеть под ваше окружение. В других проектах внешняя сеть infra может отсутствовать или называться иначе.

📡 API Endpoints

MCP Endpoints

  • POST /mcp - Основной MCP endpoint для JSON-RPC запросов
  • GET /mcp - SSE stream для MCP клиентов

REST API Endpoints

  • POST /api/ask-ai - Задать вопрос ИИ 1С:Напарник
  • POST /api/explain-syntax - Объяснить синтаксис 1С
  • POST /api/check-code - Проверить код 1С на ошибки
  • GET /api/health - Проверка состояния сервера

Документация

  • http://localhost:8000/swagger-ui.html - Swagger UI документация
  • http://localhost:8000/api-docs - OpenAPI JSON схема

⚙️ Конфигурация

Что важно в текущей версии

  • По умолчанию используется ONEC_AI_SKILL_NAME=raw, потому что для справочного режима это стабильнее и не уводит Напарника во внутренние tool_calls.
  • Рекомендуемый способ хранения токена: файл .secrets/onec_ai_token через ONEC_AI_TOKEN_FILE.
  • Для миграции токена из .env в secret-файл добавлен скрипт ./scripts/prepare-token-secret.sh.
  • В docker-compose контейнер монтирует secret-файл и может работать в сети infra для песочницы из 1c-agent-based-dev-framework.

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

ПеременнаяОписаниеПо умолчанию
ONEC_AI_TOKENТокен доступа к 1С:Напарник APIОбязательно
ONEC_AI_TOKEN_FILEПуть к файлу с токеном; используется вместо ONEC_AI_TOKEN, если env пуст-
ONEC_AI_BASE_URLБазовый URL APIhttps://code.1c.ai
ONEC_AI_TIMEOUTТаймаут запросов (сек)30
ONEC_AI_SKILL_NAMEРежим сессии Напарника; для прямых ответов используйте rawraw
ONEC_AI_UI_LANGUAGEЯзык интерфейса APIru
ONEC_AI_PROGRAMMING_LANGUAGEЯзык программирования для новых разговоров; для 1С/BSL используйте 1c1c
ONEC_AI_SCRIPT_LANGUAGEЯзык сценариев/ответов APIru
SSE_PORTПорт сервера8000

application.yml

yaml
onec:
  ai:
    token: ${ONEC_AI_TOKEN:}
    token-file: ${ONEC_AI_TOKEN_FILE:}
    base-url: ${ONEC_AI_BASE_URL:https://code.1c.ai}
    timeout: ${ONEC_AI_TIMEOUT:30}
    skill-name: ${ONEC_AI_SKILL_NAME:raw}
    ui-language: ${ONEC_AI_UI_LANGUAGE:ru}
    programming-language: ${ONEC_AI_PROGRAMMING_LANGUAGE:1c}
    script-language: ${ONEC_AI_SCRIPT_LANGUAGE:ru}

server:
  port: ${SSE_PORT:8000}

springdoc:
  api-docs:
    path: /api-docs
  swagger-ui:
    path: /swagger-ui.html
    enabled: true

🔗 Интеграция с Cursor IDE

Добавьте в ~/.cursor/mcp.json:

json
{
  "mcpServers": {
    "1c-copilot-proxy": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

После этого в Cursor IDE будут доступны все инструменты для работы с 1С:Напарник!

🏗️ Структура проекта

src/main/kotlin/ru/alkoleft/copilot/
├── McpCopilotApplication.kt          # Главный класс приложения
├── config/
│   ├── McpConfiguration.kt           # MCP конфигурация
│   └── OpenApiConfig.kt              # Swagger конфигурация
├── controller/
│   ├── McpController.kt              # MCP контроллер
│   └── RestApiController.kt          # REST API контроллер
└── service/
    ├── OneCApiClient.kt              # Клиент для 1С:Напарник API
    └── OneCCopilotService.kt         # Сервис с MCP инструментами

🧪 Тестирование

Тест MCP инициализации

bash
curl -X POST http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "initialize",
    "params": {
      "protocolVersion": "2025-06-18",
      "capabilities": {"tools": true}
    }
  }'

Тест REST API

bash
curl -X POST "http://localhost:8000/api/ask-ai?question=Как создать справочник в 1С?"

🔧 Разработка

Безопасное хранение токена

Рекомендуемый путь такой:

bash
# 1. Скопируйте пример env
cp env.example .env

# 2. Откройте .env и вставьте токен в строку:
# ONEC_AI_TOKEN=your_token_here

# 3. Один раз выполните миграцию в локальный secret-файл
./scripts/prepare-token-secret.sh

# После этого:
# - токен будет записан в .secrets/onec_ai_token
# - строка ONEC_AI_TOKEN=... будет удалена из .env
# - в .env появится ONEC_AI_TOKEN_FILE=.secrets/onec_ai_token

Если хотите положить токен в файл вручную, используйте тот же путь:

bash
mkdir -p .secrets
chmod 700 .secrets
printf '%s' 'your_token_here' > .secrets/onec_ai_token
chmod 600 .secrets/onec_ai_token

export ONEC_AI_TOKEN_FILE="$PWD/.secrets/onec_ai_token"
unset ONEC_AI_TOKEN
./gradlew bootRun

Клиент отправляет токен в заголовок Authorization ровно в том виде, как он лежит в файле. Для токенов 1С:Напарник в этом окружении префикс Bearer не требуется.

Для Docker Compose перед первым запуском достаточно выполнить:

bash
./scripts/prepare-token-secret.sh
docker compose up -d

Сборка

bash
./gradlew build

Запуск тестов

bash
./gradlew test

Локальная разработка

bash
./gradlew bootRun --args='--spring.profiles.active=dev'

📋 Логи и отладка

Просмотр логов Docker контейнера

bash
docker logs spring-mcp-1c-copilot --follow

Уровни логирования

  • DEBUG - Подробные логи для разработки
  • INFO - Основные события (по умолчанию)
  • WARN - Предупреждения
  • ERROR - Ошибки

🚀 Производственное развертывание

См. DEPLOYMENT.md для подробного руководства по развертыванию на серверах.

🙏 Благодарности

Этот проект основан на наработках следующих репозиториев:

Огромное спасибо авторам этих проектов! 🎉

Наш Spring Boot MCP Server развивает идеи этих проектов, добавляя:

  • Современную архитектуру на Spring Boot и Kotlin
  • Полную поддержку MCP протокола с SSE
  • Swagger UI документацию
  • Готовые конфигурации для продакшена
  • Автоматизацию развертывания

🤝 Вклад в проект

  1. Fork репозитория
  2. Создайте feature branch (git checkout -b feature/amazing-feature)
  3. Commit изменения (git commit -m 'Add amazing feature')
  4. Push в branch (git push origin feature/amazing-feature)
  5. Откройте Pull Request

📄 Лицензия

Лицензия: Open Source (Персональное и некоммерческое использование)

  • ✅ Личное использование - свободно
  • ✅ Некоммерческое использование - свободно
  • ✅ Образовательные цели - свободно
  • ❌ Коммерческое использование - только с разрешения автора

Для получения разрешения на коммерческое использование свяжитесь с автором.

Основанные проекты:

🆘 Поддержка

Если у вас возникли проблемы:

  1. Проверьте Issues
  2. Убедитесь, что токен 1С:Напарник действителен
  3. Проверьте логи контейнера: docker logs spring-mcp-1c-copilot
  4. Создайте новый Issue с подробным описанием проблемы

🎉 Наслаждайтесь работой с 1С:Напарник через MCP!

Installation

TypingMind
{
  "mcpServers": {
    "spring-mcp-1c-copilot": {
      "command": "./gradlew",
      "args": [
        "bootRun"
      ]
    }
  }
}

Use Spring Boot MCP Server for 1C:Напарник MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Spring Boot MCP Server for 1C:Напарник is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Spring Boot MCP Server for 1C:Напарник as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Spring Boot MCP Server for 1C:Напарник MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "spring-mcp-1c-copilot": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Spring Boot MCP Server for 1C:Напарник MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Spring Boot MCP Server for 1C:Напарник MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Spring Boot MCP Server for 1C:Напарник to help me with this task?
Spring Boot MCP Server for 1C:Напарник
Sure. I read it.
Here is what I found using Spring Boot MCP Server for 1C:Напарник.

Option 2: Add an MCP server URL

Use this when Spring Boot MCP Server for 1C:Напарник is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter the MCP server URL from the provider in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste the MCP server URL from the provider into the Server URL field.
  2. Enter a connection name for Spring Boot MCP Server for 1C:Напарник.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the Spring Boot MCP Server for 1C:Напарник connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the Spring Boot MCP Server for 1C:Напарник tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the Spring Boot MCP Server for 1C:Напарник tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Spring Boot MCP Server for 1C:Напарник to help me with this task?
Spring Boot MCP Server for 1C:Напарник
Sure. I read it.
Here is what I found using Spring Boot MCP Server for 1C:Напарник.

Frequently asked questions

What is the Spring Boot MCP Server for 1C:Напарник MCP server used for?

Spring Boot MCP Server for 1C:Напарник is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Spring Boot MCP Server for 1C:Напарник MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Spring Boot MCP Server for 1C:Напарник with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Spring Boot MCP Server for 1C:Напарник MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Spring Boot MCP Server for 1C:Напарник connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Spring Boot MCP Server for 1C:Напарник MCP to TypingMind?

Spring Boot MCP Server for 1C:Напарник can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does Spring Boot MCP Server for 1C:Напарник MCP provide in TypingMind?

Spring Boot MCP Server for 1C:Напарник exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Spring Boot MCP Server for 1C:Напарник MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Spring Boot MCP Server for 1C:Напарник requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇