agent-filetree-memory-mcp 0.3.0__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 (89) hide show
  1. agent_filetree_memory_mcp-0.3.0/.gitignore +22 -0
  2. agent_filetree_memory_mcp-0.3.0/LICENSE +201 -0
  3. agent_filetree_memory_mcp-0.3.0/PKG-INFO +113 -0
  4. agent_filetree_memory_mcp-0.3.0/README.md +64 -0
  5. agent_filetree_memory_mcp-0.3.0/SECURITY.md +19 -0
  6. agent_filetree_memory_mcp-0.3.0/docs/architecture.md +125 -0
  7. agent_filetree_memory_mcp-0.3.0/docs/authentication.md +140 -0
  8. agent_filetree_memory_mcp-0.3.0/docs/management-ui.md +92 -0
  9. agent_filetree_memory_mcp-0.3.0/docs/releasing.md +76 -0
  10. agent_filetree_memory_mcp-0.3.0/docs/standalone.md +105 -0
  11. agent_filetree_memory_mcp-0.3.0/docs/testing.md +49 -0
  12. agent_filetree_memory_mcp-0.3.0/examples/injected_postgres_mcp.py +83 -0
  13. agent_filetree_memory_mcp-0.3.0/pyproject.toml +107 -0
  14. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/__init__.py +23 -0
  15. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/application/__init__.py +5 -0
  16. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/application/service.py +291 -0
  17. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/auth/__init__.py +5 -0
  18. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/auth/capabilities.py +426 -0
  19. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/cli.py +266 -0
  20. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/control_plane/__init__.py +65 -0
  21. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/control_plane/api.py +847 -0
  22. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/control_plane/management_store.py +2504 -0
  23. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/control_plane/namespace_store.py +1278 -0
  24. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/crypto/__init__.py +10 -0
  25. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/crypto/envelope.py +197 -0
  26. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/crypto/local_keyring.py +90 -0
  27. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/domain/__init__.py +5 -0
  28. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/domain/errors.py +41 -0
  29. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/domain/models.py +115 -0
  30. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/domain/paths.py +37 -0
  31. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/janitor_cli.py +119 -0
  32. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/mcp/__init__.py +9 -0
  33. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/mcp/payloads.py +106 -0
  34. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/mcp/server.py +449 -0
  35. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/mcp_app/__init__.py +5 -0
  36. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/mcp_app/app.py +1170 -0
  37. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/ports/__init__.py +14 -0
  38. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/ports/capabilities.py +22 -0
  39. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/ports/crypto.py +51 -0
  40. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/ports/store.py +80 -0
  41. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/postgres/__init__.py +30 -0
  42. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/postgres/janitor.py +263 -0
  43. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/postgres/migrations/README.md +16 -0
  44. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/postgres/migrations/__init__.py +149 -0
  45. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/postgres/migrations/versions/0001_encrypted_filetree.py +284 -0
  46. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/postgres/migrations/versions/0002_normalize_constraint_names.py +187 -0
  47. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/postgres/migrations/versions/0003_management_control_plane.py +275 -0
  48. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/postgres/migrations/versions/0004_workspace_authorization_policies.py +175 -0
  49. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/postgres/migrations/versions/__init__.py +1 -0
  50. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/postgres/runtime.py +125 -0
  51. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/postgres/schema.py +282 -0
  52. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/postgres/store.py +1592 -0
  53. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/web/__init__.py +15 -0
  54. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/web/application.py +65 -0
  55. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/web/dist/assets/index-BWOByJXH.js +37 -0
  56. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/web/dist/assets/index-Ca-eJNeX.css +1 -0
  57. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/web/dist/index.html +14 -0
  58. agent_filetree_memory_mcp-0.3.0/src/agent_filetree_memory/web/frontend.py +184 -0
  59. agent_filetree_memory_mcp-0.3.0/tests/control_plane/test_api.py +130 -0
  60. agent_filetree_memory_mcp-0.3.0/tests/control_plane/test_management_store.py +927 -0
  61. agent_filetree_memory_mcp-0.3.0/tests/control_plane/test_namespace_store.py +1027 -0
  62. agent_filetree_memory_mcp-0.3.0/tests/mcp/conftest.py +218 -0
  63. agent_filetree_memory_mcp-0.3.0/tests/mcp/test_app.py +438 -0
  64. agent_filetree_memory_mcp-0.3.0/tests/mcp/test_server.py +338 -0
  65. agent_filetree_memory_mcp-0.3.0/tests/postgres/conftest.py +60 -0
  66. agent_filetree_memory_mcp-0.3.0/tests/postgres/test_migration_integration.py +380 -0
  67. agent_filetree_memory_mcp-0.3.0/tests/postgres/test_runtime_and_migrations.py +176 -0
  68. agent_filetree_memory_mcp-0.3.0/tests/postgres/test_store_integration.py +947 -0
  69. agent_filetree_memory_mcp-0.3.0/tests/security/test_capabilities.py +395 -0
  70. agent_filetree_memory_mcp-0.3.0/tests/security/test_crypto_integrity.py +117 -0
  71. agent_filetree_memory_mcp-0.3.0/tests/test_cli.py +262 -0
  72. agent_filetree_memory_mcp-0.3.0/tests/test_domain_paths.py +31 -0
  73. agent_filetree_memory_mcp-0.3.0/tests/test_package_metadata.py +9 -0
  74. agent_filetree_memory_mcp-0.3.0/tests/test_repository_hygiene.py +42 -0
  75. agent_filetree_memory_mcp-0.3.0/tests/unit/test_crypto.py +133 -0
  76. agent_filetree_memory_mcp-0.3.0/tests/unit/test_memory_service.py +383 -0
  77. agent_filetree_memory_mcp-0.3.0/tests/web/test_frontend.py +98 -0
  78. agent_filetree_memory_mcp-0.3.0/web-ui/index.html +13 -0
  79. agent_filetree_memory_mcp-0.3.0/web-ui/package-lock.json +3435 -0
  80. agent_filetree_memory_mcp-0.3.0/web-ui/package.json +27 -0
  81. agent_filetree_memory_mcp-0.3.0/web-ui/src/App.tsx +1532 -0
  82. agent_filetree_memory_mcp-0.3.0/web-ui/src/api.ts +414 -0
  83. agent_filetree_memory_mcp-0.3.0/web-ui/src/auth.tsx +210 -0
  84. agent_filetree_memory_mcp-0.3.0/web-ui/src/config.ts +73 -0
  85. agent_filetree_memory_mcp-0.3.0/web-ui/src/index.css +49 -0
  86. agent_filetree_memory_mcp-0.3.0/web-ui/src/main.tsx +17 -0
  87. agent_filetree_memory_mcp-0.3.0/web-ui/src/types.ts +78 -0
  88. agent_filetree_memory_mcp-0.3.0/web-ui/tsconfig.json +21 -0
  89. agent_filetree_memory_mcp-0.3.0/web-ui/vite.config.ts +13 -0
@@ -0,0 +1,22 @@
1
+ .DS_Store
2
+ .env
3
+ .env.*
4
+ !.env.example
5
+ /AGENTS.local.md
6
+ .secrets/
7
+ *.key
8
+ *.pem
9
+ *.p12
10
+ *.pfx
11
+ .venv/
12
+ .pytest_cache/
13
+ .ruff_cache/
14
+ .mypy_cache/
15
+ __pycache__/
16
+ *.py[cod]
17
+ *.egg-info/
18
+ build/
19
+ /dist/
20
+ /web-ui/node_modules/
21
+ .coverage
22
+ htmlcov/
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.5
2
+ Name: agent-filetree-memory-mcp
3
+ Version: 0.3.0
4
+ Summary: Encrypted, capability-scoped, versioned Markdown file-tree memory for MCP agents
5
+ Project-URL: Homepage, https://github.com/EmilioEsposito/agent-filetree-memory-mcp
6
+ Project-URL: Documentation, https://github.com/EmilioEsposito/agent-filetree-memory-mcp/tree/main/docs
7
+ Project-URL: Repository, https://github.com/EmilioEsposito/agent-filetree-memory-mcp.git
8
+ Project-URL: Issues, https://github.com/EmilioEsposito/agent-filetree-memory-mcp/issues
9
+ Author: Emilio Esposito
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: agent,markdown,mcp,memory,postgresql
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Database
20
+ Classifier: Topic :: Security :: Cryptography
21
+ Requires-Python: <3.14,>=3.11
22
+ Requires-Dist: cryptography<51,>=49.0.0
23
+ Requires-Dist: pyjwt[crypto]<3,>=2.13.0
24
+ Requires-Dist: typing-extensions<5,>=4.12; python_version < '3.12'
25
+ Provides-Extra: all
26
+ Requires-Dist: alembic<2,>=1.18.5; extra == 'all'
27
+ Requires-Dist: asyncpg<0.32,>=0.31.0; extra == 'all'
28
+ Requires-Dist: fastapi==0.141.1; extra == 'all'
29
+ Requires-Dist: fastmcp[apps]==3.4.2; extra == 'all'
30
+ Requires-Dist: prefab-ui==0.20.2; extra == 'all'
31
+ Requires-Dist: sqlalchemy[asyncio]<2.1,>=2.0.51; extra == 'all'
32
+ Requires-Dist: uvicorn==0.52.4; extra == 'all'
33
+ Provides-Extra: app
34
+ Requires-Dist: fastmcp[apps]==3.4.2; extra == 'app'
35
+ Requires-Dist: prefab-ui==0.20.2; extra == 'app'
36
+ Provides-Extra: mcp
37
+ Requires-Dist: fastmcp==3.4.2; extra == 'mcp'
38
+ Provides-Extra: postgres
39
+ Requires-Dist: alembic<2,>=1.18.5; extra == 'postgres'
40
+ Requires-Dist: asyncpg<0.32,>=0.31.0; extra == 'postgres'
41
+ Requires-Dist: sqlalchemy[asyncio]<2.1,>=2.0.51; extra == 'postgres'
42
+ Provides-Extra: web
43
+ Requires-Dist: alembic<2,>=1.18.5; extra == 'web'
44
+ Requires-Dist: asyncpg<0.32,>=0.31.0; extra == 'web'
45
+ Requires-Dist: fastapi==0.141.1; extra == 'web'
46
+ Requires-Dist: sqlalchemy[asyncio]<2.1,>=2.0.51; extra == 'web'
47
+ Requires-Dist: uvicorn==0.52.4; extra == 'web'
48
+ Description-Content-Type: text/markdown
49
+
50
+ # Agent Filetree Memory MCP
51
+
52
+ Agent Filetree Memory MCP is a framework-neutral memory service for agents. It stores a simple virtual Markdown file tree in PostgreSQL while keeping paths and document content encrypted at rest.
53
+
54
+ The project is designed around four boundaries:
55
+
56
+ - The host verifies a short-lived capability and selects the workspace and durable agent profile. Models and UI components cannot choose or widen those identifiers.
57
+ - Every document and directory version is immutable and encrypted with a fresh AES-256-GCM data key.
58
+ - PostgreSQL is injected through an async SQLAlchemy session factory. Standalone users may construct one from a static database URL; hosting platforms may supply their own credential-aware factory.
59
+ - MCP is an adapter. The application service can also be embedded directly in another Python service.
60
+
61
+ The initial tool surface is intentionally small: list, read, write, append, and delete. Writes use compare-and-swap versions and idempotency keys. Delete denies access immediately and makes encrypted data eligible for hard deletion after its configured retention window. The host must run the packaged janitor; the request-serving process does not schedule cleanup itself.
62
+
63
+ ## Status
64
+
65
+ This project is an early alpha. APIs, migrations, and data formats may change
66
+ before 1.0.
67
+
68
+ ## Installation
69
+
70
+ Install the complete standalone package from PyPI:
71
+
72
+ ```shell
73
+ pip install 'agent-filetree-memory-mcp[all]'
74
+ ```
75
+
76
+ The base package contains the framework-neutral domain and application layers.
77
+ The `postgres`, `mcp`, `app`, and `web` extras are available for narrower
78
+ integrations. See the [standalone guide](https://github.com/EmilioEsposito/agent-filetree-memory-mcp/blob/main/docs/standalone.md)
79
+ for database setup, security-sensitive configuration, and server startup.
80
+
81
+ ## Intended package layers
82
+
83
+ - `agent_filetree_memory.domain`: dependency-light identifiers, paths, results, and errors.
84
+ - `agent_filetree_memory.application`: authorization-first memory operations.
85
+ - `agent_filetree_memory.crypto`: envelope encryption and pluggable data-key providers.
86
+ - `agent_filetree_memory.postgres`: PostgreSQL persistence and packaged Alembic migrations.
87
+ - `agent_filetree_memory.control_plane`: optional workspaces, durable agent profiles, membership, independent management/content grants, and audit.
88
+ - `agent_filetree_memory.mcp`: headless MCP tools.
89
+ - `agent_filetree_memory.mcp_app`: an optional current-capability browser and editor.
90
+ - `agent_filetree_memory.web`: the version-matched management API composition and bundled React UI.
91
+
92
+ ## Security properties
93
+
94
+ The service authorizes before storage lookup or decryption. Missing and unauthorized documents share the same public failure shape. Database rows contain opaque routing, authorization, version, and lifecycle fields; human-readable paths, titles, tags, snippets, Markdown, and directory manifests are encrypted.
95
+
96
+ See [SECURITY.md](https://github.com/EmilioEsposito/agent-filetree-memory-mcp/blob/main/SECURITY.md) for the threat model and disclosure guidance.
97
+ See [docs/authentication.md](https://github.com/EmilioEsposito/agent-filetree-memory-mcp/blob/main/docs/authentication.md) for the two-layer transport
98
+ and durable agent-identity design.
99
+ See [docs/standalone.md](https://github.com/EmilioEsposito/agent-filetree-memory-mcp/blob/main/docs/standalone.md) for running the packaged stdio
100
+ server and retention janitor from a static PostgreSQL URL.
101
+ See [docs/management-ui.md](https://github.com/EmilioEsposito/agent-filetree-memory-mcp/blob/main/docs/management-ui.md) for mounting the bundled
102
+ administrative UI with a host-supplied identity dependency.
103
+
104
+ The optional control plane is provider-neutral. Hosts inject verified
105
+ principals, including a platform-administrator boolean, and may inject an
106
+ external workspace-entitlement resolver. Platform administrators can inventory
107
+ workspace metadata and create workspaces, but must explicitly take a workspace
108
+ role before agent slugs become visible. Workspace administration and explicit
109
+ agent management never imply content access or decryption.
110
+
111
+ ## License
112
+
113
+ Apache License 2.0. See [LICENSE](https://github.com/EmilioEsposito/agent-filetree-memory-mcp/blob/main/LICENSE).
@@ -0,0 +1,64 @@
1
+ # Agent Filetree Memory MCP
2
+
3
+ Agent Filetree Memory MCP is a framework-neutral memory service for agents. It stores a simple virtual Markdown file tree in PostgreSQL while keeping paths and document content encrypted at rest.
4
+
5
+ The project is designed around four boundaries:
6
+
7
+ - The host verifies a short-lived capability and selects the workspace and durable agent profile. Models and UI components cannot choose or widen those identifiers.
8
+ - Every document and directory version is immutable and encrypted with a fresh AES-256-GCM data key.
9
+ - PostgreSQL is injected through an async SQLAlchemy session factory. Standalone users may construct one from a static database URL; hosting platforms may supply their own credential-aware factory.
10
+ - MCP is an adapter. The application service can also be embedded directly in another Python service.
11
+
12
+ The initial tool surface is intentionally small: list, read, write, append, and delete. Writes use compare-and-swap versions and idempotency keys. Delete denies access immediately and makes encrypted data eligible for hard deletion after its configured retention window. The host must run the packaged janitor; the request-serving process does not schedule cleanup itself.
13
+
14
+ ## Status
15
+
16
+ This project is an early alpha. APIs, migrations, and data formats may change
17
+ before 1.0.
18
+
19
+ ## Installation
20
+
21
+ Install the complete standalone package from PyPI:
22
+
23
+ ```shell
24
+ pip install 'agent-filetree-memory-mcp[all]'
25
+ ```
26
+
27
+ The base package contains the framework-neutral domain and application layers.
28
+ The `postgres`, `mcp`, `app`, and `web` extras are available for narrower
29
+ integrations. See the [standalone guide](https://github.com/EmilioEsposito/agent-filetree-memory-mcp/blob/main/docs/standalone.md)
30
+ for database setup, security-sensitive configuration, and server startup.
31
+
32
+ ## Intended package layers
33
+
34
+ - `agent_filetree_memory.domain`: dependency-light identifiers, paths, results, and errors.
35
+ - `agent_filetree_memory.application`: authorization-first memory operations.
36
+ - `agent_filetree_memory.crypto`: envelope encryption and pluggable data-key providers.
37
+ - `agent_filetree_memory.postgres`: PostgreSQL persistence and packaged Alembic migrations.
38
+ - `agent_filetree_memory.control_plane`: optional workspaces, durable agent profiles, membership, independent management/content grants, and audit.
39
+ - `agent_filetree_memory.mcp`: headless MCP tools.
40
+ - `agent_filetree_memory.mcp_app`: an optional current-capability browser and editor.
41
+ - `agent_filetree_memory.web`: the version-matched management API composition and bundled React UI.
42
+
43
+ ## Security properties
44
+
45
+ The service authorizes before storage lookup or decryption. Missing and unauthorized documents share the same public failure shape. Database rows contain opaque routing, authorization, version, and lifecycle fields; human-readable paths, titles, tags, snippets, Markdown, and directory manifests are encrypted.
46
+
47
+ See [SECURITY.md](https://github.com/EmilioEsposito/agent-filetree-memory-mcp/blob/main/SECURITY.md) for the threat model and disclosure guidance.
48
+ See [docs/authentication.md](https://github.com/EmilioEsposito/agent-filetree-memory-mcp/blob/main/docs/authentication.md) for the two-layer transport
49
+ and durable agent-identity design.
50
+ See [docs/standalone.md](https://github.com/EmilioEsposito/agent-filetree-memory-mcp/blob/main/docs/standalone.md) for running the packaged stdio
51
+ server and retention janitor from a static PostgreSQL URL.
52
+ See [docs/management-ui.md](https://github.com/EmilioEsposito/agent-filetree-memory-mcp/blob/main/docs/management-ui.md) for mounting the bundled
53
+ administrative UI with a host-supplied identity dependency.
54
+
55
+ The optional control plane is provider-neutral. Hosts inject verified
56
+ principals, including a platform-administrator boolean, and may inject an
57
+ external workspace-entitlement resolver. Platform administrators can inventory
58
+ workspace metadata and create workspaces, but must explicitly take a workspace
59
+ role before agent slugs become visible. Workspace administration and explicit
60
+ agent management never imply content access or decryption.
61
+
62
+ ## License
63
+
64
+ Apache License 2.0. See [LICENSE](https://github.com/EmilioEsposito/agent-filetree-memory-mcp/blob/main/LICENSE).
@@ -0,0 +1,19 @@
1
+ # Security
2
+
3
+ ## Supported versions
4
+
5
+ This project is pre-release. Only the current development version receives security fixes.
6
+
7
+ ## Reporting a vulnerability
8
+
9
+ Do not open a public issue for a suspected vulnerability. Contact the repository owner privately and include the affected version, reproduction steps, impact, and any suggested mitigation. Avoid including real memory content, credentials, signing keys, or database dumps.
10
+
11
+ ## Security model
12
+
13
+ The trusted host is responsible for authenticating callers and issuing a short-lived capability. The service verifies that capability before any lookup or decryption. A capability binds the outer authenticated principal and invocation to one workspace, immutable agent profile, action set, expiry, and delegation depth. The verifier requires the principal in the signed capability to match the principal established by transport authentication. The principal is the current actor, not part of the durable memory key; the host must issue access only to workspace members authorized for that agent profile.
14
+
15
+ The database is not a plaintext content index. Paths and directory manifests are encrypted alongside document bodies. Each immutable version uses a fresh AES-256-GCM data-encryption key. A configurable provider wraps that key with the same opaque encryption context used as authenticated data for the document ciphertext.
16
+
17
+ The design protects against database-only disclosure, accidental cross-scope lookup, moved ciphertext, stale writes, replayed writes, and disclosure through routine audit fields. It does not claim to protect plaintext from a compromised live service process that is authorized to decrypt it.
18
+
19
+ Deployers remain responsible for network authentication, signing-key custody, encryption-key custody, PostgreSQL access control, backups, observability policy, denial-of-service protection, invoking the packaged retention janitor, and secure deletion guarantees in their storage infrastructure. The request-serving runtime does not contain a scheduler.
@@ -0,0 +1,125 @@
1
+ # Architecture
2
+
3
+ ## Goals
4
+
5
+ The library provides durable, versioned Markdown-like memory without making a filesystem, Git repository, model, or MCP client the authorization boundary. It is designed to be embedded by a trusted agent host or run as a standalone MCP server.
6
+
7
+ The first release optimizes for five properties:
8
+
9
+ 1. One verified invocation can access exactly one workspace and durable agent profile.
10
+ 2. Human-readable paths and content do not appear in plaintext database rows or routine logs.
11
+ 3. Writes are concurrency-safe and safely retryable.
12
+ 4. Database credentials and key-management implementations remain deployer choices.
13
+ 5. Headless MCP tools remain complete when a client does not support MCP Apps.
14
+
15
+ ## Components
16
+
17
+ ```text
18
+ trusted host
19
+ -> capability verifier
20
+ -> application service
21
+ -> PostgreSQL memory store
22
+ -> encrypted directory manifests
23
+ -> encrypted immutable document versions
24
+ -> content-free lifecycle and audit rows
25
+ -> envelope cipher
26
+ -> injected DEK provider
27
+ -> MCP tools
28
+ -> optional current-capability MCP App
29
+ -> authenticated management API
30
+ -> optional workspace and agent control plane
31
+ -> same application service for memory reads and writes
32
+ -> bundled management UI
33
+ ```
34
+
35
+ The application layer receives an immutable `VerifiedInvocation`. It never accepts workspace or agent-profile identifiers alongside an operation. Transport adapters resolve the invocation from trusted request context before calling the service.
36
+
37
+ The durable namespace is `(workspace_id, agent_profile_id)`. `principal_id` is a
38
+ separately authenticated actor recorded in the signed invocation. The optional
39
+ control plane can authorize multiple workspace members to the same profile
40
+ without moving or duplicating its memory. Management permission is independent
41
+ from reader/editor/full content access, and workspace administrators may see
42
+ agent slugs without implicitly gaining decryption access. A deployer may allow
43
+ explicit, audited administrator self-grants or disable them as policy.
44
+ Agent creation atomically provisions an explicit manager row and full-content
45
+ grant for the creator; it does not grant content access to other workspace
46
+ administrators. Platform administration is injected by the host and reveals
47
+ only global workspace metadata until that principal explicitly takes a
48
+ workspace role. Workspace admission and agent-creation policies are signed
49
+ control-plane rows, with an injected provider-neutral resolver for external
50
+ entitlements.
51
+
52
+ ## Database injection
53
+
54
+ The PostgreSQL adapter supports two construction paths:
55
+
56
+ - `PostgresRuntime.from_url(...)` creates and owns an async engine for a conventional static database URL.
57
+ - `PostgresRuntime.from_session_factory(...)` receives a ready-to-use async session factory and never creates, refreshes, or disposes host infrastructure.
58
+
59
+ This is intentionally a session-factory seam rather than a credential-fetcher seam. A hosting platform can rotate credentials, use workload identity, or retrieve secrets inside its own engine without coupling those mechanisms to this package.
60
+
61
+ ## Encrypted virtual tree
62
+
63
+ Each scope has an opaque root object. Directories are objects whose version content is an encrypted manifest of child display names, opaque object identifiers, and kinds. Documents are objects whose immutable versions contain encrypted UTF-8 Markdown.
64
+
65
+ Resolving `/projects/example.md` therefore requires:
66
+
67
+ 1. Selecting the opaque root for the already-authorized scope.
68
+ 2. Decrypting its manifest and selecting the opaque `projects` object.
69
+ 3. Decrypting that directory manifest and selecting the opaque document object.
70
+ 4. Loading and decrypting the document's current immutable version.
71
+
72
+ The plaintext store can route by opaque scope and object identifiers, but it cannot enumerate human-readable paths or titles.
73
+
74
+ ## Encryption
75
+
76
+ Every object version receives a fresh random 256-bit data-encryption key. AES-256-GCM encrypts the content with canonical associated data containing only format version and opaque scope, object, kind, and version identifiers. A `DekProvider` wraps the data key with the same context.
77
+
78
+ Rows retain the provider and key identifiers required for rotation. The bundled local keyring provider accepts explicit 32-byte keys and supports reading older keys while writing with one active key. Hosted key-management providers can implement the same small interface.
79
+
80
+ Moving ciphertext, a wrapped key, or a version row to another object or scope changes the authenticated context and must fail closed.
81
+
82
+ ## Concurrency and retries
83
+
84
+ Object heads are compare-and-swap values. `write`, `append`, and `delete` take an expected document version. One of two writes against the same version may succeed; the other receives a stable version-conflict error.
85
+
86
+ Mutations also require an idempotency key. The corresponding request fingerprint and result are encrypted. A retry of the same request returns the original result. Reusing the key for a different request fails without applying either request again.
87
+
88
+ ## Deletion and retention
89
+
90
+ Delete removes the entry from its encrypted parent manifest and marks the object inaccessible in the same transaction. `purge_after` is an eligibility time, not proof that physical deletion has already run. The package never starts a background scheduler or service lifespan task. A deployer must invoke `agent-filetree-memory-janitor` from cron, a Kubernetes CronJob, or an equivalent host scheduler.
91
+
92
+ Each janitor invocation selects and locks at most its configured batch limit independently from deleted objects, superseded versions, expired idempotency records, expired rate buckets, and expired audit rows. Repeated invocations drain a larger backlog. Deleting a due object also cascades its versions; `max_versions_per_object` provides a deterministic ceiling on that cascade and on retained ciphertext history. The oldest version is pruned as a new version crosses the ceiling, even when its normal retention time has not arrived.
93
+
94
+ The janitor requires database access and schema selection, but not capability, idempotency-index, or encryption keys. Backup and replica expiry remain deployer responsibilities and may extend physical recoverability beyond application-table deletion.
95
+
96
+ ## MCP App
97
+
98
+ The app is a convenience view over the same service layer. Its backend helpers receive paths, content, expected versions, and idempotency keys, but never scope identifiers or a capability token. Every app interaction resolves and reauthorizes the current invocation before lookup or decryption.
99
+
100
+ Plaintext drafts remain in ephemeral component memory. They are not placed in URLs, browser storage, model-visible context, or the initial widget bootstrap result.
101
+
102
+ ## Management UI
103
+
104
+ The wheel contains a prebuilt React application plus a provider-neutral
105
+ FastAPI management API. The host injects the authenticated principal, database
106
+ session factory, encryption keys, MCP transport authentication, and policy.
107
+ The UI calls the same application service as MCP; it has no direct database or
108
+ privileged decryption path. FastAPI serves `/api`, `/mcp`, and `/ui` from one
109
+ process, so the frontend and API remain version-matched without requiring Node
110
+ at installation time.
111
+
112
+ The policy migration does not infer or backfill existing agent managers or
113
+ content grants. Existing agents retain their exact authorization rows; missing
114
+ workspace policy rows default to invite-only admission and administrator-only
115
+ agent creation.
116
+
117
+ ## Deliberate non-goals
118
+
119
+ - Conversation transcript persistence
120
+ - Automatic memory extraction from prompts or messages
121
+ - Semantic or vector search
122
+ - Automated declassification or content-approval workflows
123
+ - Filesystem mounting or online Git synchronization
124
+ - Binary attachments or collaborative editing
125
+ - A deployer-independent user directory or identity provider