Repository navigation
Expand file tree
/
Copy pathdocker-compose.snippet.yml
More file actions
71 lines (70 loc) · 3.11 KB
/
Copy pathdocker-compose.snippet.yml
File metadata and controls
71 lines (70 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Service definition for the Trilium Notecast MCP server.
#
# This is a *snippet*, not a standalone stack: it is meant to be pasted, under
# `services:`, into the compose file the server already runs.
# Paste it into the stack that runs Trilium: on a shared network the server
# reaches Trilium under its service name.
#
# The image is built by `deploy.sh` through a remote Docker context — there is
# deliberately no `build:` key, so the server needs no source checkout. It is
# therefore local-only, which is what `pull_policy: never` below is for.
#
# Adjust: the published port, the hostnames in MCP_ALLOWED_HOSTS /
# MCP_ALLOWED_ORIGINS, the Trilium service name in TRILIUM_URL, and the network name at the bottom — `web` has to
# be one the target compose file already declares. Drop the `networks:` key
# entirely if the stack uses only its implicit default network.
trilium-notecast-mcp:
image: trilium-notecast-mcp:local
# The image lives only in this daemon's local store — no registry holds it.
# Without `pull_policy: never`, `docker compose pull` fails on this service
# ("pull access denied") and aborts the pull for the whole stack.
pull_policy: never
container_name: trilium-notecast-mcp
# The image defines its own HEALTHCHECK against /healthz, which compose
# inherits — so `restart: always` also recovers a server that is up but no
# longer answering. Nothing to declare here.
restart: always
# No `depends_on:` on purpose. This server touches Trilium on the first tool
# call, not at startup, so ordering the start buys nothing — and `docker
# compose up -d trilium-notecast-mcp` would pull Trilium up with it and
# recreate it if its configuration drifted, which once carried Trilium across
# an unrequested database migration. deploy.sh passes --no-deps for the same
# reason.
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
reservations:
memory: 64M
cpus: '0.1'
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
read_only: true
tmpfs:
- /tmp:noexec,nosuid,nodev
ports:
# Localhost only — exposed to the outside by a TLS reverse proxy.
- "127.0.0.1:9151:8000"
env_file:
- ./.env.trilium-notecast-mcp
environment:
# Trilium reached over the shared compose network, not via the host. The
# network at the bottom must be the one Trilium is on, or the name does
# not resolve.
- TRILIUM_URL=http://triliumnext:8080
- MCP_TRANSPORT=streamable-http
- MCP_HOST=0.0.0.0
- MCP_PORT=8000
# Path the reverse proxy mounts the server under. Named after the service
# so a generic /mcp stays free for other MCP servers on the same host.
- MCP_PATH=/trilium-notecast-mcp
- TZ=Europe/Berlin
# The SDK's DNS-rebinding protection checks the Host header, so the
# hostname the reverse proxy serves under must be listed here.
- MCP_ALLOWED_HOSTS=your-host.example.net,127.0.0.1:9151,localhost:9151
- MCP_ALLOWED_ORIGINS=https://your-host.example.net
networks:
- web