oct
Loading...
Searching...
No Matches
__init__.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3# oct/mcp/__init__.py
4
5"""
6Purpose
7-------
8``oct.mcp`` - Secure MCP server package for Option C Tools.
9
10This package implements the six-layer pipeline described in the
11Secure MCP Architecture Blueprint (Phase 5A read-only tools +
12Phase 5B write tools with HITL consent):
13
14 Layer 1 - Gateway (workspace binding, rate limiting)
15 Layer 2 - Input Validator (Pydantic models, path containment)
16 Layer 2.5 - Safety Gate (HITL consent + dry-run enforcement, Phase 5B)
17 Layer 3 - Policy Engine (tool allowlist, profile enforcement)
18 Layer 4 - Execution Sandbox (env sanitisation, subprocess isolation)
19 Layer 5 - Output Redactor (secret patterns, path anonymisation)
20 Layer 6 - Audit Logger (JSONL at ~/.oct-mcp/audit.log)
21
22Entry point: ``python -m oct.mcp [--project-root PATH] [--profile PROFILE]``
23
24Responsibilities
25----------------
26- Re-export the config and safety-gate entry points the server and its
27 callers consume.
28- Keep the layer ordering above authoritative: every tool call traverses
29 them in sequence.
30
31Diagnostics
32-----------
33Domain: MCP
34Levels:
35 L2 - (none) the package root re-exports only; each layer reports itself
36 L3 - (none) see oct.mcp.policy, oct.mcp.safety and oct.mcp.audit
37 L4 - (none)
38
39Contracts
40---------
41- The package root holds no pipeline logic; each layer lives in its own
42 module and is imported explicitly.
43- ``__all__`` is the supported surface; anything else is internal.
44
45Dependencies
46------------
47- oct.core.diagnostics (_dbg structured logger, imported but never called at package import)
48- oct.mcp.config (McpConfig and load_config, re-exported)
49- oct.mcp.safety (SafetyGate and SafetyDecision, re-exported)
50"""
51
52from oct.mcp.config import McpConfig, load_config
53from oct.mcp.safety import SafetyGate, SafetyDecision
54# OCT-LINT: disable-file=dbg_usage reason="Plan 263: a re-export package root with no function or method, so any _dbg call here would run before oc_diagnostics.init() and add a RuntimeWarning to every oct invocation"
55from oct.core.diagnostics import _dbg
56
57__all__ = ["McpConfig", "load_config", "SafetyGate", "SafetyDecision"]