feat(mcp): ready for a remote server: quiet logs and allowed domains
- Logs default to warnings and errors (MCP_LOG_LEVEL): the library logged every tool on every request (~48 lines per call). - DNS rebinding protection on /mcp, as the MCP spec asks of HTTP servers: the Host header must be in MCP_ALLOWED_HOSTS (default: localhost; compose default mcp.taskstream.pireon.dev,localhost) and a browser Origin, when present, too; otherwise 403 with a JSON-RPC error. Uses the official validators from @modelcontextprotocol/server. - Test for allowed/foreign Host and Origin; .env.example, compose and docs/09-mcp.md document the variables; Word/PDF regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -39,3 +39,11 @@ OPENAPI_FILE=apps/api/openapi.json
|
||||
# Docker builds only: token of Pireon's Nexus for @pi/ui (build secret, never stored in an image).
|
||||
# Locally: export NEXUS_TOKEN=$(grep '^//nexus.pireon.dev/repository/npm-releases/:_authToken=' ~/.npmrc | cut -d= -f2-)
|
||||
NEXUS_TOKEN=
|
||||
|
||||
# MCP server (apps/mcp, docs/09-mcp.md). Port: not PORT, which is the API's.
|
||||
MCP_PORT=3010
|
||||
TASKSTREAM_API_URL=http://localhost:3000
|
||||
# Domains it answers on, comma-separated (DNS rebinding protection). Empty: localhost only.
|
||||
MCP_ALLOWED_HOSTS=
|
||||
# error | warn | log | debug | verbose (warn: the library logs every tool on every call otherwise)
|
||||
MCP_LOG_LEVEL=warn
|
||||
|
||||
Reference in New Issue
Block a user