Skip to content

Commit 2bb7faa

Browse files
fix(docling): switch MCP transport from Streamable HTTP to SSE
Docling MCP server crashes with "No valid session ID provided" after processing ~7 documents. Root cause: Streamable HTTP transport requires session management via mcp-session-id header. During long document processing (15-120 sec), sessions expire with no keepalive mechanism. Official recommendation for Docker environments is SSE transport: - modelcontextprotocol/python-sdk#880 - modelcontextprotocol/python-sdk#520 Changes: - MCP_TRANSPORT: streamable-http -> sse (docling-mcp-internal service) - DOCLING_MCP_URL: /mcp -> /sse (api, worker services) - Nginx proxy already configured for SSE (proxy_buffering off) Client code already supports SSE detection via URL path (client.ts:110) Beads: mc2-coa3 Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent fb9d97e commit 2bb7faa

8 files changed

Lines changed: 13 additions & 12 deletions

File tree

‎.beads/issues.jsonl‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@
207207
{"id":"mc2-cmks","title":"Унификация карточек генерации в стиле Hover Reveal","description":"Адаптировать все карточки генерации контента (quiz, audio, presentation, video, cover, card) к единому стилю Hover Reveal как у CourseCard. Файлы: UnifiedEnrichmentCard.tsx, EnrichmentsPanel.tsx","status":"closed","priority":2,"issue_type":"feature","owner":"[email protected]","created_at":"2026-01-22T11:24:36.030882795+03:00","created_by":"maslennikov-ig","updated_at":"2026-01-22T11:27:17.846293314+03:00","closed_at":"2026-01-22T11:27:17.846293314+03:00","close_reason":"Унифицированы все карточки генерации контента в едином стиле Hover Reveal. Создан UnifiedEnrichmentCard.tsx, удалены EnrichmentPlaceholderCard и ImagePlaceholderCard. Type-check пройден.","labels":["frontend","nextjs"]}
208208
{"id":"mc2-cnce","title":"UX: Добавить уведомление 'Изменения применены' после applyProposal в чате Stage 5","description":"## Проблема\nКогда пользователь нажимает кнопку 'Принять' для применения предложенных изменений от чата, нет визуального подтверждения, что изменения успешно применены.\n\n## Решение\nДобавить toast-уведомление после успешного вызова applyProposal:\n- Зелёный toast: 'Изменения применены' (или '7 полей обновлено')\n- При ошибке: красный toast с описанием ошибки\n\n## Контекст\nЛоги показывают успешный applyProposal (строки 113-122 в backend log), но UI не информирует пользователя.\n\n## Файлы для изменения\n- packages/web/components/chat/ (компонент принятия предложений)","status":"closed","priority":3,"issue_type":"feature","owner":"[email protected]","created_at":"2026-01-29T12:35:58.173713563+03:00","created_by":"maslennikov-ig","updated_at":"2026-01-29T19:00:55.595827776+03:00","closed_at":"2026-01-29T19:00:55.595827776+03:00","close_reason":"Добавлен inline feedback в историю чата: зелёное сообщение при успехе, красное при ошибке. Type-check пройден.","labels":["frontend","ux"]}
209209
{"id":"mc2-cny2","title":"Fix: Генерация clarifying questions без документов","description":"Когда курс создаётся без файлов, clarifying questions не генерируются.\n\n**Причина:** orchestrator.ts:335 требует budgetAllocation !== null\n\n**Решение:**\n1. phase-0.5-clarifying.ts: сделать budgetAllocation nullable\n2. orchestrator.ts:335: убрать \u0026\u0026 budgetAllocation\n\n**Файлы:**\n- packages/course-gen-platform/src/stages/stage4-analysis/phases/phase-0.5-clarifying.ts\n- packages/course-gen-platform/src/stages/stage4-analysis/orchestrator.ts","status":"closed","priority":2,"issue_type":"bug","owner":"[email protected]","created_at":"2026-01-28T14:15:10.173996445+03:00","created_by":"maslennikov-ig","updated_at":"2026-01-28T14:16:59.816817797+03:00","closed_at":"2026-01-28T14:16:59.816817797+03:00","close_reason":"Исправлено: убрано требование budgetAllocation в условии генерации вопросов","labels":["backend","pipeline"]}
210+
{"id":"mc2-coa3","title":"Переключить Docling MCP на SSE транспорт","description":"Корневая причина падений Docling - Streamable HTTP session management.\nОфициально рекомендуется SSE для Docker.\n\nИзменения:\n1. DOCLING_MCP_URL: /mcp -\u003e /sse \n2. MCP_TRANSPORT: streamable-http -\u003e sse\n3. Nginx уже настроен (proxy_buffering off)\n\nФайлы:\n- docker-compose.production.yml\n- docker-compose.infra.yml \n- docker-compose.dev.yml\n- .env.production.example\n\nСсылки:\n- https://github.com/modelcontextprotocol/python-sdk/issues/880\n- https://github.com/modelcontextprotocol/python-sdk/issues/520","status":"open","priority":1,"issue_type":"task","owner":"[email protected]","created_at":"2026-01-31T15:31:51.710329148+03:00","created_by":"maslennikov-ig","updated_at":"2026-01-31T15:31:51.710329148+03:00","labels":["backend","docling","pipeline"]}
210211
{"id":"mc2-csu","title":"[course-size] Fix cost preview for auto option","description":"When 'auto' course size is selected, cost preview uses hardcoded fallback of 15 lessons. Should use ~30 (midpoint) for better estimate. File: packages/web/components/forms/create-course-form.tsx:108","status":"closed","priority":2,"issue_type":"bug","created_at":"2026-01-14T16:30:34.86704367+03:00","created_by":"maslennikov-ig","updated_at":"2026-01-14T16:34:24.313895929+03:00","closed_at":"2026-01-14T16:34:24.313895929+03:00","close_reason":"Fixed in commit 0afdb0d"}
211212
{"id":"mc2-csxh","title":"P3.3: Унификация i18n (GRAPH_TRANSLATIONS → next-intl)","description":"Миграция 28 файлов с GRAPH_TRANSLATIONS на next-intl. Удаление lib/generation-graph/translations.ts","status":"closed","priority":3,"issue_type":"task","owner":"[email protected]","created_at":"2026-01-25T22:00:28.155262825+03:00","created_by":"maslennikov-ig","updated_at":"2026-01-26T10:33:29.303519033+03:00","closed_at":"2026-01-26T10:33:29.303519033+03:00","close_reason":"P3.3 i18n migration completed: 40+ files migrated from GRAPH_TRANSLATIONS to next-intl, ~500 keys added, legacy files deleted","labels":["frontend","i18n","tech-debt"]}
212213
{"id":"mc2-csxx","title":"Fix: UI fallback для stage_4_clarifying без вопросов","description":"**Проблема**: Когда курс находится в статусе stage_4_clarifying, но clarifying_questions.total === 0 (вопросы не сохранились), UI НЕ показывает clarifying node.\n\n**Root cause** (2 места):\n1. GraphView.tsx:425-435 - clarifyingData = undefined если total === 0\n2. graph-builders.ts:743 - нода создаётся только если clarifyingData \u0026\u0026 total \u003e 0\n\n**Симптом**: Пользователь видит Stage 4 как 'active' без clarifying branch, интерпретирует как 'откат ко второму этапу'.\n\n**Fix 4**: Добавить fallback UI когда status === stage_4_clarifying но clarifyingData пустая. Показать error state с кнопкой retry.\n\n**Файлы**:\n- packages/web/components/generation-graph/hooks/use-graph-data/utils/graph-builders.ts:743\n- packages/web/components/generation-graph/GraphView.tsx:425-435","status":"closed","priority":1,"issue_type":"bug","owner":"[email protected]","created_at":"2026-01-27T09:48:06.255604059+03:00","created_by":"maslennikov-ig","updated_at":"2026-01-27T09:54:14.18669141+03:00","closed_at":"2026-01-27T09:54:14.18669141+03:00","close_reason":"Fix 4 implemented: UI fallback for stage_4_clarifying. Commit e5f952c1"}

‎.env.production.example‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ REDIS_PASSWORD=
3737
# DOCLING MCP CONFIGURATION
3838
# ===========================================
3939
# URL for Docling MCP document processing service
40-
DOCLING_MCP_URL=http://docling-mcp:8000/mcp
40+
DOCLING_MCP_URL=http://docling-mcp:8000/sse
4141

4242
# ===========================================
4343
# LLM API KEYS

‎.github/workflows/ci-cd.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ jobs:
602602
NEXT_PUBLIC_SITE_URL=https://ai.megacampus.ru
603603
NEXT_PUBLIC_APP_URL=https://ai.megacampus.ru
604604
CORS_ORIGIN=https://ai.megacampus.ru,https://megacampus.ai
605-
DOCLING_MCP_URL=http://docling-mcp:8000/mcp
605+
DOCLING_MCP_URL=http://docling-mcp:8000/sse
606606
COURSEGEN_BACKEND_URL=http://api:4000
607607
NEXT_PUBLIC_COURSEGEN_BACKEND_URL=/api
608608
NEXT_TELEMETRY_DISABLED=1
@@ -747,7 +747,7 @@ jobs:
747747
NEXT_PUBLIC_SITE_URL=https://dev.ai.megacampus.ru
748748
NEXT_PUBLIC_APP_URL=https://dev.ai.megacampus.ru
749749
CORS_ORIGIN=https://dev.ai.megacampus.ru,https://ai.megacampus.ru
750-
DOCLING_MCP_URL=http://megacampus-docling-mcp:8000/mcp
750+
DOCLING_MCP_URL=http://megacampus-docling-mcp:8000/sse
751751
COURSEGEN_BACKEND_URL=http://megacampus-api-dev:4000
752752
NEXT_PUBLIC_COURSEGEN_BACKEND_URL=/api
753753
NEXT_TELEMETRY_DISABLED=1

‎docker-compose.app.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ services:
5959
- NODE_ENV=production
6060
- PORT=4000
6161
- REDIS_URL=redis://megacampus-redis:6379
62-
- DOCLING_MCP_URL=http://megacampus-docling-mcp:8000/mcp
62+
- DOCLING_MCP_URL=http://megacampus-docling-mcp:8000/sse
6363
volumes:
6464
- ./data/uploads:/app/uploads
6565
healthcheck:

‎docker-compose.dev.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ services:
5959
- NODE_ENV=production
6060
- PORT=4000
6161
- REDIS_URL=redis://megacampus-redis:6379
62-
- DOCLING_MCP_URL=http://megacampus-docling-mcp:8000/mcp
62+
- DOCLING_MCP_URL=http://megacampus-docling-mcp:8000/sse
6363
# Fix file path for document processing (override .env from image)
6464
- DOCLING_UPLOADS_BASE_PATH=/app
6565
- DOCLING_CONTAINER_UPLOADS_PATH=/app/uploads-dev
@@ -107,7 +107,7 @@ services:
107107
environment:
108108
- NODE_ENV=production
109109
- REDIS_URL=redis://megacampus-redis:6379
110-
- DOCLING_MCP_URL=http://megacampus-docling-mcp:8000/mcp
110+
- DOCLING_MCP_URL=http://megacampus-docling-mcp:8000/sse
111111
- DOCLING_CACHE_PATH=/app/docling-cache
112112
- LKG_CONFIG_PATH=/app/data/lkg-config.json
113113
# Fix file path for document processing (override .env from image)

‎docker-compose.infra.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ services:
5454
- DOCLING_CACHE_DIR=/app/cache
5555
- DOCLING_MODELS_PATH=/app/models
5656
- DOCLING_LOG_LEVEL=INFO
57-
- MCP_TRANSPORT=streamable-http
57+
- MCP_TRANSPORT=sse
5858
- MCP_HOST=0.0.0.0
5959
- MCP_PORT=8000
6060
- PYTHONUNBUFFERED=1
@@ -119,7 +119,7 @@ services:
119119
environment:
120120
- NODE_ENV=production
121121
- REDIS_URL=redis://megacampus-redis:6379
122-
- DOCLING_MCP_URL=http://docling-mcp:8000/mcp
122+
- DOCLING_MCP_URL=http://docling-mcp:8000/sse
123123
# Path to shared docling JSON cache
124124
- DOCLING_CACHE_PATH=/app/docling-cache
125125
# LKG config persistence

‎docker-compose.production.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ services:
5757
- DOCLING_CACHE_DIR=/app/cache
5858
- DOCLING_MODELS_PATH=/app/models
5959
- DOCLING_LOG_LEVEL=INFO
60-
- MCP_TRANSPORT=streamable-http
60+
- MCP_TRANSPORT=sse
6161
- MCP_HOST=0.0.0.0
6262
- MCP_PORT=8000
6363
- PYTHONUNBUFFERED=1
@@ -167,7 +167,7 @@ services:
167167
- NODE_ENV=production
168168
- PORT=4000
169169
- REDIS_URL=redis://megacampus-redis:6379
170-
- DOCLING_MCP_URL=http://docling-mcp:8000/mcp
170+
- DOCLING_MCP_URL=http://docling-mcp:8000/sse
171171
# Fix file path for document processing (override .env from image)
172172
- DOCLING_UPLOADS_BASE_PATH=/app
173173
volumes:
@@ -216,7 +216,7 @@ services:
216216
environment:
217217
- NODE_ENV=production
218218
- REDIS_URL=redis://megacampus-redis:6379
219-
- DOCLING_MCP_URL=http://docling-mcp:8000/mcp
219+
- DOCLING_MCP_URL=http://docling-mcp:8000/sse
220220
# Path to shared docling JSON cache
221221
- DOCLING_CACHE_PATH=/app/docling-cache
222222
# LKG config persistence

‎packages/course-gen-platform/.env.example‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ JWT_SECRET=your-jwt-secret-here
4949
ENCRYPTION_KEY=your-64-character-hex-encryption-key-here
5050

5151
# Docling MCP Server Configuration
52-
DOCLING_MCP_URL=http://docling-mcp:8000/mcp
52+
DOCLING_MCP_URL=http://docling-mcp:8000/sse
5353
DOCLING_MCP_TIMEOUT=300000
5454

5555
# Web Push Notifications (VAPID keys)

0 commit comments

Comments
 (0)