indra_db_mcp 0.1.0
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.
- package/README.md +225 -0
- package/package.json +52 -0
- package/src/index.ts +529 -0
- package/src/indra-client.ts +488 -0
- package/src/types.ts +263 -0
package/README.md
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# indra_db_mcp
|
|
2
|
+
|
|
3
|
+
> **Think out loud. Remember what matters. Watch understanding evolve.**
|
|
4
|
+
|
|
5
|
+
An MCP (Model Context Protocol) server that gives AI models a place to externalize their thinking. Built on [indra_db](https://github.com/moonstripe/indra_db) โ a content-addressed graph database for versioned thoughts.
|
|
6
|
+
|
|
7
|
+
## Why This Exists
|
|
8
|
+
|
|
9
|
+
Most AI interactions are ephemeral. Insights evaporate. Reasoning chains vanish. Good ideas get rediscovered instead of built upon.
|
|
10
|
+
|
|
11
|
+
**indra_db_mcp** changes that by giving models (and humans) a shared space to:
|
|
12
|
+
|
|
13
|
+
- ๐ง **Capture thoughts** as they emerge during reasoning
|
|
14
|
+
- ๐ **Connect ideas** into a web of understanding
|
|
15
|
+
- ๐ฎ **Search by meaning** not just keywords
|
|
16
|
+
- ๐ฟ **Branch and explore** alternative lines of thinking
|
|
17
|
+
- ๐ **Track evolution** of understanding over time
|
|
18
|
+
|
|
19
|
+
It's git for thoughts. Version-controlled thinking. A knowledge graph that grows with every conversation.
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### Prerequisites
|
|
24
|
+
|
|
25
|
+
- [Bun](https://bun.sh/) runtime (v1.0+)
|
|
26
|
+
- [Rust/Cargo](https://rustup.rs/) (for auto-installing indra_db CLI)
|
|
27
|
+
|
|
28
|
+
### Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Clone and install
|
|
32
|
+
git clone https://github.com/your-username/indra_db_mcp
|
|
33
|
+
cd indra_db_mcp
|
|
34
|
+
bun install
|
|
35
|
+
|
|
36
|
+
# The indra CLI will auto-install on first run via cargo
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Configure with Claude Desktop
|
|
40
|
+
|
|
41
|
+
Add to your `claude_desktop_config.json`:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"indra": {
|
|
47
|
+
"command": "bun",
|
|
48
|
+
"args": ["run", "/path/to/indra_db_mcp/src/index.ts"],
|
|
49
|
+
"env": {
|
|
50
|
+
"INDRA_DB_PATH": "~/.thoughts.indra"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Environment Variables
|
|
58
|
+
|
|
59
|
+
| Variable | Description | Default |
|
|
60
|
+
|----------|-------------|---------|
|
|
61
|
+
| `INDRA_DB_PATH` | Path to database file | `./thoughts.indra` (local) |
|
|
62
|
+
|
|
63
|
+
When `INDRA_DB_PATH` is set, uses that path (supports `~` for home directory).
|
|
64
|
+
When unset, creates `thoughts.indra` in the current working directory.
|
|
65
|
+
|
|
66
|
+
## Available Tools
|
|
67
|
+
|
|
68
|
+
### ๐ง Thought Capture
|
|
69
|
+
|
|
70
|
+
| Tool | Description |
|
|
71
|
+
|------|-------------|
|
|
72
|
+
| `remember` | Capture a thought with optional ID. Embeddings auto-generated for semantic search. |
|
|
73
|
+
| `recall` | Retrieve a specific thought by ID. |
|
|
74
|
+
| `revise` | Update a thought while preserving history. |
|
|
75
|
+
| `forget` | Remove from current state (preserved in history). |
|
|
76
|
+
| `list_thoughts` | See all thoughts in the graph. |
|
|
77
|
+
|
|
78
|
+
### ๐ Relationship Building
|
|
79
|
+
|
|
80
|
+
| Tool | Description |
|
|
81
|
+
|------|-------------|
|
|
82
|
+
| `connect` | Create typed relationship between thoughts. |
|
|
83
|
+
| `disconnect` | Remove a relationship. |
|
|
84
|
+
| `explore` | Traverse connections from a thought. |
|
|
85
|
+
|
|
86
|
+
**Built-in relationship types:**
|
|
87
|
+
- `supports` โ evidence/backing
|
|
88
|
+
- `contradicts` โ conflicts with
|
|
89
|
+
- `derives_from` โ evolved from
|
|
90
|
+
- `part_of` โ component of larger idea
|
|
91
|
+
- `causes` โ leads to
|
|
92
|
+
- `precedes` โ temporal ordering
|
|
93
|
+
- `similar_to` โ related concepts
|
|
94
|
+
- `relates_to` โ general connection
|
|
95
|
+
|
|
96
|
+
### ๐ฎ Semantic Search
|
|
97
|
+
|
|
98
|
+
| Tool | Description |
|
|
99
|
+
|------|-------------|
|
|
100
|
+
| `search` | Find thoughts by meaning using vector embeddings. |
|
|
101
|
+
|
|
102
|
+
### ๐ Version Control
|
|
103
|
+
|
|
104
|
+
| Tool | Description |
|
|
105
|
+
|------|-------------|
|
|
106
|
+
| `checkpoint` | Commit current state with a message. |
|
|
107
|
+
| `history` | View commit log showing evolution. |
|
|
108
|
+
| `branch` | Create new line of exploration. |
|
|
109
|
+
| `switch_branch` | Move between branches. |
|
|
110
|
+
| `list_branches` | See all branches. |
|
|
111
|
+
| `compare` | Diff between states. |
|
|
112
|
+
| `status` | Current database overview. |
|
|
113
|
+
|
|
114
|
+
## Example Session
|
|
115
|
+
|
|
116
|
+
Here's how an AI might use this during reasoning:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
User: Help me think through whether to use microservices or a monolith for my startup.
|
|
120
|
+
|
|
121
|
+
AI: Let me capture my initial thoughts on this decision...
|
|
122
|
+
|
|
123
|
+
[Uses remember] "The microservices vs monolith decision depends heavily on team size,
|
|
124
|
+
expected scale, and operational maturity"
|
|
125
|
+
|
|
126
|
+
[Uses remember] "Startups typically benefit from monoliths initially - faster iteration,
|
|
127
|
+
simpler deployment, easier debugging"
|
|
128
|
+
|
|
129
|
+
[Uses remember] "Microservices add operational overhead: service discovery, distributed
|
|
130
|
+
tracing, network latency, deployment complexity"
|
|
131
|
+
|
|
132
|
+
[Uses connect] "monolith-benefits" --[supports]--> "startup-recommendation"
|
|
133
|
+
[Uses connect] "microservices-overhead" --[contradicts]--> "premature-microservices"
|
|
134
|
+
|
|
135
|
+
[Uses checkpoint] "Initial analysis of architecture decision"
|
|
136
|
+
|
|
137
|
+
Let me explore an alternative perspective...
|
|
138
|
+
|
|
139
|
+
[Uses branch] "microservices-case"
|
|
140
|
+
[Uses switch_branch] "microservices-case"
|
|
141
|
+
|
|
142
|
+
[Uses remember] "If expecting rapid team growth, microservices enable independent
|
|
143
|
+
team ownership and deployment"
|
|
144
|
+
|
|
145
|
+
[Uses search] "team scaling"
|
|
146
|
+
// Finds related thoughts about team dynamics
|
|
147
|
+
|
|
148
|
+
[Uses switch_branch] "main"
|
|
149
|
+
[Uses compare] "main" vs "microservices-case"
|
|
150
|
+
// Shows what each branch explored
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Architecture
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
157
|
+
โ MCP Client (Claude) โ
|
|
158
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
159
|
+
โ MCP Protocol (stdio)
|
|
160
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
161
|
+
โ indra_db_mcp (Bun) โ
|
|
162
|
+
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โ
|
|
163
|
+
โ โ MCP SDK โ โ IndraClient โ โ Type Safety โ โ
|
|
164
|
+
โ โโโโโโโโโโโโโโโ โโโโโโโโฌโโโโโโโโ โโโโโโโโโโโโโโโโโ โ
|
|
165
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
166
|
+
โ CLI subprocess (JSON)
|
|
167
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
168
|
+
โ indra CLI (Rust) โ
|
|
169
|
+
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โ
|
|
170
|
+
โ โ Graph Store โ โ Embeddings โ โ Git-like VCS โ โ
|
|
171
|
+
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โ
|
|
172
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
173
|
+
โ
|
|
174
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
175
|
+
โ thoughts.indra (Single File) โ
|
|
176
|
+
โ Content-addressed objects, BLAKE3 hashes, zstd compressedโ
|
|
177
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Development
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Run with watch mode
|
|
184
|
+
bun run dev
|
|
185
|
+
|
|
186
|
+
# Type check
|
|
187
|
+
bun run typecheck
|
|
188
|
+
|
|
189
|
+
# Run tests
|
|
190
|
+
bun test
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## How It Works
|
|
194
|
+
|
|
195
|
+
1. **Content Addressing**: Every thought is hashed (BLAKE3). Identity comes from content.
|
|
196
|
+
|
|
197
|
+
2. **Embeddings**: Using `sentence-transformers/all-MiniLM-L6-v2` locally via HuggingFace.
|
|
198
|
+
Thoughts are embedded on creation for semantic search.
|
|
199
|
+
|
|
200
|
+
3. **Graph Structure**: Thoughts are nodes, relationships are typed/weighted edges.
|
|
201
|
+
Edges "float" to latest node versions.
|
|
202
|
+
|
|
203
|
+
4. **Version Control**: Git-like commits create snapshots. Branches enable parallel exploration.
|
|
204
|
+
Full history preserved โ nothing truly deleted.
|
|
205
|
+
|
|
206
|
+
5. **Single File**: Everything stored in one `.indra` file. Easy to backup, share, version.
|
|
207
|
+
|
|
208
|
+
## Philosophical Note
|
|
209
|
+
|
|
210
|
+
This project is named after [Indra's Net](https://en.wikipedia.org/wiki/Indra%27s_net) โ
|
|
211
|
+
a Buddhist metaphor where reality is a vast net of jewels, each reflecting all others.
|
|
212
|
+
|
|
213
|
+
Your thoughts are like those jewels. Each one reflects and connects to others.
|
|
214
|
+
The web of connections *is* your understanding. This tool makes that web visible,
|
|
215
|
+
versionable, and searchable.
|
|
216
|
+
|
|
217
|
+
## License
|
|
218
|
+
|
|
219
|
+
MIT
|
|
220
|
+
|
|
221
|
+
## Related
|
|
222
|
+
|
|
223
|
+
- [indra_db](https://github.com/moonstripe/indra_db) โ The underlying Rust database
|
|
224
|
+
- [MCP Specification](https://modelcontextprotocol.io/) โ Model Context Protocol docs
|
|
225
|
+
- [indranet](https://github.com/moonstripe/indranet) โ Online viewing tool (coming soon)
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "indra_db_mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for indra_db - a content-addressed graph database for versioned thoughts",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"indra-mcp": "./src/index.ts"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "bun run src/index.ts",
|
|
12
|
+
"dev": "bun --watch run src/index.ts",
|
|
13
|
+
"typecheck": "tsc --noEmit",
|
|
14
|
+
"test": "bun test"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"mcp",
|
|
18
|
+
"model-context-protocol",
|
|
19
|
+
"indra_db",
|
|
20
|
+
"knowledge-graph",
|
|
21
|
+
"vector-database",
|
|
22
|
+
"versioned-thoughts",
|
|
23
|
+
"ai-memory",
|
|
24
|
+
"semantic-search",
|
|
25
|
+
"graph-database"
|
|
26
|
+
],
|
|
27
|
+
"author": "moonstripe",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/moonstripe/indra_db_mcp.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/moonstripe/indra_db_mcp/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/moonstripe/indra_db_mcp#readme",
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/bun": "latest",
|
|
39
|
+
"typescript": "^5"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
43
|
+
"zod": "^4.3.6"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"bun": ">=1.0.0"
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"src",
|
|
50
|
+
"README.md"
|
|
51
|
+
]
|
|
52
|
+
}
|