feat(tools): n8n caveauDbnAgent starter workflow + import guide

Clonable AI Agent workflow driving the DBN legal tools over one MCP Client
Tool node (dynamic catalog, 23 dbn.* tools). Chat Model + Bearer creds are
placeholders Dave wires post-import — no cloud spend baked in.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 15:10:30 +02:00
parent 2f05b84b0f
commit 198f0526cf
2 changed files with 169 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
# caveauDbnAgent — n8n starter workflow
A clonable n8n agent that drives the Do Better Norge legal tools over MCP. One
**MCP Client Tool** node connects to the DBN bridge and enumerates the **whole**
catalog automatically (currently **23** `dbn.*` tools) — the catalog is dynamic
(`includes/DbnMcpRuntime.php::tools()`), so new tools appear without editing this
workflow.
## What's in `caveauDbnAgent.json`
```
When chat message received ─▶ DBN Agent (AI Agent)
├─ ai_languageModel ◀─ Chat Model (placeholder)
└─ ai_tool ◀─ DBN MCP Tools
```
- **DBN Agent** — system prompt steers the default chain
`dbn.search_legal → dbn.legal_analysis → dbn.korrespond` and enforces the
process-and-forget privacy rule (never auto-saves; suggests `dbn.redact`).
- **DBN MCP Tools** — MCP Client Tool node, `httpStreamable` transport,
`https://mcp.dobetternorge.no/mcp`, Bearer auth, `include: all`.
- **Chat Model** — a placeholder `lmChatOpenAi` node. **No cloud spend is wired
by the template** — you attach your own credential.
## Import + wire it up (Dave's step — no n8n API access from here)
1. **n8n → Workflows → Import from File** → pick `caveauDbnAgent.json`.
2. **Mint a DBN MCP token**: log in at <https://tools.dobetternorge.no/mcp.php>,
create a user token (looks like `dbn_user_mcp_...`). Copy it once.
3. **DBN MCP Tools node → Credential → Bearer Auth**: paste the token as the
bearer value. (The node sends `Authorization: Bearer dbn_user_mcp_...`.)
4. **Chat Model node → Credential**: attach your existing OpenAI-compatible
credential — e.g. the colin LiteLLM proxy (`http://10.0.1.10:4000`, base-URL
override on an OpenAI cred) or Azure OpenAI. Set the model to one your key can
serve (e.g. `gpt-4o`).
5. **Open the chat** (the trigger node's built-in chat) and ask, e.g.:
*"Min sønn ble akuttplassert av barnevernet. Hva er fristene og hvilke
rettigheter har jeg?"* The agent should call `dbn.search_legal` /
`dbn.legal_analysis` and answer with cited sources.
## Notes
- The DBN tools require an active DBN member session behind the token; the token
carries the user/tenant + scopes. Keep the token secret (vault it; don't commit).
- If the MCP node lists zero tools, re-check the bearer token and that the bridge
(`mcp.dobetternorge.no`, caveau-mcp container `dobetternorge-mcp:3002` on colin)
is up.
- This starter matches the live catalog as of 2026-06-21. Re-export from n8n if
you customize it so the repo copy stays current.
+120
View File
@@ -0,0 +1,120 @@
{
"name": "caveauDbnAgent",
"nodes": [
{
"parameters": {
"options": {}
},
"id": "a1b2c3d4-0001-4a01-8a01-000000000001",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"typeVersion": 1.1,
"position": [
-260,
0
],
"webhookId": "caveau-dbn-agent-chat"
},
{
"parameters": {
"options": {
"systemMessage": "You are caveauDbnAgent, a Norwegian family-law preparation assistant. You answer using ONLY the Do Better Norge (DBN) legal tools exposed over MCP — never invent statutes, case numbers, or citations.\n\nTOOLS: a single MCP connection exposes the full DBN catalog (dbn.search_legal, dbn.corpus_search, dbn.ask, dbn.list_personas, dbn.summarize, dbn.timeline, dbn.redact, dbn.translate, dbn.legal_analysis, dbn.korrespond, dbn.korrespond_refine, dbn.barnevernet_analyze, dbn.advocate_brief, dbn.deep_research, dbn.discrepancy_find, dbn.transcribe_audio, dbn.extract_text, dbn.corpus_stats, dbn.list_documents, dbn.get_document, dbn.citation_graph, dbn.case_workbench_plan, dbn.save_to_case).\n\nDEFAULT CHAIN: for a typical case-prep request, (1) call dbn.search_legal to ground yourself in the corpus, (2) call dbn.legal_analysis on the user's document or question, then (3) call dbn.korrespond to draft any letter to a Norwegian authority. Pick a persona with the `profile` argument (family, child-welfare, immigration, labour, consumer-tenancy, general) — default family. Call dbn.list_personas if unsure.\n\nPRIVACY: the DBN tools are process-and-forget. Do NOT call dbn.save_to_case unless the user explicitly asks to save a result. Suggest dbn.redact before sharing anything containing names or IDs.\n\nAlways cite the sources the tools return. If a tool returns no grounded sources, say so plainly rather than guessing."
}
},
"id": "a1b2c3d4-0002-4a01-8a01-000000000002",
"name": "DBN Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.7,
"position": [
0,
0
]
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o"
},
"options": {}
},
"id": "a1b2c3d4-0003-4a01-8a01-000000000003",
"name": "Chat Model (wire your LiteLLM/Azure cred)",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
-120,
220
],
"notes": "Placeholder. Attach your existing OpenAI-compatible credential (e.g. colin LiteLLM at :4000, or Azure OpenAI). No new cloud spend is wired by this template."
},
{
"parameters": {
"endpointUrl": "https://mcp.dobetternorge.no/mcp",
"serverTransport": "httpStreamable",
"authentication": "bearerAuth",
"include": "all"
},
"id": "a1b2c3d4-0004-4a01-8a01-000000000004",
"name": "DBN MCP Tools",
"type": "@n8n/n8n-nodes-langchain.mcpClientTool",
"typeVersion": 1,
"position": [
180,
220
],
"notes": "Bearer credential = a DBN user MCP token (dbn_user_mcp_...) minted at https://tools.dobetternorge.no/mcp.php. The catalog is dynamic — this one node enumerates all 23 dbn.* tools."
}
],
"connections": {
"When chat message received": {
"main": [
[
{
"node": "DBN Agent",
"type": "main",
"index": 0
}
]
]
},
"Chat Model (wire your LiteLLM/Azure cred)": {
"ai_languageModel": [
[
{
"node": "DBN Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"DBN MCP Tools": {
"ai_tool": [
[
{
"node": "DBN Agent",
"type": "ai_tool",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"pinData": {},
"meta": {
"templateId": "caveau-dbn-agent-starter"
},
"tags": [
{
"name": "caveauAI"
},
{
"name": "dbn"
}
]
}