tane-mcp
Officialby tane-sec
README.md
# TANE Protocol (`tane-protocol`)
**TANE** (種 / Seed) is a zero-dependency constitutional kernel, physical MCP execution gate, and event-driven immune layer for autonomous AI coding agents.
For a human, TANE is a small boundary around untrusted web pages, mail, CSV files, and pull-request diffs. For an agent, calls that pass through `mcp/tane_mcp.py` are scanned and held for approval before a gated write, so a contaminated source is less likely to become an unintended edit. `llms.txt` is a short map of the same facts for agents and crawlers.
It separates **what must never change** (human primacy, reversibility, and explicit approval gates) from **what should continuously improve** (acquired defensive rules and operational lessons), aligned with **AAIF** (`AGENTS.md` / `SKILL.md` / `MCP` / `A2A`) and **OWASP Top 10 for Agentic Applications (`ASI01`–`ASI10`)**.
`AGENTS.md` is the single source of truth. `CLAUDE.md` and `.github/copilot-instructions.md` mirror its marker block. `.cursor/rules/tane.mdc` is an always-on Layer 1–2 projection; the antibody registry stays in `AGENTS.md` Section 3.3.
Requires Python 3.10 or newer.
---
## Why TANE?
- **Locked Core (Layer 1):** `python scripts/tane.py verify` checks one SHA-256 across `AGENTS.md`, `.cursor/rules/tane.mdc`, `CLAUDE.md`, and `.github/copilot-instructions.md`. A missing copy is a failure. Pull requests that change the Layer 1 block or `EXPECTED_LAYER1_HASH` fail CI.
- **Physical Gate (Layer 2):** `mcp/tane_mcp.py` (Python standard library only) strips invisible Unicode, scans indirect prompt injection, counts `WRITTEN` records in `.tane_audit.jsonl`, and continues the hash chain across process restarts.
- **Human-Approved Lessons (Layer 3):** `.agents/skills/tane-guard/SKILL.md` stays idle during routine work. New rules are appended to `AGENTS.md` Section 3.3 only after an explicit human yes, then `python scripts/tane.py sync`.
- **Portable Export (Layer 4):** `python scripts/tane.py export` writes `tane-antibodies.json` and `data/tane-antibodies.jsonl` with no timestamp, so unchanged rules produce an empty diff.
---
## Quick Start
### 1. Use as a GitHub Template
```bash
git clone https://github.com/tane-sec/tane.git
cd tane
python scripts/tane.py verify
```
### 2. Verify, sync, and run the starter checks
```bash
python scripts/tane.py verify
python scripts/tane.py sync
python scripts/tane.py export
python -m unittest discover -s tests -v
python examples/safe_fetch_pipeline.py --sample
```
### 3. Enable the physical MCP gate
`.cursor/mcp.json` launches `python mcp/tane_mcp.py` over stdio. Reload MCP tools to expose:
- `tane_read_untrusted` — strips invisible Unicode and flags injection text. The body stays observational data.
- `tane_safe_write` — blocks protected paths. Overwrites and writes past the persistent cap require a human summary of at least 15 characters, or the value of `TANE_APPROVAL_SECRET` when that variable is set.
- `tane_safe_delete` — does not delete. It stops and asks a human to act.
The server anchors its workspace by walking parent directories until it finds `AGENTS.md` or `.git`.
### 4. Install into an existing repository
```bash
python scripts/tane.py install --target /path/to/your-repo
```
This updates the `AGENTS.md` marker block, copies the CLI, MCP server, skill, integrity workflow, `LICENSE`, and `DATA_LICENSE.md`, merges a `tane-mcp` entry into an existing `.cursor/mcp.json` without removing other servers, runs `sync`, and writes `tane-antibodies.json` plus `data/tane-antibodies.jsonl`. The copied workflow runs the unit tests and the sample pipeline only when `tests/` and `examples/` exist. In the target repository:
```bash
python scripts/tane.py verify
```
### 5. Scan, consult, and snippet
```bash
python scripts/tane.py scan path/to/untrusted.csv
python scripts/tane.py scan https://example.com/feed.csv
python scripts/tane.py consult "overwrite config file using another tool"
python scripts/tane.py snippet
```
`scan` exits `1` when it finds invisible Unicode or an indirect prompt-injection pattern, and tells you to treat the text under `AGENTS.md`. A clean target exits `0`. `consult` prints matching `owasp_category` and `defensive_rule` lines from `data/tane-antibodies.jsonl` (or from `AGENTS.md` when that file is absent). `snippet` prints the Layer 1–2 reference block for pasting into another project or agent session.
### 6. Badge
```markdown
[](https://github.com/tane-sec/tane)
```
Official account: [x.com/tane_sec](https://x.com/tane_sec)
Vulnerability reports and funding rules are in `SECURITY.md`.
### 7. Protect `main` after publication
The integrity workflow compares Layer 1 with history only on pull requests. A direct push can change the Layer 1 text and `EXPECTED_LAYER1_HASH` together. After the repository is public:
1. Open GitHub → Settings → Rules → Rulesets (or Branches → Add branch protection rule).
2. Limit the rule to `main`.
3. Block direct pushes. Require a pull request before merging.
4. Require the status check for the `verify-tane` job to pass.
5. Do not allow administrators to bypass the rule.
---
## Repository Structure
```text
.
├── AGENTS.md # Canonical 4-layer protocol
├── CLAUDE.md # Synced projection
├── DATA_LICENSE.md # CC BY-SA 4.0 for rules, skills, datasets
├── LICENSE # MIT for executable code
├── llms.txt # Low-token map for agents and crawlers
├── tane-antibodies.json # Deterministic CC BY-SA export
├── data/tane-antibodies.jsonl # Deterministic JSONL export
├── .cursor/rules/tane.mdc # Always-on Layer 1–2 projection plus Cursor front matter
├── .cursor/mcp.json # stdio MCP launch config
├── .github/copilot-instructions.md # Synced projection
├── .github/workflows/tane-integrity.yml # verify, clean sync/export, PR hash guard, tests
├── .github/pull_request_template.md
├── .agents/skills/tane-guard/SKILL.md
├── mcp/tane_mcp.py
├── scripts/tane.py # verify, sync, export, stage, install, scan, consult, snippet
├── examples/safe_fetch_pipeline.py
└── tests/test_tane_redteam.py
```
---
## Antibody dataset
The committed exports are `tane-antibodies.json` and `data/tane-antibodies.jsonl` (CC BY-SA 4.0). The same records are published for evaluation and benchmarks at <https://huggingface.co/datasets/tane-sec/tane-antibodies>. Loading them with the Hugging Face `datasets` package is optional and is not part of TANE's zero-dependency runtime:
```python
from datasets import load_dataset
ds = load_dataset("tane-sec/tane-antibodies", split="train")
```
---
## Licenses
- **MIT** (`LICENSE`): code under `scripts/`, `mcp/`, `examples/`, `tests/`, and `.github/` automation.
- **CC BY-SA 4.0** (`DATA_LICENSE.md`): `AGENTS.md` and its synced copies, the skill, and the antibody datasets (`tane-antibodies.json`, `data/`).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues