cortexdb-mcp 0.2.0__py3-none-any.whl
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/__init__.py +3 -0
- cortexdb_mcp/api.py +132 -0
- cortexdb_mcp/config.py +40 -0
- cortexdb_mcp/insights.py +640 -0
- cortexdb_mcp/server.py +1085 -0
- cortexdb_mcp-0.2.0.dist-info/METADATA +276 -0
- cortexdb_mcp-0.2.0.dist-info/RECORD +9 -0
- cortexdb_mcp-0.2.0.dist-info/WHEEL +4 -0
- cortexdb_mcp-0.2.0.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cortexdb-mcp
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: MCP Server for CortexDB — expose memory operations to AI agents
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Requires-Dist: fastapi>=0.110
|
|
8
|
+
Requires-Dist: httpx>=0.27
|
|
9
|
+
Requires-Dist: mcp>=1.0
|
|
10
|
+
Requires-Dist: pydantic>=2.0
|
|
11
|
+
Requires-Dist: uvicorn>=0.29
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# CortexDB MCP Server
|
|
15
|
+
|
|
16
|
+
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.
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Install
|
|
22
|
+
pip install -e .
|
|
23
|
+
|
|
24
|
+
# Or with uvx (no install needed)
|
|
25
|
+
uvx --from . cortexdb-mcp
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Set your environment variables:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
export CORTEXDB_URL="https://api.cortexdb.ai" # or http://localhost:3141
|
|
32
|
+
export CORTEXDB_API_KEY="cx_live_your_key_here"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Run:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
cortexdb-mcp
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## IDE Setup
|
|
42
|
+
|
|
43
|
+
### Claude Desktop
|
|
44
|
+
|
|
45
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"cortexdb": {
|
|
51
|
+
"command": "cortexdb-mcp",
|
|
52
|
+
"env": {
|
|
53
|
+
"CORTEXDB_URL": "https://api.cortexdb.ai",
|
|
54
|
+
"CORTEXDB_API_KEY": "cx_live_your_key_here"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Claude Code (CLI)
|
|
62
|
+
|
|
63
|
+
Edit `~/.claude/mcp.json`:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"cortexdb": {
|
|
69
|
+
"command": "cortexdb-mcp",
|
|
70
|
+
"env": {
|
|
71
|
+
"CORTEXDB_URL": "https://api.cortexdb.ai",
|
|
72
|
+
"CORTEXDB_API_KEY": "cx_live_your_key_here"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Cursor
|
|
80
|
+
|
|
81
|
+
Edit `~/.cursor/mcp.json`:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"mcpServers": {
|
|
86
|
+
"cortexdb": {
|
|
87
|
+
"command": "cortexdb-mcp",
|
|
88
|
+
"env": {
|
|
89
|
+
"CORTEXDB_URL": "https://api.cortexdb.ai",
|
|
90
|
+
"CORTEXDB_API_KEY": "cx_live_your_key_here"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Or in Cursor Settings > MCP Servers > Add Server.
|
|
98
|
+
|
|
99
|
+
### Windsurf
|
|
100
|
+
|
|
101
|
+
Edit `~/.codeium/windsurf/mcp_config.json`:
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"mcpServers": {
|
|
106
|
+
"cortexdb": {
|
|
107
|
+
"command": "cortexdb-mcp",
|
|
108
|
+
"env": {
|
|
109
|
+
"CORTEXDB_URL": "https://api.cortexdb.ai",
|
|
110
|
+
"CORTEXDB_API_KEY": "cx_live_your_key_here"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### VS Code (GitHub Copilot)
|
|
118
|
+
|
|
119
|
+
Add to `.vscode/mcp.json` in your project or `~/.vscode/mcp.json` globally:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"servers": {
|
|
124
|
+
"cortexdb": {
|
|
125
|
+
"command": "cortexdb-mcp",
|
|
126
|
+
"env": {
|
|
127
|
+
"CORTEXDB_URL": "https://api.cortexdb.ai",
|
|
128
|
+
"CORTEXDB_API_KEY": "cx_live_your_key_here"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Docker
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
docker build -t cortexdb-mcp .
|
|
139
|
+
docker run -e CORTEXDB_URL=https://api.cortexdb.ai -e CORTEXDB_API_KEY=cx_live_... cortexdb-mcp
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Tools
|
|
143
|
+
|
|
144
|
+
### Memory Operations
|
|
145
|
+
|
|
146
|
+
| Tool | Description |
|
|
147
|
+
|------|-------------|
|
|
148
|
+
| `memory_store` | Store a new memory with optional source, type, tags, TTL |
|
|
149
|
+
| `memory_search` | Search memories using natural language (hybrid retrieval) |
|
|
150
|
+
| `memory_forget` | Delete memories with audit trail (GDPR-compliant) |
|
|
151
|
+
| `get_context` | Deep contextual retrieval combining search + graph |
|
|
152
|
+
| `advanced_search` | Search with structured filters (source, type, time range) |
|
|
153
|
+
|
|
154
|
+
### Episode Management
|
|
155
|
+
|
|
156
|
+
| Tool | Description |
|
|
157
|
+
|------|-------------|
|
|
158
|
+
| `memory_list` | List episodes with pagination and type filter |
|
|
159
|
+
| `memory_get` | Get a specific episode by ID |
|
|
160
|
+
| `memory_update` | Update episode content or metadata |
|
|
161
|
+
| `memory_delete` | Delete a specific episode by ID |
|
|
162
|
+
| `memory_bulk_delete` | Bulk delete with query matching and dry-run support |
|
|
163
|
+
|
|
164
|
+
### Knowledge Graph
|
|
165
|
+
|
|
166
|
+
| Tool | Description |
|
|
167
|
+
|------|-------------|
|
|
168
|
+
| `entity_list` | List entities (people, services, projects, concepts) |
|
|
169
|
+
| `entity_get` | Get entity details including relationships and recent episodes |
|
|
170
|
+
| `entity_edges` | Get all relationships for an entity |
|
|
171
|
+
| `entity_link` | Create a relationship between two entities |
|
|
172
|
+
|
|
173
|
+
### Admin & Observability
|
|
174
|
+
|
|
175
|
+
| Tool | Description |
|
|
176
|
+
|------|-------------|
|
|
177
|
+
| `health_check` | Check CortexDB server health |
|
|
178
|
+
| `get_usage` | View usage stats and tier limits |
|
|
179
|
+
| `get_insights` | Generate proactive insights (incident spikes, gaps, risks) |
|
|
180
|
+
| `get_ontology` | View entity types and relationship types |
|
|
181
|
+
| `export_data` | Export memories as JSON |
|
|
182
|
+
| `import_data` | Import memories from JSON |
|
|
183
|
+
|
|
184
|
+
## Resources
|
|
185
|
+
|
|
186
|
+
Resources provide read-only data that AI tools can access:
|
|
187
|
+
|
|
188
|
+
| Resource URI | Description |
|
|
189
|
+
|---|---|
|
|
190
|
+
| `cortexdb://health` | Server health status |
|
|
191
|
+
| `cortexdb://metrics` | Request metrics (total, active, errors, rate-limited) |
|
|
192
|
+
| `cortexdb://usage` | Usage statistics and tier limits |
|
|
193
|
+
| `cortexdb://episodes` | Recent 50 episodes |
|
|
194
|
+
| `cortexdb://entities` | Top 100 knowledge graph entities |
|
|
195
|
+
| `cortexdb://insights` | Proactive insights |
|
|
196
|
+
| `cortexdb://ontology` | Entity and relationship type schema |
|
|
197
|
+
|
|
198
|
+
## Prompts
|
|
199
|
+
|
|
200
|
+
Pre-built prompt templates:
|
|
201
|
+
|
|
202
|
+
| Prompt | Description |
|
|
203
|
+
|---|---|
|
|
204
|
+
| `investigate_incident` | Investigate an incident using stored memories |
|
|
205
|
+
| `summarize_knowledge` | Summarize everything known about a topic |
|
|
206
|
+
| `deployment_review` | Pre-deployment safety review |
|
|
207
|
+
| `onboard_to_codebase` | Onboard to a codebase using stored knowledge |
|
|
208
|
+
| `weekly_digest` | Generate a weekly activity summary |
|
|
209
|
+
|
|
210
|
+
## Configuration
|
|
211
|
+
|
|
212
|
+
| Environment Variable | Default | Description |
|
|
213
|
+
|---|---|---|
|
|
214
|
+
| `CORTEXDB_URL` | `http://localhost:3141` | CortexDB server URL |
|
|
215
|
+
| `CORTEXDB_API_KEY` | (none) | API key for authentication |
|
|
216
|
+
| `CORTEXDB_TIMEOUT` | `30.0` | HTTP request timeout (seconds) |
|
|
217
|
+
|
|
218
|
+
## Examples
|
|
219
|
+
|
|
220
|
+
### Store a memory from Cursor
|
|
221
|
+
|
|
222
|
+
Ask your AI assistant:
|
|
223
|
+
> "Remember that the payments service was migrated to Stripe v3 on March 15th"
|
|
224
|
+
|
|
225
|
+
The assistant will call `memory_store` with the content.
|
|
226
|
+
|
|
227
|
+
### Search memories
|
|
228
|
+
|
|
229
|
+
> "What do we know about the payments service?"
|
|
230
|
+
|
|
231
|
+
The assistant calls `memory_search` and gets relevant context from CortexDB.
|
|
232
|
+
|
|
233
|
+
### Explore the knowledge graph
|
|
234
|
+
|
|
235
|
+
> "Show me all entities related to the auth service"
|
|
236
|
+
|
|
237
|
+
The assistant calls `entity_get` or `entity_edges` to traverse relationships.
|
|
238
|
+
|
|
239
|
+
### Pre-deployment review
|
|
240
|
+
|
|
241
|
+
> "Run a deployment review for the user-service"
|
|
242
|
+
|
|
243
|
+
Uses the `deployment_review` prompt to check for recent incidents, dependencies, and risks.
|
|
244
|
+
|
|
245
|
+
## Development
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Install in dev mode
|
|
249
|
+
pip install -e ".[dev]"
|
|
250
|
+
|
|
251
|
+
# Run tests
|
|
252
|
+
pytest
|
|
253
|
+
|
|
254
|
+
# Run the server locally
|
|
255
|
+
CORTEXDB_URL=http://localhost:3141 CORTEXDB_API_KEY=test cortexdb-mcp
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Architecture
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
┌─────────────┐ stdio/SSE ┌──────────────┐ HTTP ┌──────────┐
|
|
262
|
+
│ AI Client │ ◄──────────────► │ MCP Server │ ◄──────────► │ CortexDB │
|
|
263
|
+
│ (Cursor, │ MCP JSON-RPC │ (this pkg) │ REST API │ Server │
|
|
264
|
+
│ Claude, │ │ │ │ │
|
|
265
|
+
│ VS Code) │ └──────────────┘ └──────────┘
|
|
266
|
+
└─────────────┘
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
The MCP server is a thin translation layer:
|
|
270
|
+
1. Receives MCP tool calls from the AI client
|
|
271
|
+
2. Translates them to CortexDB REST API calls
|
|
272
|
+
3. Formats responses for the AI to consume
|
|
273
|
+
|
|
274
|
+
## License
|
|
275
|
+
|
|
276
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
cortexdb_mcp/__init__.py,sha256=HPlG_zeJso_arUjh9nnr4Iv6F-1iiOLOe9TuwT3Xx6M,108
|
|
2
|
+
cortexdb_mcp/api.py,sha256=3KODq2MhZDopnyRq7pTTi6sif0jPdIXRjDqKZH3Kxkg,4118
|
|
3
|
+
cortexdb_mcp/config.py,sha256=PcSj6zvm8lXi888pkTA--6oiur67zWZKpN_iQ4nQQpI,1241
|
|
4
|
+
cortexdb_mcp/insights.py,sha256=NchlNgPHRYSueRYDHQjseLybwo5bA11AXkaJ9oQkO3g,23771
|
|
5
|
+
cortexdb_mcp/server.py,sha256=AydM-y8BfvlTq1UgqdfxPvXbeu93-17DiUHvvFXscHM,33519
|
|
6
|
+
cortexdb_mcp-0.2.0.dist-info/METADATA,sha256=r6jk3ZroowYlIEXe8DX_RIDCOnrLca5Grlj8giJcrV4,7194
|
|
7
|
+
cortexdb_mcp-0.2.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
8
|
+
cortexdb_mcp-0.2.0.dist-info/entry_points.txt,sha256=7rM4mgeV1attnFJLzhGZSUNhFgqUwLVefS0QsA5WSJ8,58
|
|
9
|
+
cortexdb_mcp-0.2.0.dist-info/RECORD,,
|