Skip to main content

NeuroDock guardrail MCP server — rumination, hyperfocus, and sycophancy detection.

Project description

neurodock-mcp-guardrail

Clinical guardrails MCP server for NeuroDock. Detects three patterns that unmodified LLM interaction tends to amplify for neurodivergent users: rumination loops (OCD), unregulated hyperfocus (ADHD), and sycophancy / over-validation. See ETHICS.md and MANIFESTO.md for the full framework.

Status

  • v0.0.2: All three detectors are live.

    • check_rumination — word-overlap Jaccard heuristic.
    • check_hyperfocus — elapsed-threshold-with-end-of-day heuristic.
    • check_sycophancy — four-pattern overlap heuristic.

    Heuristics are public and auditable; thresholds are defaults, not prescriptions. See ADR 0006 for the rationale.

Tools

Tool Status Heuristic Default thresholds
check_rumination live (v0.0.1) word_overlap_jaccard window 90 min, count 3, similarity 0.55
check_hyperfocus live (v0.0.2) elapsed_threshold_with_eod 60 / 90 / 120 minutes
check_sycophancy live (v0.0.2) pattern overlap (4 patterns) similarity 0.5

Design invariants

  • Stateless. The server persists nothing — no SQLite, no JSONL, no in-memory caches that survive a call. Callers supply all history.
  • No telemetry, no network sockets. Per ETHICS.md commitment 4.
  • No user content in logs. Only tool_invoked metadata is logged.
  • Override-token vocabulary is closed at v0.1.0. New tokens require a minor bump and sign-off per ADR 0006 §3 and §10.
  • Heuristics are auditable. Source for each heuristic lives in src/neurodock_mcp_guardrail/heuristics/. Changes there require sign-off per ETHICS.md commitment 3.

Usage

# Run the server over stdio (via the console script):
neurodock-mcp-guardrail

# Or smoke-test the build directly:
python -c "from neurodock_mcp_guardrail import server; print(server.app.name)"

Tests

uv run pytest packages/mcp-guardrail/tests/ -v

Tests cover:

  • The Jaccard heuristic (identical, disjoint, stopword-only, paraphrase, case-insensitivity, punctuation handling).
  • The check_rumination tool (empty history, in-window detection, out-of-window non-detection, threshold honour, override-token contract, history-ordering rejection, false-positive-feedback path).
  • check_hyperfocus (escalation level mapping, end-of-day strictness, idle-signal handling, override-token contract, schema conformance).
  • check_sycophancy (each of the four patterns, counter-prompt generation, override-token contract, schema conformance).
  • Protocol conformance: every tool response is validated against the schema files in schemas/.

License

AGPL-3.0-or-later.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neurodock_mcp_guardrail-0.0.3.tar.gz (34.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neurodock_mcp_guardrail-0.0.3-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file neurodock_mcp_guardrail-0.0.3.tar.gz.

File metadata

  • Download URL: neurodock_mcp_guardrail-0.0.3.tar.gz
  • Upload date:
  • Size: 34.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for neurodock_mcp_guardrail-0.0.3.tar.gz
Algorithm Hash digest
SHA256 237ed37857e00ec5fe51a259278c0f3da9fceb096459da13f6119babc11caa78
MD5 18b58a489482cd91e7a3ac5dc9f4f67d
BLAKE2b-256 0e6745255a563f2083ab64c842d50e505e94a5d20df537d4535c3b12b3820000

See more details on using hashes here.

File details

Details for the file neurodock_mcp_guardrail-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: neurodock_mcp_guardrail-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for neurodock_mcp_guardrail-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0e730bd66abe5a2d294249daa0e9626def43f37d03c9d16c9b02ad09e0e4c667
MD5 97875acfa0a014371db85848d130dcc8
BLAKE2b-256 75480a657dd1a94ea3b1ddbd8e36980c53dd4e14bda2a375d05bd6072caa0509

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page