cortexdb-mcp 0.7.4__tar.gz → 0.8.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.
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/PKG-INFO +2 -2
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/README.md +284 -284
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/cortexdb_mcp/__main__.py +5 -5
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/cortexdb_mcp/api.py +132 -132
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/cortexdb_mcp/check_call.py +266 -239
- cortexdb_mcp-0.8.0/cortexdb_mcp/config.py +278 -0
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/cortexdb_mcp/insights.py +480 -480
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/cortexdb_mcp/render.py +204 -165
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/cortexdb_mcp/server.py +274 -94
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/pyproject.toml +37 -37
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/tests/test_check_call.py +242 -180
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/tests/test_insights.py +182 -182
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/tests/test_integration.py +67 -67
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/tests/test_server.py +2376 -1689
- cortexdb_mcp-0.7.4/.gitignore +0 -109
- cortexdb_mcp-0.7.4/cortexdb_mcp/config.py +0 -154
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/Dockerfile +0 -0
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/cortexdb_mcp/__init__.py +0 -0
- {cortexdb_mcp-0.7.4 → cortexdb_mcp-0.8.0}/tests/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: cortexdb-mcp
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: MCP Server for CortexDB — expose memory operations to AI agents
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -41,7 +41,7 @@ cortexdb-mcp --tool-profile code
|
|
|
41
41
|
This materially reduces tool-schema context while retaining natural-language
|
|
42
42
|
retrieval, typed traversal, prefix symbol discovery, and directory inventory.
|
|
43
43
|
|
|
44
|
-
That's it. On first launch the server hits `POST /v1/auth/signup`, mints a free-tier PASETO token + scope for itself, and caches them under `~/.config/cortexdb-mcp/state.json` (Linux/macOS) or `%APPDATA%\cortexdb-mcp\state.json` (Windows). Re-launches reuse the cached identity until the token expires (7 days).
|
|
44
|
+
That's it. On first launch the server hits `POST /v1/auth/signup`, mints a free-tier PASETO token + scope for itself, and caches them under `~/.config/cortexdb-mcp/state.json` (Linux/macOS) or `%APPDATA%\cortexdb-mcp\state.json` (Windows). Re-launches reuse the cached identity until the token expires (7 days); the cached `expires_at` is checked at load, and a token the server rejects with 401 is discarded and re-minted automatically, so no hand-deletion of `state.json` is needed. Signup runs against any configured `CORTEXDB_URL`, self-hosted included; a deployment with no minter answers 503 and the server carries on unauthenticated.
|
|
45
45
|
|
|
46
46
|
To target a custom deployment or pre-existing identity, set any of:
|
|
47
47
|
|
|
@@ -1,284 +1,284 @@
|
|
|
1
|
-
# CortexDB MCP Server
|
|
2
|
-
|
|
3
|
-
MCP (Model Context Protocol) server that gives AI tools persistent long-term memory via CortexDB. Works with Claude Desktop, Cursor, Windsurf, VS Code Copilot, and any MCP-compatible client.
|
|
4
|
-
|
|
5
|
-
> **0.3.0 rewrites the server against the v1 CortexDB API.** Default surface is now `https://api-v1.cortexdb.ai`. The server **auto-signs-up anonymously** on first launch — no API key required.
|
|
6
|
-
|
|
7
|
-
## Quick Start
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# Install (the PyPI name is `cortexdb-mcp`)
|
|
11
|
-
pip install cortexdb-mcp
|
|
12
|
-
|
|
13
|
-
# Then run with zero config:
|
|
14
|
-
cortexdb-mcp
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
For a coding agent that only needs repository intelligence, select the compact
|
|
18
|
-
read-only surface (four tools: explore, impact, inventory, graph):
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
cortexdb-mcp --tool-profile code
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
This materially reduces tool-schema context while retaining natural-language
|
|
25
|
-
retrieval, typed traversal, prefix symbol discovery, and directory inventory.
|
|
26
|
-
|
|
27
|
-
That's it. On first launch the server hits `POST /v1/auth/signup`, mints a free-tier PASETO token + scope for itself, and caches them under `~/.config/cortexdb-mcp/state.json` (Linux/macOS) or `%APPDATA%\cortexdb-mcp\state.json` (Windows). Re-launches reuse the cached identity until the token expires (7 days).
|
|
28
|
-
|
|
29
|
-
To target a custom deployment or pre-existing identity, set any of:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
export CORTEXDB_URL="https://api-v1.cortexdb.ai" # base URL
|
|
33
|
-
export CORTEXDB_API_KEY="v4.public..." # PASETO bearer token
|
|
34
|
-
export CORTEXDB_ACTOR="user:alice" # ActorId, sent as X-Cortex-Actor
|
|
35
|
-
export CORTEXDB_SCOPE="org:acme/user:alice" # default scope path
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## IDE Setup
|
|
39
|
-
|
|
40
|
-
Most clients just need a single line — the auto-signup handles the rest.
|
|
41
|
-
|
|
42
|
-
### Claude Desktop
|
|
43
|
-
|
|
44
|
-
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
45
|
-
|
|
46
|
-
```json
|
|
47
|
-
{
|
|
48
|
-
"mcpServers": {
|
|
49
|
-
"cortexdb": {
|
|
50
|
-
"command": "cortexdb-mcp"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
> **Windows note (audit POL-3):** if Claude Desktop / Cursor / Windsurf
|
|
57
|
-
> can't find `cortexdb-mcp` on PATH, give it the full path to the
|
|
58
|
-
> installed executable:
|
|
59
|
-
>
|
|
60
|
-
> ```json
|
|
61
|
-
> {
|
|
62
|
-
> "mcpServers": {
|
|
63
|
-
> "cortexdb": {
|
|
64
|
-
> "command": "C:\\Python313\\Scripts\\cortexdb-mcp.exe"
|
|
65
|
-
> }
|
|
66
|
-
> }
|
|
67
|
-
> }
|
|
68
|
-
> ```
|
|
69
|
-
>
|
|
70
|
-
> Locate it with `where cortexdb-mcp` in `cmd.exe` or
|
|
71
|
-
> `(Get-Command cortexdb-mcp).Source` in PowerShell.
|
|
72
|
-
>
|
|
73
|
-
> Some Windows terminals don't have UTF-8 enabled by default, which can
|
|
74
|
-
> garble emoji in `--help` output (they show as `?`). The server itself
|
|
75
|
-
> isn't affected — only the CLI banner. Run
|
|
76
|
-
> `chcp 65001` once per terminal session to fix.
|
|
77
|
-
|
|
78
|
-
### Claude Code (CLI)
|
|
79
|
-
|
|
80
|
-
Edit `~/.claude/mcp.json`:
|
|
81
|
-
|
|
82
|
-
```json
|
|
83
|
-
{
|
|
84
|
-
"mcpServers": {
|
|
85
|
-
"cortexdb": {
|
|
86
|
-
"command": "cortexdb-mcp"
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Cursor
|
|
93
|
-
|
|
94
|
-
Edit `~/.cursor/mcp.json`:
|
|
95
|
-
|
|
96
|
-
```json
|
|
97
|
-
{
|
|
98
|
-
"mcpServers": {
|
|
99
|
-
"cortexdb": {
|
|
100
|
-
"command": "cortexdb-mcp"
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
Or in Cursor Settings > MCP Servers > Add Server.
|
|
107
|
-
|
|
108
|
-
### Windsurf
|
|
109
|
-
|
|
110
|
-
Edit `~/.codeium/windsurf/mcp_config.json`:
|
|
111
|
-
|
|
112
|
-
```json
|
|
113
|
-
{
|
|
114
|
-
"mcpServers": {
|
|
115
|
-
"cortexdb": {
|
|
116
|
-
"command": "cortexdb-mcp"
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### VS Code (GitHub Copilot)
|
|
123
|
-
|
|
124
|
-
Add to `.vscode/mcp.json` in your project or `~/.vscode/mcp.json` globally:
|
|
125
|
-
|
|
126
|
-
```json
|
|
127
|
-
{
|
|
128
|
-
"servers": {
|
|
129
|
-
"cortexdb": {
|
|
130
|
-
"command": "cortexdb-mcp"
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Windows tip
|
|
137
|
-
|
|
138
|
-
On Windows, MCP clients sometimes need the absolute path:
|
|
139
|
-
|
|
140
|
-
```json
|
|
141
|
-
{
|
|
142
|
-
"mcpServers": {
|
|
143
|
-
"cortexdb": {
|
|
144
|
-
"command": "C:\\Python310\\Scripts\\cortexdb-mcp.exe"
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## Tools
|
|
151
|
-
|
|
152
|
-
### Memory Operations
|
|
153
|
-
|
|
154
|
-
| Tool | Maps to | Description |
|
|
155
|
-
|------|---------|-------------|
|
|
156
|
-
| `memory_store` | `POST /v1/experience` | Store a new memory. Source/tags/type become labels. |
|
|
157
|
-
| `memory_status` | `GET /v1/experience/status` | Did a store land? Check by event ID or idempotency key after a timeout — "not found"/"failed" both mean re-storing is safe. |
|
|
158
|
-
| `memory_search` | `POST /v1/recall` | Search memories using natural language. |
|
|
159
|
-
| `memory_forget` | `POST /v1/forget` | Delete memories. With `query`, narrows by subject. Accepts `from_preview_id` from `forget_preview`. |
|
|
160
|
-
| `forget_preview` | `POST /v1/forget/preview` | Non-destructive dry run of a forget: per-layer estimated deletion counts + a `preview_id` for the safe two-phase flow. |
|
|
161
|
-
| `get_context` | `POST /v1/recall` (configured view; holistic by default) | By default, deep context across the requested scope, authorized ancestors, and authorized descendants—never siblings. |
|
|
162
|
-
| `advanced_search` | `POST /v1/recall` + temporal | Search with structured filters (time / source / type). |
|
|
163
|
-
|
|
164
|
-
### Event CRUD
|
|
165
|
-
|
|
166
|
-
| Tool | Maps to | Description |
|
|
167
|
-
|------|---------|-------------|
|
|
168
|
-
| `memory_list` | `GET /v1/events` | List events in scope, paginated. |
|
|
169
|
-
| `memory_get` | `GET /v1/events/{id}` | Fetch a single event (used for citations). |
|
|
170
|
-
| `memory_delete` | `POST /v1/forget` (memory_ids) | Delete one event by id. |
|
|
171
|
-
| `memory_bulk_delete` | `POST /v1/forget` or `/v1/forget/preview` | Bulk delete with selector-accurate dry-run support. |
|
|
172
|
-
|
|
173
|
-
### Knowledge Graph (facts-backed in v1)
|
|
174
|
-
|
|
175
|
-
| Tool | Maps to | Description |
|
|
176
|
-
|------|---------|-------------|
|
|
177
|
-
| `entity_list` | `GET /v1/facts` | List fact subjects, ranked by count. |
|
|
178
|
-
| `entity_get` | `GET /v1/facts?subject=…` | Fact lineage for a subject. |
|
|
179
|
-
| `entity_edges` | `GET /v1/facts?subject=…` | Predicate/object pairs for an entity. |
|
|
180
|
-
| `entity_link` | `POST /v1/experience` | Store a sentence the extractor will turn into a fact. |
|
|
181
|
-
| `belief_declare` | `POST /v1/beliefs` | Declare a belief directly, with optional evidence refs (`evt_...` / `fact_...`). |
|
|
182
|
-
|
|
183
|
-
### Bi-temporal Conflicts & Claim History
|
|
184
|
-
|
|
185
|
-
| Tool | Maps to | Description |
|
|
186
|
-
|------|---------|-------------|
|
|
187
|
-
| `list_conflicts` | `GET /v1/conflicts` | Queue of contradicting values detected for the same claim. |
|
|
188
|
-
| `resolve_conflict` | `POST /v1/conflicts/{id}/resolve` | Resolve: `pick` / `split` / `new_information` / `dismiss`. |
|
|
189
|
-
| `claim_history` | `GET /v1/claims/history` | Full bi-temporal change-log of one claim (+ its conflicts). |
|
|
190
|
-
|
|
191
|
-
Validity boundaries carry a basis: `stated` boundaries render as "since/until \<date\>"; `observed` boundaries are knowledge bounds and render as "by \<date\>" — never "on \<date\>".
|
|
192
|
-
|
|
193
|
-
### Admin & Observability
|
|
194
|
-
|
|
195
|
-
| Tool | Maps to | Description |
|
|
196
|
-
|------|---------|-------------|
|
|
197
|
-
| `health_check` | `GET /v1/auth/whoami` | Verify the bearer + reach the deployment policy. |
|
|
198
|
-
| `get_usage` | `GET /v1/auth/whoami` + headers | Tier, rate limit, token expiry. |
|
|
199
|
-
| `get_insights` | (in-process) | Proactive insights derived from stored episodes. |
|
|
200
|
-
|
|
201
|
-
### Removed from 0.3.0
|
|
202
|
-
|
|
203
|
-
`memory_update`, `export_data`, `import_data`, `get_ontology` — v1 has no direct equivalents. Updates: store a new event; bulk import: see `/v1/import` directly with the v1 envelope shape; ontology: not part of the v1 surface.
|
|
204
|
-
|
|
205
|
-
## Resources
|
|
206
|
-
|
|
207
|
-
Resources provide read-only data that AI tools can access:
|
|
208
|
-
|
|
209
|
-
| Resource URI | Description |
|
|
210
|
-
|---|---|
|
|
211
|
-
| `cortexdb://health` | Server health status |
|
|
212
|
-
| `cortexdb://episodes` | Recent 50 events in the default scope |
|
|
213
|
-
| `cortexdb://insights` | Proactive insights |
|
|
214
|
-
|
|
215
|
-
## Prompts
|
|
216
|
-
|
|
217
|
-
Pre-built prompt templates:
|
|
218
|
-
|
|
219
|
-
| Prompt | Description |
|
|
220
|
-
|---|---|
|
|
221
|
-
| `investigate_incident` | Investigate an incident using stored memories |
|
|
222
|
-
| `summarize_knowledge` | Summarize everything known about a topic |
|
|
223
|
-
| `deployment_review` | Pre-deployment safety review |
|
|
224
|
-
| `onboard_to_codebase` | Onboard to a codebase using stored knowledge |
|
|
225
|
-
| `weekly_digest` | Generate a weekly activity summary |
|
|
226
|
-
|
|
227
|
-
## Configuration
|
|
228
|
-
|
|
229
|
-
| Environment Variable | Default | Description |
|
|
230
|
-
|---|---|---|
|
|
231
|
-
| `CORTEXDB_URL` | `https://api-v1.cortexdb.ai` | CortexDB server URL |
|
|
232
|
-
| `CORTEXDB_API_KEY` | (none) | API key for authentication |
|
|
233
|
-
| `CORTEXDB_ACTOR` | (from signup state) | Actor for `X-Cortex-Actor`; must match the token subject |
|
|
234
|
-
| `CORTEXDB_SCOPE` | (from signup state) | Default scope for tool calls |
|
|
235
|
-
| `CORTEXDB_VIEW` | `holistic` | Recall reach: `holistic` = self + authorized ancestors + authorized descendants (no siblings); `descend` = self + authorized descendants; `granular` = exact scope |
|
|
236
|
-
| `CORTEXDB_TENANT_ID` | (none) | Legacy v0 tenant identifier |
|
|
237
|
-
| `CORTEXDB_TIMEOUT` | `30.0` | HTTP request timeout (seconds) |
|
|
238
|
-
|
|
239
|
-
## Examples
|
|
240
|
-
|
|
241
|
-
### Store a memory from Cursor
|
|
242
|
-
|
|
243
|
-
Ask your AI assistant:
|
|
244
|
-
> "Remember that the payments service was migrated to Stripe v3 on March 15th"
|
|
245
|
-
|
|
246
|
-
The assistant will call `memory_store` with the content.
|
|
247
|
-
|
|
248
|
-
### Search memories
|
|
249
|
-
|
|
250
|
-
> "What do we know about the payments service?"
|
|
251
|
-
|
|
252
|
-
The assistant calls `memory_search` and gets relevant context from CortexDB.
|
|
253
|
-
|
|
254
|
-
### Explore the knowledge graph
|
|
255
|
-
|
|
256
|
-
> "Show me all entities related to the auth service"
|
|
257
|
-
|
|
258
|
-
The assistant calls `entity_get` or `entity_edges` to traverse relationships.
|
|
259
|
-
|
|
260
|
-
### Pre-deployment review
|
|
261
|
-
|
|
262
|
-
> "Run a deployment review for the user-service"
|
|
263
|
-
|
|
264
|
-
Uses the `deployment_review` prompt to check for recent incidents, dependencies, and risks.
|
|
265
|
-
|
|
266
|
-
## Architecture
|
|
267
|
-
|
|
268
|
-
```
|
|
269
|
-
┌─────────────┐ stdio/SSE ┌──────────────┐ HTTP ┌──────────┐
|
|
270
|
-
│ AI Client │ ◄──────────────► │ MCP Server │ ◄──────────► │ CortexDB │
|
|
271
|
-
│ (Cursor, │ MCP JSON-RPC │ (this pkg) │ REST API │ Server │
|
|
272
|
-
│ Claude, │ │ │ │ │
|
|
273
|
-
│ VS Code) │ └──────────────┘ └──────────┘
|
|
274
|
-
└─────────────┘
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
The MCP server is a thin translation layer:
|
|
278
|
-
1. Receives MCP tool calls from the AI client
|
|
279
|
-
2. Translates them to CortexDB REST API calls
|
|
280
|
-
3. Formats responses for the AI to consume
|
|
281
|
-
|
|
282
|
-
## License
|
|
283
|
-
|
|
284
|
-
MIT
|
|
1
|
+
# CortexDB MCP Server
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server that gives AI tools persistent long-term memory via CortexDB. Works with Claude Desktop, Cursor, Windsurf, VS Code Copilot, and any MCP-compatible client.
|
|
4
|
+
|
|
5
|
+
> **0.3.0 rewrites the server against the v1 CortexDB API.** Default surface is now `https://api-v1.cortexdb.ai`. The server **auto-signs-up anonymously** on first launch — no API key required.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Install (the PyPI name is `cortexdb-mcp`)
|
|
11
|
+
pip install cortexdb-mcp
|
|
12
|
+
|
|
13
|
+
# Then run with zero config:
|
|
14
|
+
cortexdb-mcp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
For a coding agent that only needs repository intelligence, select the compact
|
|
18
|
+
read-only surface (four tools: explore, impact, inventory, graph):
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
cortexdb-mcp --tool-profile code
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This materially reduces tool-schema context while retaining natural-language
|
|
25
|
+
retrieval, typed traversal, prefix symbol discovery, and directory inventory.
|
|
26
|
+
|
|
27
|
+
That's it. On first launch the server hits `POST /v1/auth/signup`, mints a free-tier PASETO token + scope for itself, and caches them under `~/.config/cortexdb-mcp/state.json` (Linux/macOS) or `%APPDATA%\cortexdb-mcp\state.json` (Windows). Re-launches reuse the cached identity until the token expires (7 days); the cached `expires_at` is checked at load, and a token the server rejects with 401 is discarded and re-minted automatically, so no hand-deletion of `state.json` is needed. Signup runs against any configured `CORTEXDB_URL`, self-hosted included; a deployment with no minter answers 503 and the server carries on unauthenticated.
|
|
28
|
+
|
|
29
|
+
To target a custom deployment or pre-existing identity, set any of:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
export CORTEXDB_URL="https://api-v1.cortexdb.ai" # base URL
|
|
33
|
+
export CORTEXDB_API_KEY="v4.public..." # PASETO bearer token
|
|
34
|
+
export CORTEXDB_ACTOR="user:alice" # ActorId, sent as X-Cortex-Actor
|
|
35
|
+
export CORTEXDB_SCOPE="org:acme/user:alice" # default scope path
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## IDE Setup
|
|
39
|
+
|
|
40
|
+
Most clients just need a single line — the auto-signup handles the rest.
|
|
41
|
+
|
|
42
|
+
### Claude Desktop
|
|
43
|
+
|
|
44
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"mcpServers": {
|
|
49
|
+
"cortexdb": {
|
|
50
|
+
"command": "cortexdb-mcp"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
> **Windows note (audit POL-3):** if Claude Desktop / Cursor / Windsurf
|
|
57
|
+
> can't find `cortexdb-mcp` on PATH, give it the full path to the
|
|
58
|
+
> installed executable:
|
|
59
|
+
>
|
|
60
|
+
> ```json
|
|
61
|
+
> {
|
|
62
|
+
> "mcpServers": {
|
|
63
|
+
> "cortexdb": {
|
|
64
|
+
> "command": "C:\\Python313\\Scripts\\cortexdb-mcp.exe"
|
|
65
|
+
> }
|
|
66
|
+
> }
|
|
67
|
+
> }
|
|
68
|
+
> ```
|
|
69
|
+
>
|
|
70
|
+
> Locate it with `where cortexdb-mcp` in `cmd.exe` or
|
|
71
|
+
> `(Get-Command cortexdb-mcp).Source` in PowerShell.
|
|
72
|
+
>
|
|
73
|
+
> Some Windows terminals don't have UTF-8 enabled by default, which can
|
|
74
|
+
> garble emoji in `--help` output (they show as `?`). The server itself
|
|
75
|
+
> isn't affected — only the CLI banner. Run
|
|
76
|
+
> `chcp 65001` once per terminal session to fix.
|
|
77
|
+
|
|
78
|
+
### Claude Code (CLI)
|
|
79
|
+
|
|
80
|
+
Edit `~/.claude/mcp.json`:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"mcpServers": {
|
|
85
|
+
"cortexdb": {
|
|
86
|
+
"command": "cortexdb-mcp"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Cursor
|
|
93
|
+
|
|
94
|
+
Edit `~/.cursor/mcp.json`:
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"mcpServers": {
|
|
99
|
+
"cortexdb": {
|
|
100
|
+
"command": "cortexdb-mcp"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Or in Cursor Settings > MCP Servers > Add Server.
|
|
107
|
+
|
|
108
|
+
### Windsurf
|
|
109
|
+
|
|
110
|
+
Edit `~/.codeium/windsurf/mcp_config.json`:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"mcpServers": {
|
|
115
|
+
"cortexdb": {
|
|
116
|
+
"command": "cortexdb-mcp"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### VS Code (GitHub Copilot)
|
|
123
|
+
|
|
124
|
+
Add to `.vscode/mcp.json` in your project or `~/.vscode/mcp.json` globally:
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"servers": {
|
|
129
|
+
"cortexdb": {
|
|
130
|
+
"command": "cortexdb-mcp"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Windows tip
|
|
137
|
+
|
|
138
|
+
On Windows, MCP clients sometimes need the absolute path:
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"mcpServers": {
|
|
143
|
+
"cortexdb": {
|
|
144
|
+
"command": "C:\\Python310\\Scripts\\cortexdb-mcp.exe"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Tools
|
|
151
|
+
|
|
152
|
+
### Memory Operations
|
|
153
|
+
|
|
154
|
+
| Tool | Maps to | Description |
|
|
155
|
+
|------|---------|-------------|
|
|
156
|
+
| `memory_store` | `POST /v1/experience` | Store a new memory. Source/tags/type become labels. |
|
|
157
|
+
| `memory_status` | `GET /v1/experience/status` | Did a store land? Check by event ID or idempotency key after a timeout — "not found"/"failed" both mean re-storing is safe. |
|
|
158
|
+
| `memory_search` | `POST /v1/recall` | Search memories using natural language. |
|
|
159
|
+
| `memory_forget` | `POST /v1/forget` | Delete memories. With `query`, narrows by subject. Accepts `from_preview_id` from `forget_preview`. |
|
|
160
|
+
| `forget_preview` | `POST /v1/forget/preview` | Non-destructive dry run of a forget: per-layer estimated deletion counts + a `preview_id` for the safe two-phase flow. |
|
|
161
|
+
| `get_context` | `POST /v1/recall` (configured view; holistic by default) | By default, deep context across the requested scope, authorized ancestors, and authorized descendants—never siblings. |
|
|
162
|
+
| `advanced_search` | `POST /v1/recall` + temporal | Search with structured filters (time / source / type). |
|
|
163
|
+
|
|
164
|
+
### Event CRUD
|
|
165
|
+
|
|
166
|
+
| Tool | Maps to | Description |
|
|
167
|
+
|------|---------|-------------|
|
|
168
|
+
| `memory_list` | `GET /v1/events` | List events in scope, paginated. |
|
|
169
|
+
| `memory_get` | `GET /v1/events/{id}` | Fetch a single event (used for citations). |
|
|
170
|
+
| `memory_delete` | `POST /v1/forget` (memory_ids) | Delete one event by id. |
|
|
171
|
+
| `memory_bulk_delete` | `POST /v1/forget` or `/v1/forget/preview` | Bulk delete with selector-accurate dry-run support. |
|
|
172
|
+
|
|
173
|
+
### Knowledge Graph (facts-backed in v1)
|
|
174
|
+
|
|
175
|
+
| Tool | Maps to | Description |
|
|
176
|
+
|------|---------|-------------|
|
|
177
|
+
| `entity_list` | `GET /v1/facts` | List fact subjects, ranked by count. |
|
|
178
|
+
| `entity_get` | `GET /v1/facts?subject=…` | Fact lineage for a subject. |
|
|
179
|
+
| `entity_edges` | `GET /v1/facts?subject=…` | Predicate/object pairs for an entity. |
|
|
180
|
+
| `entity_link` | `POST /v1/experience` | Store a sentence the extractor will turn into a fact. |
|
|
181
|
+
| `belief_declare` | `POST /v1/beliefs` | Declare a belief directly, with optional evidence refs (`evt_...` / `fact_...`). |
|
|
182
|
+
|
|
183
|
+
### Bi-temporal Conflicts & Claim History
|
|
184
|
+
|
|
185
|
+
| Tool | Maps to | Description |
|
|
186
|
+
|------|---------|-------------|
|
|
187
|
+
| `list_conflicts` | `GET /v1/conflicts` | Queue of contradicting values detected for the same claim. |
|
|
188
|
+
| `resolve_conflict` | `POST /v1/conflicts/{id}/resolve` | Resolve: `pick` / `split` / `new_information` / `dismiss`. |
|
|
189
|
+
| `claim_history` | `GET /v1/claims/history` | Full bi-temporal change-log of one claim (+ its conflicts). |
|
|
190
|
+
|
|
191
|
+
Validity boundaries carry a basis: `stated` boundaries render as "since/until \<date\>"; `observed` boundaries are knowledge bounds and render as "by \<date\>" — never "on \<date\>".
|
|
192
|
+
|
|
193
|
+
### Admin & Observability
|
|
194
|
+
|
|
195
|
+
| Tool | Maps to | Description |
|
|
196
|
+
|------|---------|-------------|
|
|
197
|
+
| `health_check` | `GET /v1/auth/whoami` | Verify the bearer + reach the deployment policy. |
|
|
198
|
+
| `get_usage` | `GET /v1/auth/whoami` + headers | Tier, rate limit, token expiry. |
|
|
199
|
+
| `get_insights` | (in-process) | Proactive insights derived from stored episodes. |
|
|
200
|
+
|
|
201
|
+
### Removed from 0.3.0
|
|
202
|
+
|
|
203
|
+
`memory_update`, `export_data`, `import_data`, `get_ontology` — v1 has no direct equivalents. Updates: store a new event; bulk import: see `/v1/import` directly with the v1 envelope shape; ontology: not part of the v1 surface.
|
|
204
|
+
|
|
205
|
+
## Resources
|
|
206
|
+
|
|
207
|
+
Resources provide read-only data that AI tools can access:
|
|
208
|
+
|
|
209
|
+
| Resource URI | Description |
|
|
210
|
+
|---|---|
|
|
211
|
+
| `cortexdb://health` | Server health status |
|
|
212
|
+
| `cortexdb://episodes` | Recent 50 events in the default scope |
|
|
213
|
+
| `cortexdb://insights` | Proactive insights |
|
|
214
|
+
|
|
215
|
+
## Prompts
|
|
216
|
+
|
|
217
|
+
Pre-built prompt templates:
|
|
218
|
+
|
|
219
|
+
| Prompt | Description |
|
|
220
|
+
|---|---|
|
|
221
|
+
| `investigate_incident` | Investigate an incident using stored memories |
|
|
222
|
+
| `summarize_knowledge` | Summarize everything known about a topic |
|
|
223
|
+
| `deployment_review` | Pre-deployment safety review |
|
|
224
|
+
| `onboard_to_codebase` | Onboard to a codebase using stored knowledge |
|
|
225
|
+
| `weekly_digest` | Generate a weekly activity summary |
|
|
226
|
+
|
|
227
|
+
## Configuration
|
|
228
|
+
|
|
229
|
+
| Environment Variable | Default | Description |
|
|
230
|
+
|---|---|---|
|
|
231
|
+
| `CORTEXDB_URL` | `https://api-v1.cortexdb.ai` | CortexDB server URL |
|
|
232
|
+
| `CORTEXDB_API_KEY` | (none) | API key for authentication |
|
|
233
|
+
| `CORTEXDB_ACTOR` | (from signup state) | Actor for `X-Cortex-Actor`; must match the token subject |
|
|
234
|
+
| `CORTEXDB_SCOPE` | (from signup state) | Default scope for tool calls |
|
|
235
|
+
| `CORTEXDB_VIEW` | `holistic` | Recall reach: `holistic` = self + authorized ancestors + authorized descendants (no siblings); `descend` = self + authorized descendants; `granular` = exact scope |
|
|
236
|
+
| `CORTEXDB_TENANT_ID` | (none) | Legacy v0 tenant identifier |
|
|
237
|
+
| `CORTEXDB_TIMEOUT` | `30.0` | HTTP request timeout (seconds) |
|
|
238
|
+
|
|
239
|
+
## Examples
|
|
240
|
+
|
|
241
|
+
### Store a memory from Cursor
|
|
242
|
+
|
|
243
|
+
Ask your AI assistant:
|
|
244
|
+
> "Remember that the payments service was migrated to Stripe v3 on March 15th"
|
|
245
|
+
|
|
246
|
+
The assistant will call `memory_store` with the content.
|
|
247
|
+
|
|
248
|
+
### Search memories
|
|
249
|
+
|
|
250
|
+
> "What do we know about the payments service?"
|
|
251
|
+
|
|
252
|
+
The assistant calls `memory_search` and gets relevant context from CortexDB.
|
|
253
|
+
|
|
254
|
+
### Explore the knowledge graph
|
|
255
|
+
|
|
256
|
+
> "Show me all entities related to the auth service"
|
|
257
|
+
|
|
258
|
+
The assistant calls `entity_get` or `entity_edges` to traverse relationships.
|
|
259
|
+
|
|
260
|
+
### Pre-deployment review
|
|
261
|
+
|
|
262
|
+
> "Run a deployment review for the user-service"
|
|
263
|
+
|
|
264
|
+
Uses the `deployment_review` prompt to check for recent incidents, dependencies, and risks.
|
|
265
|
+
|
|
266
|
+
## Architecture
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
┌─────────────┐ stdio/SSE ┌──────────────┐ HTTP ┌──────────┐
|
|
270
|
+
│ AI Client │ ◄──────────────► │ MCP Server │ ◄──────────► │ CortexDB │
|
|
271
|
+
│ (Cursor, │ MCP JSON-RPC │ (this pkg) │ REST API │ Server │
|
|
272
|
+
│ Claude, │ │ │ │ │
|
|
273
|
+
│ VS Code) │ └──────────────┘ └──────────┘
|
|
274
|
+
└─────────────┘
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
The MCP server is a thin translation layer:
|
|
278
|
+
1. Receives MCP tool calls from the AI client
|
|
279
|
+
2. Translates them to CortexDB REST API calls
|
|
280
|
+
3. Formats responses for the AI to consume
|
|
281
|
+
|
|
282
|
+
## License
|
|
283
|
+
|
|
284
|
+
MIT
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"""Allow ``python -m cortexdb_mcp`` to launch the MCP server."""
|
|
2
|
-
|
|
3
|
-
from cortexdb_mcp.server import main
|
|
4
|
-
|
|
5
|
-
main()
|
|
1
|
+
"""Allow ``python -m cortexdb_mcp`` to launch the MCP server."""
|
|
2
|
+
|
|
3
|
+
from cortexdb_mcp.server import main
|
|
4
|
+
|
|
5
|
+
main()
|