feat(digest): digest hebdo vers ObsiGate via MCP, sur approbation (issue #13)

app/digest.py: format markdown (journal 7 j + focus), client MCP
(initialize/tools/list/tools/call, réponses JSON ou SSE), gabarit
d'arguments JSON configurable, webhook générique. Page /digest:
statut, sonde des outils, envoi en un clic. Planificateur: compose
+ notifie (kv digest_pending), ne livre JAMAIS seul.
This commit is contained in:
Spark
2026-10-11 12:46:54 -04:00
parent 0417d0593f
commit 6e71b87d09
3 changed files with 315 additions and 1 deletions
+35 -1
View File
@@ -51,6 +51,23 @@ Environment variables:
an issue in KANBANTE_CAPTURE_REPO.
Uses KANBANTE_NTFY_URL/_TOKEN as the
server. Empty (default) = no listener.
KANBANTE_DIGEST_TIME "HH:MM" at which the weekly digest is
composed (and ntfy-notified) on
KANBANTE_DIGEST_WEEKDAY. The digest is
NEVER auto-delivered: it waits for a
one-click approval on /digest.
KANBANTE_DIGEST_WEEKDAY 0 = Monday … 6 = Sunday (default 0).
KANBANTE_DIGEST_WEBHOOK_URL Generic webhook receiving the digest
as JSON {title, markdown, week}.
KANBANTE_OBSIGATE_MCP_URL URL of ObsiGate's MCP endpoint; the
digest is delivered by calling a
note-creation tool on it (client MCP).
KANBANTE_OBSIGATE_MCP_TOKEN Optional Bearer token for that MCP.
KANBANTE_OBSIGATE_MCP_TOOL Name of the ObsiGate tool to call
(see /digest for the live tool list).
KANBANTE_OBSIGATE_MCP_ARGS JSON argument template for the tool;
"{title}" and "{content}" placeholders
are substituted (JSON-escaped).
"""
import os
@@ -59,7 +76,7 @@ from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
APP_VERSION = "0.7.0"
APP_VERSION = "0.8.0"
def _env_bool(name: str, default: bool) -> bool:
@@ -118,6 +135,13 @@ class Settings:
capture_repo: str = ""
capture_token: str = ""
capture_ntfy_topic: str = ""
digest_time: str = ""
digest_weekday: int = 0
digest_webhook_url: str = ""
obsigate_mcp_url: str = ""
obsigate_mcp_token: str = ""
obsigate_mcp_tool: str = ""
obsigate_mcp_args: str = '{"title": "{title}", "content": "{content}"}'
@property
def auth_enabled(self) -> bool:
@@ -150,4 +174,14 @@ def get_settings() -> Settings:
capture_repo=os.getenv("KANBANTE_CAPTURE_REPO", ""),
capture_token=os.getenv("KANBANTE_CAPTURE_TOKEN", ""),
capture_ntfy_topic=os.getenv("KANBANTE_CAPTURE_NTFY_TOPIC", ""),
digest_time=os.getenv("KANBANTE_DIGEST_TIME", ""),
digest_weekday=_env_int("KANBANTE_DIGEST_WEEKDAY", 0),
digest_webhook_url=os.getenv("KANBANTE_DIGEST_WEBHOOK_URL", ""),
obsigate_mcp_url=os.getenv("KANBANTE_OBSIGATE_MCP_URL", ""),
obsigate_mcp_token=os.getenv("KANBANTE_OBSIGATE_MCP_TOKEN", ""),
obsigate_mcp_tool=os.getenv("KANBANTE_OBSIGATE_MCP_TOOL", ""),
obsigate_mcp_args=os.getenv(
"KANBANTE_OBSIGATE_MCP_ARGS",
'{"title": "{title}", "content": "{content}"}',
),
)