cloudmorph-tessera 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. cloudmorph_tessera-0.1.1/LICENSE +202 -0
  2. cloudmorph_tessera-0.1.1/PKG-INFO +307 -0
  3. cloudmorph_tessera-0.1.1/README.md +248 -0
  4. cloudmorph_tessera-0.1.1/cloudmorph_tessera.egg-info/PKG-INFO +307 -0
  5. cloudmorph_tessera-0.1.1/cloudmorph_tessera.egg-info/SOURCES.txt +39 -0
  6. cloudmorph_tessera-0.1.1/cloudmorph_tessera.egg-info/dependency_links.txt +1 -0
  7. cloudmorph_tessera-0.1.1/cloudmorph_tessera.egg-info/entry_points.txt +2 -0
  8. cloudmorph_tessera-0.1.1/cloudmorph_tessera.egg-info/requires.txt +34 -0
  9. cloudmorph_tessera-0.1.1/cloudmorph_tessera.egg-info/top_level.txt +1 -0
  10. cloudmorph_tessera-0.1.1/pyproject.toml +178 -0
  11. cloudmorph_tessera-0.1.1/setup.cfg +4 -0
  12. cloudmorph_tessera-0.1.1/tessera/__init__.py +6 -0
  13. cloudmorph_tessera-0.1.1/tessera/audit/__init__.py +19 -0
  14. cloudmorph_tessera-0.1.1/tessera/audit/canonical_json.py +71 -0
  15. cloudmorph_tessera-0.1.1/tessera/audit/chain.py +91 -0
  16. cloudmorph_tessera-0.1.1/tessera/audit/emitter.py +138 -0
  17. cloudmorph_tessera-0.1.1/tessera/audit/sinks/__init__.py +1 -0
  18. cloudmorph_tessera-0.1.1/tessera/audit/sinks/base.py +16 -0
  19. cloudmorph_tessera-0.1.1/tessera/audit/sinks/buffered.py +124 -0
  20. cloudmorph_tessera-0.1.1/tessera/audit/sinks/sqlite.py +124 -0
  21. cloudmorph_tessera-0.1.1/tessera/audit/sinks/stdout.py +37 -0
  22. cloudmorph_tessera-0.1.1/tessera/audit/verifier.py +86 -0
  23. cloudmorph_tessera-0.1.1/tessera/auth/__init__.py +1 -0
  24. cloudmorph_tessera-0.1.1/tessera/auth/base.py +22 -0
  25. cloudmorph_tessera-0.1.1/tessera/auth/bearer.py +218 -0
  26. cloudmorph_tessera-0.1.1/tessera/cli.py +557 -0
  27. cloudmorph_tessera-0.1.1/tessera/config.py +239 -0
  28. cloudmorph_tessera-0.1.1/tessera/errors.py +32 -0
  29. cloudmorph_tessera-0.1.1/tessera/integrations/__init__.py +0 -0
  30. cloudmorph_tessera-0.1.1/tessera/integrations/cursor_hooks.py +131 -0
  31. cloudmorph_tessera-0.1.1/tessera/intent.py +57 -0
  32. cloudmorph_tessera-0.1.1/tessera/pluggable.py +29 -0
  33. cloudmorph_tessera-0.1.1/tessera/policy/__init__.py +7 -0
  34. cloudmorph_tessera-0.1.1/tessera/policy/action_verbs.py +207 -0
  35. cloudmorph_tessera-0.1.1/tessera/policy/conditions.py +252 -0
  36. cloudmorph_tessera-0.1.1/tessera/policy/engine.py +72 -0
  37. cloudmorph_tessera-0.1.1/tessera/policy/loader.py +235 -0
  38. cloudmorph_tessera-0.1.1/tessera/policy/matchers.py +46 -0
  39. cloudmorph_tessera-0.1.1/tessera/policy/regex_safety.py +54 -0
  40. cloudmorph_tessera-0.1.1/tessera/policy/schema.py +191 -0
  41. cloudmorph_tessera-0.1.1/tessera/proxy.py +792 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 CloudMorph AI, Inc.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,307 @@
1
+ Metadata-Version: 2.4
2
+ Name: cloudmorph-tessera
3
+ Version: 0.1.1
4
+ Summary: The open-source MCP firewall for AI agents
5
+ Author-email: CloudMorph AI <oss@cloudmorph.io>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/CloudMorphAI/cloudmorph-tessera
8
+ Project-URL: Repository, https://github.com/CloudMorphAI/cloudmorph-tessera
9
+ Project-URL: Documentation, https://cloudmorph.ai/docs
10
+ Project-URL: Changelog, https://github.com/CloudMorphAI/cloudmorph-tessera/blob/main/CHANGELOG.md
11
+ Project-URL: Issues, https://github.com/CloudMorphAI/cloudmorph-tessera/issues
12
+ Keywords: mcp,model-context-protocol,firewall,security,policy-as-code,ai-agents,audit,cursor,claude-code
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: System Administrators
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Security
21
+ Classifier: Topic :: System :: Networking :: Firewalls
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.12
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: fastapi==0.136.1
27
+ Requires-Dist: uvicorn[standard]==0.46.0
28
+ Requires-Dist: httpx==0.28.1
29
+ Requires-Dist: pydantic==2.12.5
30
+ Requires-Dist: typer==0.25.1
31
+ Requires-Dist: regex==2026.4.4
32
+ Requires-Dist: watchdog==6.0.0
33
+ Requires-Dist: PyYAML==6.0.3
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest==9.0.3; extra == "dev"
36
+ Requires-Dist: pytest-asyncio==1.3.0; extra == "dev"
37
+ Requires-Dist: pytest-cov==7.1.0; extra == "dev"
38
+ Requires-Dist: hypothesis==6.152.4; extra == "dev"
39
+ Requires-Dist: ruff==0.15.12; extra == "dev"
40
+ Requires-Dist: mypy==1.20.2; extra == "dev"
41
+ Requires-Dist: pre-commit==4.6.0; extra == "dev"
42
+ Requires-Dist: httpx==0.28.1; extra == "dev"
43
+ Requires-Dist: respx==0.23.1; extra == "dev"
44
+ Requires-Dist: tzdata==2026.2; extra == "dev"
45
+ Requires-Dist: jsonschema==4.23.0; extra == "dev"
46
+ Requires-Dist: bandit==1.9.4; extra == "dev"
47
+ Requires-Dist: pip-audit==2.10.0; extra == "dev"
48
+ Requires-Dist: cyclonedx-bom==7.3.0; extra == "dev"
49
+ Provides-Extra: runtime
50
+ Requires-Dist: fastapi==0.136.1; extra == "runtime"
51
+ Requires-Dist: uvicorn[standard]==0.46.0; extra == "runtime"
52
+ Requires-Dist: httpx==0.28.1; extra == "runtime"
53
+ Requires-Dist: pydantic==2.12.5; extra == "runtime"
54
+ Requires-Dist: typer==0.25.1; extra == "runtime"
55
+ Requires-Dist: regex==2026.4.4; extra == "runtime"
56
+ Requires-Dist: watchdog==6.0.0; extra == "runtime"
57
+ Requires-Dist: PyYAML==6.0.3; extra == "runtime"
58
+ Dynamic: license-file
59
+
60
+ # Tessera
61
+
62
+ <!-- mcp-name: io.github.CloudMorphAI/tessera -->
63
+
64
+ **The open-source MCP firewall for AI agents**
65
+
66
+ **See Tessera block a destructive Cursor action in 60 seconds → [cursor-hooks recipe](recipes/cursor-hooks.md)**
67
+
68
+ [![PyPI version](https://img.shields.io/pypi/v/cloudmorph-tessera.svg)](https://pypi.org/project/cloudmorph-tessera/)
69
+ [![Python versions](https://img.shields.io/pypi/pyversions/cloudmorph-tessera.svg)](https://pypi.org/project/cloudmorph-tessera/)
70
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/CloudMorphAI/cloudmorph-tessera/blob/main/LICENSE)
71
+ [![Docker](https://img.shields.io/badge/docker-ghcr.io%2Fcloudmorphai%2Ftessera-blue.svg)](https://ghcr.io/cloudmorphai/tessera)
72
+ [![Docker pulls](https://img.shields.io/docker/pulls/cloudmorphai/tessera.svg)](https://github.com/CloudMorphAI/cloudmorph-tessera/pkgs/container/tessera)
73
+
74
+ ---
75
+
76
+ ## Why Tessera
77
+
78
+ AI agents calling MCP tools can delete production data, exfiltrate secrets, and exceed cost caps — all in a single tool call your code never explicitly authorized. Tessera is an HTTP proxy that sits between the agent and every MCP server; every `tools/call` request is evaluated against a YAML policy set before it reaches the upstream. Decisions are written to a hash-chain audit log so tampering is detectable. The engine is pure Python — no OPA, no ML, no cloud credentials — so the policy outcome for a given input is always the same. The 14 policies (7 core reference + 7 integration-specific) ship with the container; core policies are the same ones sold separately by other vendors.
79
+
80
+ ---
81
+
82
+ ## Installation
83
+
84
+ ### Option 1: Docker (recommended for production)
85
+
86
+ ```bash
87
+ docker pull ghcr.io/cloudmorphai/tessera:0.1.1
88
+ ```
89
+
90
+ ### Option 2: Python package (for local development and CLI use)
91
+
92
+ ```bash
93
+ pip install cloudmorph-tessera
94
+ ```
95
+
96
+ After install, verify:
97
+
98
+ ```bash
99
+ tessera version
100
+ # tessera 0.1.1
101
+ ```
102
+
103
+ Docker is the primary path for users running Tessera as a service. PyPI is the path for users who want to author policies locally or run `tessera policy lint` / `tessera policy test` in CI.
104
+
105
+ ---
106
+
107
+ ## 5-minute quickstart
108
+
109
+ ```bash
110
+ # Step 1: Pull
111
+ docker pull ghcr.io/cloudmorphai/tessera:0.1.1
112
+
113
+ # Step 2: Scaffold
114
+ docker run --rm -v "$PWD:/out" ghcr.io/cloudmorphai/tessera:0.1.1 tessera init --dir /out
115
+ # Creates tessera.yaml (mode: log_only), policies/, .env.example
116
+
117
+ # Step 3: Edit tessera.yaml — change upstreams[].url to your real MCP server URL
118
+
119
+ # Step 4: Start Tessera (log_only by default — safe to try, nothing is blocked yet)
120
+ docker run -d --name tessera \
121
+ -p 8080:8080 \
122
+ -v "$PWD/tessera.yaml:/etc/tessera/tessera.yaml:ro" \
123
+ -v "$PWD/policies:/etc/tessera/policies:ro" \
124
+ -v tessera_audit:/var/lib/tessera \
125
+ -e TESSERA_BEARER_TOKEN="tk_$(openssl rand -hex 16)" \
126
+ ghcr.io/cloudmorphai/tessera:0.1.1
127
+
128
+ # Step 5: Wire your agent — add to ~/.cursor/mcp.json:
129
+ # {
130
+ # "mcpServers": {
131
+ # "aws-via-tessera": {
132
+ # "url": "http://localhost:8080/mcp/aws",
133
+ # "headers": {"Authorization": "Bearer <your-token>"}
134
+ # }
135
+ # }
136
+ # }
137
+ # See docs/INTEGRATIONS.md for Claude Code, Claude Desktop, Windsurf.
138
+
139
+ # Step 6: Verify a tool call was logged
140
+ docker exec tessera tessera audit verify --scope default
141
+
142
+ # Step 7: When ready, switch to enforcement
143
+ # Edit tessera.yaml: change mode: log_only -> mode: enforcement
144
+ # Restart Tessera. Now block decisions fire.
145
+
146
+ # IMPORTANT: If exposing Tessera beyond localhost, put it behind nginx/Caddy
147
+ # with a rate-limit rule. Native rate limiting is on the v0.2 roadmap.
148
+ ```
149
+
150
+ ---
151
+
152
+ ## What ships
153
+
154
+ - **Multi-token bearer auth** — inline env var, YAML file, or single legacy token; per-token scope isolates audit streams. See [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
155
+ - **Three enforcement modes** — `enforcement` (blocks fire), `log_only` (advisory, always forwards), `observation` (engine skipped). See [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
156
+ - **16-condition pure-Python policy engine** — `arg_equals`, `arg_greater_than`, `arg_less_than`, `arg_matches_regex`, `arg_in_set`, `arg_contains_pattern`, `arg_size_greater_than`, `tool_name_in`, `action_class_in`, `intent_class_in`, `intent_purpose_matches`, `region_in`, `time_of_day_outside`, `meta_field_equals`, `any_of`, `none_of`. See [docs/POLICIES.md](docs/POLICIES.md).
157
+ - **Hash-chain audit log** — every event is chained to the previous via SHA-256; `tessera audit verify` detects any gap or tamper. Per-token scope isolation. See [docs/AUDIT.md](docs/AUDIT.md).
158
+ - **14 policies** — 7 core reference policies (`read-only-mode`, `prod-protection`, `secret-leak-block`, `pii-block`, `cost-cap`, `write-action-approval`, `data-residency-eu`) and 7 integration-specific protection policies (`github-mcp-protection`, `jira-mcp-protection`, `owasp-mcp-prompt-injection`, `owasp-mcp-tool-poisoning`, `postgres-mcp-protection`, `salesforce-mcp-protection`, `slack-mcp-protection`). See [docs/POLICIES.md](docs/POLICIES.md).
159
+ - **Per-file reload error isolation** — a bad YAML file is skipped and logged; the rest of the policy set remains live. See [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
160
+ - **Regex safety (ReDoS defense)** — all regex conditions are evaluated via the `regex` library with a 100 ms timeout; a timeout returns `false` and tags the audit event. See [docs/POLICIES.md](docs/POLICIES.md).
161
+ - **Intent-blind agent support** — agents that do not declare intent in `_meta.tessera_intent` are handled by tool-name and argument policies. `intent.required: false` is the default. See [docs/INTEGRATIONS.md](docs/INTEGRATIONS.md).
162
+ - **CLI** — `tessera serve`, `tessera audit verify`, `tessera policy test`, `tessera policy lint`, `tessera version`, `tessera init`. See [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
163
+ - **Multi-stage Docker image** — builder + slim runtime; runs as UID 10001 (non-root). See [docs/INSTALL.md](docs/INSTALL.md).
164
+ - **Three pluggable Protocols** — `Authenticator`, `PolicyLoader`, `AuditSink` are resolved via importlib at startup; swap implementations without modifying core code. See [tessera/pluggable.py](tessera/pluggable.py).
165
+
166
+ ---
167
+
168
+ ## How it works
169
+
170
+ ```
171
+ Agent --> [Tessera: auth --> engine --> audit] --> Upstream MCP
172
+ ```
173
+
174
+ Every inbound `POST /mcp/{upstream}` is:
175
+
176
+ 1. Authenticated — bearer token matched against configured tokens; `AuthContext.scope` assigned.
177
+ 2. Evaluated — policy engine walks the sorted policy set (first-match-wins) and returns `allow`, `block`, `log_only`, or `require_approval`.
178
+ 3. Audited — the decision (and response, if forwarded) is written to the hash-chain.
179
+
180
+ In `enforcement` mode a `block` decision returns a JSON-RPC error (code `-32603`) over HTTP 200 to the agent and does not touch the upstream. In `log_only` mode the upstream is always called and the decision is returned in response headers (`X-Tessera-Decision`, `X-Tessera-Policy-Id`, `X-Tessera-Reason`).
181
+
182
+ Source code is under [tessera/](tessera/); contributor notes in [CONTRIBUTING.md](CONTRIBUTING.md).
183
+
184
+ ---
185
+
186
+ ## Configuration at a glance
187
+
188
+ ```yaml
189
+ listen:
190
+ host: 0.0.0.0
191
+ port: 8080
192
+
193
+ auth:
194
+ type: bearer
195
+
196
+ policies:
197
+ dir: /etc/tessera/policies
198
+ reload: watch # watch | sighup | none
199
+ mode: log_only # enforcement | log_only | observation
200
+ default_action: block
201
+
202
+ upstreams:
203
+ - name: aws
204
+ url: https://mcp.aws.example.com
205
+ credentials:
206
+ header: Authorization
207
+ value: "Bearer ${AWS_MCP_TOKEN}" # resolved from environment at startup
208
+ ```
209
+
210
+ Full reference: [docs/CONFIGURATION.md](docs/CONFIGURATION.md). Annotated example: [tessera.example.yaml](tessera.example.yaml).
211
+
212
+ ---
213
+
214
+ ## Authoring policies
215
+
216
+ ```yaml
217
+ id: block-delete-prod
218
+ name: Block Delete in Production
219
+ description: Block delete calls targeting prod-suffixed resources.
220
+ match:
221
+ upstream: "*"
222
+ when:
223
+ - condition: action_class_in
224
+ values: ["write.delete"]
225
+ - condition: arg_matches_regex
226
+ arg: resource_name
227
+ pattern: ".*-prod$"
228
+ action: block
229
+ reason: "Delete blocked on production resource"
230
+ priority: 90
231
+ ```
232
+
233
+ Policies are one YAML file per rule in the directory set by `policies.dir`. Files prefixed with `_` are skipped. The engine evaluates policies in descending `priority` order; the first matching policy wins. `when: []` (empty) matches every call.
234
+
235
+ Test before deploying:
236
+
237
+ ```bash
238
+ tessera policy lint --policy-dir policies/
239
+ tessera policy test --policy-dir policies/ --fixture-dir tests/fixtures/
240
+ ```
241
+
242
+ Full condition catalog and fixture format: [docs/POLICIES.md](docs/POLICIES.md).
243
+
244
+ ---
245
+
246
+ ## Routing your AI agent through Tessera (CLAUDE.md / system-prompt pattern)
247
+
248
+ Adding Tessera as one of many available MCP servers isn't enough — your agent will often prefer the direct cloud MCP server because it sees that one too. To make Tessera the default route for cloud tool calls, instruct the agent in its system context.
249
+
250
+ For **Claude Code**, drop a `CLAUDE.md` at your project root (or `~/.claude/CLAUDE.md` for global default):
251
+
252
+ ```markdown
253
+ # Tool routing — use Tessera as the MCP firewall
254
+
255
+ When this project calls MCP tools that touch cloud resources (AWS, GCP, Azure,
256
+ Databricks, Snowflake, GitHub, Slack, Postgres, Kubernetes):
257
+
258
+ - **Always prefer the `tessera` MCP server** if the same tool is reachable
259
+ through it. Tessera enforces deterministic policy + writes a hash-chained
260
+ audit log of every call.
261
+ - If a tool is only available via a direct cloud MCP server, **stop and ask
262
+ the user before proceeding** — don't silently bypass the firewall.
263
+ - Read-only operations (list, describe, get) typically pass through normally.
264
+ - Destructive operations (delete, terminate, drop, force-push) WILL be blocked
265
+ by the shipped reference policies if they touch prod resources. When the
266
+ block response carries `error.data._meta.tessera_audit_event_id`, surface
267
+ the policy reason to the user verbatim.
268
+ ```
269
+
270
+ For **Cursor**, equivalent goes in `.cursorrules` at project root, or in user-level Cursor settings. For **Claude Desktop**, put it in the global system prompt via Settings → "Personalization".
271
+
272
+ This pattern is the difference between "a firewall the user must remember to use" and "a firewall the agent uses by default." Combined with the 14 reference policies, it gives you defense-in-depth without per-call vigilance.
273
+
274
+ See [docs/INTEGRATIONS.md](docs/INTEGRATIONS.md) for per-client config recipes (Cursor, Claude Code, Claude Desktop).
275
+
276
+ ---
277
+
278
+ ## Tessera Cloud
279
+
280
+ Want hosted? Multi-tenant? SSO? Compliance evidence export? Tessera Cloud is the same engine with hosted orchestration. The same `Authenticator`, `PolicyLoader`, and `AuditSink` Protocols are used — the implementations are swapped (e.g., `DynamoDBPolicyLoader` instead of `FilesystemPolicyLoader`). Your existing `tessera.yaml` and policy files work without changes when you migrate. https://cloudmorph.ai
281
+
282
+ ---
283
+
284
+ ## Roadmap
285
+
286
+ Deferred from v0.1; detail and rationale in [docs/ROADMAP.md](docs/ROADMAP.md).
287
+
288
+ - **OAuth 2.1 PKCE** — v0.2; needed for SaaS/CI deployments where the identity issuer is a third-party IdP.
289
+ - **Native rate limiting** — v0.2; per-token token bucket; workaround in v0.1 is nginx/Caddy in front.
290
+ - **Postgres audit sink** — v0.2; the `AuditSink` Protocol is already designed for it; SQLite covers v0.1 write volume.
291
+ - **stdio transport** — v0.2; for Claude Desktop and agent runtimes that launch MCP servers as subprocesses.
292
+ - **Rego escape hatch** — v0.2; gated on a concrete use case the YAML condition catalog cannot express.
293
+ - **Multi-tenant isolation** — not planned for OSS; available in Tessera Cloud.
294
+
295
+ ---
296
+
297
+ ## Contributing
298
+
299
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Run `pip install -e ".[dev]"` and `pre-commit install` to get started.
300
+
301
+ ## License
302
+
303
+ Apache-2.0. See [LICENSE](LICENSE).
304
+
305
+ ## Security
306
+
307
+ Report vulnerabilities privately via [SECURITY.md](SECURITY.md).