mcp-sqlite-memory-bank 1.3.1__tar.gz → 1.4.2__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.
- {mcp_sqlite_memory_bank-1.3.1/src/mcp_sqlite_memory_bank.egg-info → mcp_sqlite_memory_bank-1.4.2}/PKG-INFO +164 -4
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/README.md +163 -3
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/pyproject.toml +1 -1
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/src/mcp_sqlite_memory_bank/database.py +14 -6
- mcp_sqlite_memory_bank-1.4.2/src/mcp_sqlite_memory_bank/prompts.py +256 -0
- mcp_sqlite_memory_bank-1.4.2/src/mcp_sqlite_memory_bank/resources.py +176 -0
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/src/mcp_sqlite_memory_bank/semantic.py +4 -4
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/src/mcp_sqlite_memory_bank/server.py +310 -15
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2/src/mcp_sqlite_memory_bank.egg-info}/PKG-INFO +164 -4
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/src/mcp_sqlite_memory_bank.egg-info/SOURCES.txt +2 -0
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/LICENSE +0 -0
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/MANIFEST.in +0 -0
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/setup.cfg +0 -0
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/src/mcp_sqlite_memory_bank/__init__.py +0 -0
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/src/mcp_sqlite_memory_bank/py.typed +0 -0
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/src/mcp_sqlite_memory_bank/types.py +0 -0
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/src/mcp_sqlite_memory_bank/utils.py +0 -0
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/src/mcp_sqlite_memory_bank.egg-info/dependency_links.txt +0 -0
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/src/mcp_sqlite_memory_bank.egg-info/entry_points.txt +0 -0
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/src/mcp_sqlite_memory_bank.egg-info/requires.txt +0 -0
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/src/mcp_sqlite_memory_bank.egg-info/top_level.txt +0 -0
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/tests/test_api.py +0 -0
- {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/tests/test_server.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mcp_sqlite_memory_bank
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.4.2
|
4
4
|
Summary: A dynamic, agent/LLM-friendly SQLite memory bank for MCP servers with semantic search capabilities.
|
5
5
|
Author-email: Robert Meisner <robert@catchit.pl>
|
6
6
|
License-Expression: MIT
|
@@ -40,10 +40,14 @@ This project provides a robust, discoverable API for creating, exploring, and ma
|
|
40
40
|
- Build and query knowledge graphs for semantic search and reasoning
|
41
41
|
- Store, retrieve, and organize notes or structured data for LLM agents
|
42
42
|
- Enable natural language workflows for database management and exploration
|
43
|
+
- Intelligent content discovery with semantic search capabilities
|
44
|
+
- Access memory content through standardized MCP Resources and Prompts
|
43
45
|
- Integrate with FastMCP, Claude Desktop, and other agent platforms for seamless tool discovery
|
44
46
|
|
45
47
|
**Why mcp_sqlite_memory_bank?**
|
46
|
-
-
|
48
|
+
- **Full MCP Compliance:** Resources, Prompts, and 20+ organized tools
|
49
|
+
- **Semantic Search:** Natural language content discovery with AI-powered similarity matching
|
50
|
+
- **Explicit, discoverable APIs** for LLMs and agents with enhanced categorization
|
47
51
|
- Safe, parameterized queries and schema management
|
48
52
|
- Designed for extensibility and open source collaboration
|
49
53
|
|
@@ -108,18 +112,59 @@ Restart your IDE and try asking your AI assistant:
|
|
108
112
|
- **Dynamic Table Management:** Create, list, describe, rename, and drop tables at runtime
|
109
113
|
- **CRUD Operations:** Insert, read, update, and delete rows in any table
|
110
114
|
- **Safe SQL:** Run parameterized SELECT queries with input validation
|
115
|
+
- **Semantic Search:** Natural language search using sentence-transformers for intelligent content discovery
|
116
|
+
- **MCP Resources:** Access memory content through standardized MCP resource URIs
|
117
|
+
- **MCP Prompts:** Built-in intelligent prompts for common memory analysis workflows
|
118
|
+
- **Tool Categorization:** Organized tool discovery with detailed usage examples for enhanced LLM integration
|
111
119
|
- **Knowledge Graph Tools:** Built-in support for node/edge schemas and property graphs
|
112
120
|
- **Agent/LLM Integration:** Explicit, tool-based APIs for easy discovery and automation
|
113
121
|
- **Open Source:** MIT licensed, fully tested, and ready for community use
|
114
122
|
|
115
123
|
---
|
116
124
|
|
125
|
+
## MCP Compliance & Enhanced Integration
|
126
|
+
|
127
|
+
SQLite Memory Bank v1.4.0+ provides full Model Context Protocol (MCP) compliance with advanced features for enhanced LLM and agent integration:
|
128
|
+
|
129
|
+
### 🔧 MCP Tools (20 Available)
|
130
|
+
Organized into logical categories for easy discovery:
|
131
|
+
- **Schema Management** (6 tools): Table creation, modification, and inspection
|
132
|
+
- **Data Operations** (5 tools): CRUD operations with validation
|
133
|
+
- **Search & Discovery** (2 tools): Content search and exploration
|
134
|
+
- **Semantic Search** (5 tools): AI-powered natural language content discovery
|
135
|
+
- **Analytics** (2 tools): Memory bank insights and statistics
|
136
|
+
|
137
|
+
### 📄 MCP Resources (5 Available)
|
138
|
+
Real-time access to memory content via standardized URIs:
|
139
|
+
- `memory://tables/list` - List of all available tables
|
140
|
+
- `memory://tables/{table_name}/schema` - Table schema information
|
141
|
+
- `memory://tables/{table_name}/data` - Table data content
|
142
|
+
- `memory://search/{query}` - Search results as resources
|
143
|
+
- `memory://analytics/overview` - Memory bank overview analytics
|
144
|
+
|
145
|
+
### 💡 MCP Prompts (4 Available)
|
146
|
+
Intelligent prompts for common memory analysis workflows:
|
147
|
+
- `analyze-memory-content` - Analyze memory bank content and provide insights
|
148
|
+
- `search-and-summarize` - Search and create summary prompts
|
149
|
+
- `technical-decision-analysis` - Analyze technical decisions from memory
|
150
|
+
- `memory-bank-context` - Provide memory bank context for AI conversations
|
151
|
+
|
152
|
+
### 🎯 Enhanced Discoverability
|
153
|
+
- **Tool Categorization:** `list_tool_categories()` for organized tool discovery
|
154
|
+
- **Usage Examples:** `get_tools_by_category()` with detailed examples for each tool
|
155
|
+
- **Semantic Search:** Natural language queries for intelligent content discovery
|
156
|
+
- **LLM-Friendly APIs:** Explicit, descriptive tool names and comprehensive documentation
|
157
|
+
|
158
|
+
---
|
159
|
+
|
117
160
|
|
118
161
|
## Tools & API Reference
|
119
162
|
|
120
163
|
All tools are designed for explicit, discoverable use by LLMs, agents, and developers. Each function is available as a direct Python import and as an MCP tool.
|
121
164
|
|
122
|
-
|
165
|
+
**🔍 Tool Discovery:** Use `list_tool_categories()` to see all organized tool categories, or `get_tools_by_category(category)` for detailed information about specific tool groups with usage examples.
|
166
|
+
|
167
|
+
### Schema Management Tools (6 tools)
|
123
168
|
|
124
169
|
| Tool | Description | Required Parameters | Optional Parameters |
|
125
170
|
|------|-------------|---------------------|---------------------|
|
@@ -130,7 +175,7 @@ All tools are designed for explicit, discoverable use by LLMs, agents, and devel
|
|
130
175
|
| `describe_table` | Get schema details | `table_name` (str) | None |
|
131
176
|
| `list_all_columns` | List all columns for all tables | None | None |
|
132
177
|
|
133
|
-
### Data
|
178
|
+
### Data Operations Tools (5 tools)
|
134
179
|
|
135
180
|
| Tool | Description | Required Parameters | Optional Parameters |
|
136
181
|
|------|-------------|---------------------|---------------------|
|
@@ -140,6 +185,30 @@ All tools are designed for explicit, discoverable use by LLMs, agents, and devel
|
|
140
185
|
| `delete_rows` | Delete rows from table | `table_name` (str), `where` (dict) | None |
|
141
186
|
| `run_select_query` | Run safe SELECT query | `table_name` (str) | `columns` (list[str]), `where` (dict), `limit` (int) |
|
142
187
|
|
188
|
+
### Search & Discovery Tools (2 tools)
|
189
|
+
|
190
|
+
| Tool | Description | Required Parameters | Optional Parameters |
|
191
|
+
|------|-------------|---------------------|---------------------|
|
192
|
+
| `search_content` | Full-text search across table content | `query` (str) | `tables` (list[str]), `limit` (int) |
|
193
|
+
| `explore_tables` | Explore and discover table structures | None | `pattern` (str), `include_row_counts` (bool) |
|
194
|
+
|
195
|
+
### Semantic Search Tools (5 tools)
|
196
|
+
|
197
|
+
| Tool | Description | Required Parameters | Optional Parameters |
|
198
|
+
|------|-------------|---------------------|---------------------|
|
199
|
+
| `add_embeddings` | Generate vector embeddings for semantic search | `table_name` (str), `text_columns` (list[str]) | `embedding_column` (str), `model_name` (str) |
|
200
|
+
| `semantic_search` | Natural language search using vector similarity | `query` (str) | `tables` (list[str]), `similarity_threshold` (float), `limit` (int) |
|
201
|
+
| `find_related` | Find content related to specific row by similarity | `table_name` (str), `row_id` (int) | `similarity_threshold` (float), `limit` (int) |
|
202
|
+
| `smart_search` | Hybrid keyword + semantic search | `query` (str) | `tables` (list[str]), `semantic_weight` (float), `text_weight` (float) |
|
203
|
+
| `embedding_stats` | Get statistics about semantic search readiness | `table_name` (str) | `embedding_column` (str) |
|
204
|
+
|
205
|
+
### Tool Discovery & Organization (2 tools)
|
206
|
+
|
207
|
+
| Tool | Description | Required Parameters | Optional Parameters |
|
208
|
+
|------|-------------|---------------------|---------------------|
|
209
|
+
| `list_tool_categories` | List all available tool categories | None | None |
|
210
|
+
| `get_tools_by_category` | Get detailed tool information by category | `category` (str) | None |
|
211
|
+
|
143
212
|
Each tool validates inputs and returns consistent response formats with success/error indicators and appropriate data payloads.
|
144
213
|
|
145
214
|
---
|
@@ -468,6 +537,97 @@ For a complete agent memory implementation example, see [examples/agent_memory_e
|
|
468
537
|
|
469
538
|
---
|
470
539
|
|
540
|
+
## MCP Resources and Prompts Usage
|
541
|
+
|
542
|
+
### Using MCP Resources
|
543
|
+
|
544
|
+
MCP Resources provide real-time access to memory content through standardized URIs:
|
545
|
+
|
546
|
+
```python
|
547
|
+
# Access resource via MCP client
|
548
|
+
resource_uri = "memory://tables/list"
|
549
|
+
tables_resource = await client.read_resource(resource_uri)
|
550
|
+
|
551
|
+
# Get table schema
|
552
|
+
schema_uri = "memory://tables/user_preferences/schema"
|
553
|
+
schema_resource = await client.read_resource(schema_uri)
|
554
|
+
|
555
|
+
# Access table data
|
556
|
+
data_uri = "memory://tables/user_preferences/data"
|
557
|
+
data_resource = await client.read_resource(data_uri)
|
558
|
+
|
559
|
+
# Search as resource
|
560
|
+
search_uri = "memory://search/user preferences coding style"
|
561
|
+
search_resource = await client.read_resource(search_uri)
|
562
|
+
|
563
|
+
# Analytics overview
|
564
|
+
analytics_uri = "memory://analytics/overview"
|
565
|
+
analytics_resource = await client.read_resource(analytics_uri)
|
566
|
+
```
|
567
|
+
|
568
|
+
### Using MCP Prompts
|
569
|
+
|
570
|
+
MCP Prompts provide intelligent analysis workflows:
|
571
|
+
|
572
|
+
```python
|
573
|
+
# Analyze memory content
|
574
|
+
analysis_prompt = await client.get_prompt("analyze-memory-content", {
|
575
|
+
"focus_area": "technical_decisions"
|
576
|
+
})
|
577
|
+
|
578
|
+
# Search and summarize
|
579
|
+
summary_prompt = await client.get_prompt("search-and-summarize", {
|
580
|
+
"query": "database performance optimization",
|
581
|
+
"max_results": 10
|
582
|
+
})
|
583
|
+
|
584
|
+
# Technical decision analysis
|
585
|
+
decision_analysis = await client.get_prompt("technical-decision-analysis", {
|
586
|
+
"decision_category": "architecture"
|
587
|
+
})
|
588
|
+
|
589
|
+
# Get memory context for conversations
|
590
|
+
context_prompt = await client.get_prompt("memory-bank-context", {
|
591
|
+
"conversation_topic": "API design patterns"
|
592
|
+
})
|
593
|
+
```
|
594
|
+
|
595
|
+
### Semantic Search Examples
|
596
|
+
|
597
|
+
```python
|
598
|
+
# Enable semantic search on existing table
|
599
|
+
add_embeddings("technical_decisions", ["decision_name", "rationale"])
|
600
|
+
|
601
|
+
# Natural language search
|
602
|
+
results = semantic_search("machine learning algorithms",
|
603
|
+
similarity_threshold=0.4,
|
604
|
+
limit=5)
|
605
|
+
|
606
|
+
# Find related content
|
607
|
+
related = find_related("technical_decisions",
|
608
|
+
row_id=123,
|
609
|
+
similarity_threshold=0.5)
|
610
|
+
|
611
|
+
# Hybrid search (keyword + semantic)
|
612
|
+
hybrid_results = smart_search("API design patterns",
|
613
|
+
semantic_weight=0.7,
|
614
|
+
text_weight=0.3)
|
615
|
+
```
|
616
|
+
|
617
|
+
### Tool Organization Discovery
|
618
|
+
|
619
|
+
```python
|
620
|
+
# Discover tool categories
|
621
|
+
categories = list_tool_categories()
|
622
|
+
# Returns: {"schema_management": 6, "data_operations": 5, ...}
|
623
|
+
|
624
|
+
# Get detailed tool information
|
625
|
+
schema_tools = get_tools_by_category("schema_management")
|
626
|
+
# Returns detailed info with usage examples for each tool
|
627
|
+
```
|
628
|
+
|
629
|
+
---
|
630
|
+
|
471
631
|
## Troubleshooting
|
472
632
|
|
473
633
|
### Common MCP Connection Issues
|
@@ -14,10 +14,14 @@ This project provides a robust, discoverable API for creating, exploring, and ma
|
|
14
14
|
- Build and query knowledge graphs for semantic search and reasoning
|
15
15
|
- Store, retrieve, and organize notes or structured data for LLM agents
|
16
16
|
- Enable natural language workflows for database management and exploration
|
17
|
+
- Intelligent content discovery with semantic search capabilities
|
18
|
+
- Access memory content through standardized MCP Resources and Prompts
|
17
19
|
- Integrate with FastMCP, Claude Desktop, and other agent platforms for seamless tool discovery
|
18
20
|
|
19
21
|
**Why mcp_sqlite_memory_bank?**
|
20
|
-
-
|
22
|
+
- **Full MCP Compliance:** Resources, Prompts, and 20+ organized tools
|
23
|
+
- **Semantic Search:** Natural language content discovery with AI-powered similarity matching
|
24
|
+
- **Explicit, discoverable APIs** for LLMs and agents with enhanced categorization
|
21
25
|
- Safe, parameterized queries and schema management
|
22
26
|
- Designed for extensibility and open source collaboration
|
23
27
|
|
@@ -82,18 +86,59 @@ Restart your IDE and try asking your AI assistant:
|
|
82
86
|
- **Dynamic Table Management:** Create, list, describe, rename, and drop tables at runtime
|
83
87
|
- **CRUD Operations:** Insert, read, update, and delete rows in any table
|
84
88
|
- **Safe SQL:** Run parameterized SELECT queries with input validation
|
89
|
+
- **Semantic Search:** Natural language search using sentence-transformers for intelligent content discovery
|
90
|
+
- **MCP Resources:** Access memory content through standardized MCP resource URIs
|
91
|
+
- **MCP Prompts:** Built-in intelligent prompts for common memory analysis workflows
|
92
|
+
- **Tool Categorization:** Organized tool discovery with detailed usage examples for enhanced LLM integration
|
85
93
|
- **Knowledge Graph Tools:** Built-in support for node/edge schemas and property graphs
|
86
94
|
- **Agent/LLM Integration:** Explicit, tool-based APIs for easy discovery and automation
|
87
95
|
- **Open Source:** MIT licensed, fully tested, and ready for community use
|
88
96
|
|
89
97
|
---
|
90
98
|
|
99
|
+
## MCP Compliance & Enhanced Integration
|
100
|
+
|
101
|
+
SQLite Memory Bank v1.4.0+ provides full Model Context Protocol (MCP) compliance with advanced features for enhanced LLM and agent integration:
|
102
|
+
|
103
|
+
### 🔧 MCP Tools (20 Available)
|
104
|
+
Organized into logical categories for easy discovery:
|
105
|
+
- **Schema Management** (6 tools): Table creation, modification, and inspection
|
106
|
+
- **Data Operations** (5 tools): CRUD operations with validation
|
107
|
+
- **Search & Discovery** (2 tools): Content search and exploration
|
108
|
+
- **Semantic Search** (5 tools): AI-powered natural language content discovery
|
109
|
+
- **Analytics** (2 tools): Memory bank insights and statistics
|
110
|
+
|
111
|
+
### 📄 MCP Resources (5 Available)
|
112
|
+
Real-time access to memory content via standardized URIs:
|
113
|
+
- `memory://tables/list` - List of all available tables
|
114
|
+
- `memory://tables/{table_name}/schema` - Table schema information
|
115
|
+
- `memory://tables/{table_name}/data` - Table data content
|
116
|
+
- `memory://search/{query}` - Search results as resources
|
117
|
+
- `memory://analytics/overview` - Memory bank overview analytics
|
118
|
+
|
119
|
+
### 💡 MCP Prompts (4 Available)
|
120
|
+
Intelligent prompts for common memory analysis workflows:
|
121
|
+
- `analyze-memory-content` - Analyze memory bank content and provide insights
|
122
|
+
- `search-and-summarize` - Search and create summary prompts
|
123
|
+
- `technical-decision-analysis` - Analyze technical decisions from memory
|
124
|
+
- `memory-bank-context` - Provide memory bank context for AI conversations
|
125
|
+
|
126
|
+
### 🎯 Enhanced Discoverability
|
127
|
+
- **Tool Categorization:** `list_tool_categories()` for organized tool discovery
|
128
|
+
- **Usage Examples:** `get_tools_by_category()` with detailed examples for each tool
|
129
|
+
- **Semantic Search:** Natural language queries for intelligent content discovery
|
130
|
+
- **LLM-Friendly APIs:** Explicit, descriptive tool names and comprehensive documentation
|
131
|
+
|
132
|
+
---
|
133
|
+
|
91
134
|
|
92
135
|
## Tools & API Reference
|
93
136
|
|
94
137
|
All tools are designed for explicit, discoverable use by LLMs, agents, and developers. Each function is available as a direct Python import and as an MCP tool.
|
95
138
|
|
96
|
-
|
139
|
+
**🔍 Tool Discovery:** Use `list_tool_categories()` to see all organized tool categories, or `get_tools_by_category(category)` for detailed information about specific tool groups with usage examples.
|
140
|
+
|
141
|
+
### Schema Management Tools (6 tools)
|
97
142
|
|
98
143
|
| Tool | Description | Required Parameters | Optional Parameters |
|
99
144
|
|------|-------------|---------------------|---------------------|
|
@@ -104,7 +149,7 @@ All tools are designed for explicit, discoverable use by LLMs, agents, and devel
|
|
104
149
|
| `describe_table` | Get schema details | `table_name` (str) | None |
|
105
150
|
| `list_all_columns` | List all columns for all tables | None | None |
|
106
151
|
|
107
|
-
### Data
|
152
|
+
### Data Operations Tools (5 tools)
|
108
153
|
|
109
154
|
| Tool | Description | Required Parameters | Optional Parameters |
|
110
155
|
|------|-------------|---------------------|---------------------|
|
@@ -114,6 +159,30 @@ All tools are designed for explicit, discoverable use by LLMs, agents, and devel
|
|
114
159
|
| `delete_rows` | Delete rows from table | `table_name` (str), `where` (dict) | None |
|
115
160
|
| `run_select_query` | Run safe SELECT query | `table_name` (str) | `columns` (list[str]), `where` (dict), `limit` (int) |
|
116
161
|
|
162
|
+
### Search & Discovery Tools (2 tools)
|
163
|
+
|
164
|
+
| Tool | Description | Required Parameters | Optional Parameters |
|
165
|
+
|------|-------------|---------------------|---------------------|
|
166
|
+
| `search_content` | Full-text search across table content | `query` (str) | `tables` (list[str]), `limit` (int) |
|
167
|
+
| `explore_tables` | Explore and discover table structures | None | `pattern` (str), `include_row_counts` (bool) |
|
168
|
+
|
169
|
+
### Semantic Search Tools (5 tools)
|
170
|
+
|
171
|
+
| Tool | Description | Required Parameters | Optional Parameters |
|
172
|
+
|------|-------------|---------------------|---------------------|
|
173
|
+
| `add_embeddings` | Generate vector embeddings for semantic search | `table_name` (str), `text_columns` (list[str]) | `embedding_column` (str), `model_name` (str) |
|
174
|
+
| `semantic_search` | Natural language search using vector similarity | `query` (str) | `tables` (list[str]), `similarity_threshold` (float), `limit` (int) |
|
175
|
+
| `find_related` | Find content related to specific row by similarity | `table_name` (str), `row_id` (int) | `similarity_threshold` (float), `limit` (int) |
|
176
|
+
| `smart_search` | Hybrid keyword + semantic search | `query` (str) | `tables` (list[str]), `semantic_weight` (float), `text_weight` (float) |
|
177
|
+
| `embedding_stats` | Get statistics about semantic search readiness | `table_name` (str) | `embedding_column` (str) |
|
178
|
+
|
179
|
+
### Tool Discovery & Organization (2 tools)
|
180
|
+
|
181
|
+
| Tool | Description | Required Parameters | Optional Parameters |
|
182
|
+
|------|-------------|---------------------|---------------------|
|
183
|
+
| `list_tool_categories` | List all available tool categories | None | None |
|
184
|
+
| `get_tools_by_category` | Get detailed tool information by category | `category` (str) | None |
|
185
|
+
|
117
186
|
Each tool validates inputs and returns consistent response formats with success/error indicators and appropriate data payloads.
|
118
187
|
|
119
188
|
---
|
@@ -442,6 +511,97 @@ For a complete agent memory implementation example, see [examples/agent_memory_e
|
|
442
511
|
|
443
512
|
---
|
444
513
|
|
514
|
+
## MCP Resources and Prompts Usage
|
515
|
+
|
516
|
+
### Using MCP Resources
|
517
|
+
|
518
|
+
MCP Resources provide real-time access to memory content through standardized URIs:
|
519
|
+
|
520
|
+
```python
|
521
|
+
# Access resource via MCP client
|
522
|
+
resource_uri = "memory://tables/list"
|
523
|
+
tables_resource = await client.read_resource(resource_uri)
|
524
|
+
|
525
|
+
# Get table schema
|
526
|
+
schema_uri = "memory://tables/user_preferences/schema"
|
527
|
+
schema_resource = await client.read_resource(schema_uri)
|
528
|
+
|
529
|
+
# Access table data
|
530
|
+
data_uri = "memory://tables/user_preferences/data"
|
531
|
+
data_resource = await client.read_resource(data_uri)
|
532
|
+
|
533
|
+
# Search as resource
|
534
|
+
search_uri = "memory://search/user preferences coding style"
|
535
|
+
search_resource = await client.read_resource(search_uri)
|
536
|
+
|
537
|
+
# Analytics overview
|
538
|
+
analytics_uri = "memory://analytics/overview"
|
539
|
+
analytics_resource = await client.read_resource(analytics_uri)
|
540
|
+
```
|
541
|
+
|
542
|
+
### Using MCP Prompts
|
543
|
+
|
544
|
+
MCP Prompts provide intelligent analysis workflows:
|
545
|
+
|
546
|
+
```python
|
547
|
+
# Analyze memory content
|
548
|
+
analysis_prompt = await client.get_prompt("analyze-memory-content", {
|
549
|
+
"focus_area": "technical_decisions"
|
550
|
+
})
|
551
|
+
|
552
|
+
# Search and summarize
|
553
|
+
summary_prompt = await client.get_prompt("search-and-summarize", {
|
554
|
+
"query": "database performance optimization",
|
555
|
+
"max_results": 10
|
556
|
+
})
|
557
|
+
|
558
|
+
# Technical decision analysis
|
559
|
+
decision_analysis = await client.get_prompt("technical-decision-analysis", {
|
560
|
+
"decision_category": "architecture"
|
561
|
+
})
|
562
|
+
|
563
|
+
# Get memory context for conversations
|
564
|
+
context_prompt = await client.get_prompt("memory-bank-context", {
|
565
|
+
"conversation_topic": "API design patterns"
|
566
|
+
})
|
567
|
+
```
|
568
|
+
|
569
|
+
### Semantic Search Examples
|
570
|
+
|
571
|
+
```python
|
572
|
+
# Enable semantic search on existing table
|
573
|
+
add_embeddings("technical_decisions", ["decision_name", "rationale"])
|
574
|
+
|
575
|
+
# Natural language search
|
576
|
+
results = semantic_search("machine learning algorithms",
|
577
|
+
similarity_threshold=0.4,
|
578
|
+
limit=5)
|
579
|
+
|
580
|
+
# Find related content
|
581
|
+
related = find_related("technical_decisions",
|
582
|
+
row_id=123,
|
583
|
+
similarity_threshold=0.5)
|
584
|
+
|
585
|
+
# Hybrid search (keyword + semantic)
|
586
|
+
hybrid_results = smart_search("API design patterns",
|
587
|
+
semantic_weight=0.7,
|
588
|
+
text_weight=0.3)
|
589
|
+
```
|
590
|
+
|
591
|
+
### Tool Organization Discovery
|
592
|
+
|
593
|
+
```python
|
594
|
+
# Discover tool categories
|
595
|
+
categories = list_tool_categories()
|
596
|
+
# Returns: {"schema_management": 6, "data_operations": 5, ...}
|
597
|
+
|
598
|
+
# Get detailed tool information
|
599
|
+
schema_tools = get_tools_by_category("schema_management")
|
600
|
+
# Returns detailed info with usage examples for each tool
|
601
|
+
```
|
602
|
+
|
603
|
+
---
|
604
|
+
|
445
605
|
## Troubleshooting
|
446
606
|
|
447
607
|
### Common MCP Connection Issues
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "mcp_sqlite_memory_bank"
|
7
|
-
version = "1.
|
7
|
+
version = "1.4.2"
|
8
8
|
description = "A dynamic, agent/LLM-friendly SQLite memory bank for MCP servers with semantic search capabilities."
|
9
9
|
authors = [
|
10
10
|
{ name="Robert Meisner", email="robert@catchit.pl" }
|
{mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.2}/src/mcp_sqlite_memory_bank/database.py
RENAMED
@@ -429,7 +429,12 @@ class SQLiteMemoryDatabase:
|
|
429
429
|
)
|
430
430
|
|
431
431
|
# Sort by relevance and limit results
|
432
|
-
|
432
|
+
def get_relevance(x: Dict[str, Any]) -> float:
|
433
|
+
rel = x.get("relevance", 0)
|
434
|
+
if isinstance(rel, (int, float)):
|
435
|
+
return float(rel)
|
436
|
+
return 0.0
|
437
|
+
results.sort(key=get_relevance, reverse=True)
|
433
438
|
results = results[:limit]
|
434
439
|
|
435
440
|
return {
|
@@ -453,7 +458,7 @@ class SQLiteMemoryDatabase:
|
|
453
458
|
if pattern:
|
454
459
|
table_names = [name for name in table_names if pattern.replace("%", "") in name]
|
455
460
|
|
456
|
-
exploration = {"tables": [], "total_tables": len(table_names), "total_rows": 0}
|
461
|
+
exploration: Dict[str, Any] = {"tables": [], "total_tables": len(table_names), "total_rows": 0}
|
457
462
|
|
458
463
|
with self.get_connection() as conn:
|
459
464
|
for table_name in table_names:
|
@@ -461,7 +466,7 @@ class SQLiteMemoryDatabase:
|
|
461
466
|
|
462
467
|
# Build column info and identify text columns
|
463
468
|
columns = []
|
464
|
-
text_columns = []
|
469
|
+
text_columns: List[str] = []
|
465
470
|
|
466
471
|
for col in table.columns:
|
467
472
|
col_data = {
|
@@ -476,7 +481,7 @@ class SQLiteMemoryDatabase:
|
|
476
481
|
if "TEXT" in str(col.type).upper() or "VARCHAR" in str(col.type).upper():
|
477
482
|
text_columns.append(col.name)
|
478
483
|
|
479
|
-
table_info = {"name": table_name, "columns": columns, "text_columns": text_columns}
|
484
|
+
table_info: Dict[str, Any] = {"name": table_name, "columns": columns, "text_columns": text_columns}
|
480
485
|
|
481
486
|
# Add row count if requested
|
482
487
|
if include_row_counts:
|
@@ -493,11 +498,11 @@ class SQLiteMemoryDatabase:
|
|
493
498
|
|
494
499
|
# Add content preview for text columns
|
495
500
|
if text_columns:
|
496
|
-
content_preview = {}
|
501
|
+
content_preview: Dict[str, List[Any]] = {}
|
497
502
|
for col_name in text_columns[:3]: # Limit to first 3 text columns
|
498
503
|
col = table.c[col_name]
|
499
504
|
preview_result = conn.execute(select(col).distinct().where(col.isnot(None)).limit(5))
|
500
|
-
unique_values = [row[0] for row in preview_result.fetchall() if row[0]]
|
505
|
+
unique_values: List[Any] = [row[0] for row in preview_result.fetchall() if row[0]]
|
501
506
|
if unique_values:
|
502
507
|
content_preview[col_name] = unique_values
|
503
508
|
|
@@ -1001,6 +1006,9 @@ def get_database(db_path: Optional[str] = None) -> SQLiteMemoryDatabase:
|
|
1001
1006
|
global _db_instance
|
1002
1007
|
|
1003
1008
|
actual_path = db_path or os.environ.get("DB_PATH", "./test.db")
|
1009
|
+
if actual_path is None:
|
1010
|
+
actual_path = "./test.db"
|
1011
|
+
|
1004
1012
|
if _db_instance is None or (db_path and db_path != _db_instance.db_path):
|
1005
1013
|
# Close previous instance if it exists
|
1006
1014
|
if _db_instance is not None:
|