mcp-sqlite-memory-bank 1.3.1__tar.gz → 1.4.1__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 (23) hide show
  1. {mcp_sqlite_memory_bank-1.3.1/src/mcp_sqlite_memory_bank.egg-info → mcp_sqlite_memory_bank-1.4.1}/PKG-INFO +164 -4
  2. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/README.md +163 -3
  3. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/pyproject.toml +1 -1
  4. mcp_sqlite_memory_bank-1.4.1/src/mcp_sqlite_memory_bank/prompts.py +252 -0
  5. mcp_sqlite_memory_bank-1.4.1/src/mcp_sqlite_memory_bank/resources.py +164 -0
  6. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/src/mcp_sqlite_memory_bank/server.py +124 -0
  7. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1/src/mcp_sqlite_memory_bank.egg-info}/PKG-INFO +164 -4
  8. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/src/mcp_sqlite_memory_bank.egg-info/SOURCES.txt +2 -0
  9. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/LICENSE +0 -0
  10. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/MANIFEST.in +0 -0
  11. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/setup.cfg +0 -0
  12. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/src/mcp_sqlite_memory_bank/__init__.py +0 -0
  13. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/src/mcp_sqlite_memory_bank/database.py +0 -0
  14. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/src/mcp_sqlite_memory_bank/py.typed +0 -0
  15. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/src/mcp_sqlite_memory_bank/semantic.py +0 -0
  16. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/src/mcp_sqlite_memory_bank/types.py +0 -0
  17. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/src/mcp_sqlite_memory_bank/utils.py +0 -0
  18. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/src/mcp_sqlite_memory_bank.egg-info/dependency_links.txt +0 -0
  19. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/src/mcp_sqlite_memory_bank.egg-info/entry_points.txt +0 -0
  20. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/src/mcp_sqlite_memory_bank.egg-info/requires.txt +0 -0
  21. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/src/mcp_sqlite_memory_bank.egg-info/top_level.txt +0 -0
  22. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/tests/test_api.py +0 -0
  23. {mcp_sqlite_memory_bank-1.3.1 → mcp_sqlite_memory_bank-1.4.1}/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.1
3
+ Version: 1.4.1
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
- - Explicit, discoverable APIs for LLMs and agents
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
- ### Table Management Tools
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 Management Tools
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
- - Explicit, discoverable APIs for LLMs and agents
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
- ### Table Management Tools
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 Management Tools
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.3.1"
7
+ version = "1.4.1"
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" }
@@ -0,0 +1,252 @@
1
+ """
2
+ MCP Prompts Support for SQLite Memory Bank
3
+ =========================================
4
+
5
+ This module adds MCP Prompts support, providing templated prompts and workflows
6
+ that leverage the memory bank content for enhanced AI interactions.
7
+
8
+ Prompts provide reusable, contextual templates that can dynamically incorporate
9
+ stored memory content into LLM conversations.
10
+
11
+ Author: Robert Meisner
12
+ """
13
+
14
+ from typing import Optional
15
+ from fastmcp import FastMCP
16
+ from .database import get_database
17
+ import json
18
+
19
+
20
+ class MemoryBankPrompts:
21
+ """Manages MCP Prompts for the SQLite Memory Bank."""
22
+
23
+ def __init__(self, mcp_app: FastMCP, db_path: str):
24
+ self.mcp = mcp_app
25
+ self.db_path = db_path
26
+ self._register_prompts()
27
+
28
+ def _register_prompts(self):
29
+ """Register MCP prompts with the FastMCP app."""
30
+
31
+ @self.mcp.prompt("analyze-memory-content")
32
+ async def analyze_memory_content(table_name: Optional[str] = None) -> str:
33
+ """Analyze memory bank content and provide insights."""
34
+ db = get_database(self.db_path)
35
+
36
+ if table_name:
37
+ # Analyze specific table
38
+ result = db.read_rows(table_name, {})
39
+ if not result.get("success"):
40
+ return f"Error: Could not access table '{table_name}'. Please check if it exists."
41
+
42
+ rows = result.get("rows", [])
43
+ prompt = f"""Please analyze the content in the '{table_name}' table from the memory bank.
44
+
45
+ Table: {table_name}
46
+ Row count: {len(rows)}
47
+ Sample data: {json.dumps(rows[:3], indent=2) if rows else "No data"}
48
+
49
+ Please provide:
50
+ 1. A summary of the content patterns
51
+ 2. Key insights or themes
52
+ 3. Suggestions for better organization
53
+ 4. Potential use cases for this data
54
+
55
+ Focus on actionable insights that could help improve how this information is stored and retrieved."""
56
+ else:
57
+ # Analyze all tables
58
+ tables_result = db.list_tables()
59
+ if not tables_result.get("success"):
60
+ return "Error: Could not access memory bank tables."
61
+
62
+ tables = tables_result.get("tables", [])
63
+ overview = {"tables": len(tables), "total_content": []}
64
+
65
+ for table in tables[:5]: # Limit to first 5 tables
66
+ rows_result = db.read_rows(table, {})
67
+ if rows_result.get("success"):
68
+ rows = rows_result.get("rows", [])
69
+ overview["total_content"].append({
70
+ "table": table,
71
+ "rows": len(rows),
72
+ "sample": rows[:2] if rows else []
73
+ })
74
+
75
+ prompt = f"""Please analyze the overall content in this memory bank.
76
+
77
+ Memory Bank Overview:
78
+ {json.dumps(overview, indent=2)}
79
+
80
+ Please provide:
81
+ 1. Assessment of content organization
82
+ 2. Identification of content patterns across tables
83
+ 3. Recommendations for improving memory structure
84
+ 4. Suggestions for leveraging this content more effectively
85
+
86
+ Focus on high-level strategic insights about the memory bank's utility and organization."""
87
+
88
+ return prompt
89
+
90
+ @self.mcp.prompt("search-and-summarize")
91
+ async def search_and_summarize(query: str, max_results: Optional[int] = 10) -> str:
92
+ """Search memory content and create a summary prompt."""
93
+ db = get_database(self.db_path)
94
+
95
+ # Perform search
96
+ result = db.search_content(query, None, max_results or 10)
97
+ if not result.get("success"):
98
+ return f"Error: Could not search for '{query}'. {result.get('error', 'Unknown error')}"
99
+
100
+ search_results = result.get("results", [])
101
+ if not search_results:
102
+ return f"No results found for query: '{query}'. Please try different search terms or check if relevant content exists in the memory bank."
103
+
104
+ # Format results for prompt
105
+ formatted_results = []
106
+ for i, result in enumerate(search_results[:max_results or 10], 1):
107
+ formatted_results.append(f"{i}. Table: {result.get('table', 'unknown')}")
108
+ formatted_results.append(f" Content: {result.get('content', 'No content')[:200]}...")
109
+ formatted_results.append(f" Relevance: {result.get('relevance', 'N/A')}")
110
+ formatted_results.append("")
111
+
112
+ prompt = f"""Based on the search query "{query}", here are the most relevant results from the memory bank:
113
+
114
+ Search Results:
115
+ {chr(10).join(formatted_results)}
116
+
117
+ Please provide:
118
+ 1. A comprehensive summary of the key information found
119
+ 2. Common themes or patterns across the results
120
+ 3. Any gaps or additional information that might be needed
121
+ 4. Actionable insights based on this content
122
+
123
+ Use this information to provide a thorough, well-organized response that synthesizes the search results."""
124
+
125
+ return prompt
126
+
127
+ @self.mcp.prompt("technical-decision-analysis")
128
+ async def technical_decision_analysis(decision_topic: Optional[str] = None) -> str:
129
+ """Analyze technical decisions from the memory bank."""
130
+ db = get_database(self.db_path)
131
+
132
+ # Try to find technical_decisions table
133
+ tables_result = db.list_tables()
134
+ if not tables_result.get("success"):
135
+ return "Error: Could not access memory bank."
136
+
137
+ tables = tables_result.get("tables", [])
138
+ if "technical_decisions" not in tables:
139
+ return """No technical decisions table found in the memory bank.
140
+
141
+ To use this prompt effectively, please:
142
+ 1. Create a 'technical_decisions' table
143
+ 2. Store your technical decisions with context
144
+ 3. Try this prompt again
145
+
146
+ The table should include fields like: decision_name, chosen_approach, rationale, alternatives, timestamp."""
147
+
148
+ # Get technical decisions
149
+ where_clause = {}
150
+ if decision_topic:
151
+ # This is a simplified search - in practice you'd want semantic search
152
+ where_clause = {"decision_name": decision_topic}
153
+
154
+ result = db.read_rows("technical_decisions", where_clause)
155
+ if not result.get("success"):
156
+ return "Error: Could not read technical decisions."
157
+
158
+ decisions = result.get("rows", [])
159
+ if not decisions:
160
+ topic_msg = f" related to '{decision_topic}'" if decision_topic else ""
161
+ return f"No technical decisions found{topic_msg}. Consider adding some decisions to the memory bank first."
162
+
163
+ # Format decisions for analysis
164
+ formatted_decisions = []
165
+ for i, decision in enumerate(decisions, 1):
166
+ formatted_decisions.append(f"{i}. Decision: {decision.get('decision_name', 'Unknown')}")
167
+ formatted_decisions.append(f" Approach: {decision.get('chosen_approach', 'Not specified')}")
168
+ formatted_decisions.append(f" Rationale: {decision.get('rationale', 'Not provided')}")
169
+ if decision.get('alternatives'):
170
+ formatted_decisions.append(f" Alternatives: {decision.get('alternatives')}")
171
+ formatted_decisions.append(f" Date: {decision.get('timestamp', 'Unknown')}")
172
+ formatted_decisions.append("")
173
+
174
+ prompt = f"""Please analyze these technical decisions from the memory bank:
175
+
176
+ Technical Decisions{f" (filtered by: {decision_topic})" if decision_topic else ""}:
177
+ {chr(10).join(formatted_decisions)}
178
+
179
+ Please provide:
180
+ 1. Analysis of decision-making patterns
181
+ 2. Assessment of the rationale quality
182
+ 3. Identification of any decision dependencies or conflicts
183
+ 4. Recommendations for future decisions
184
+ 5. Suggestions for improving decision documentation
185
+
186
+ Focus on actionable insights that can improve technical decision-making processes."""
187
+
188
+ return prompt
189
+
190
+ @self.mcp.prompt("memory-bank-context")
191
+ async def memory_bank_context(context_type: str = "full") -> str:
192
+ """Provide memory bank context for AI conversations."""
193
+ db = get_database(self.db_path)
194
+
195
+ # Get overview
196
+ tables_result = db.list_tables()
197
+ if not tables_result.get("success"):
198
+ return "Error: Could not access memory bank for context."
199
+
200
+ tables = tables_result.get("tables", [])
201
+ context_info = {
202
+ "available_tables": tables,
203
+ "capabilities": [
204
+ "Full-text search across all content",
205
+ "Semantic search (if embeddings are available)",
206
+ "Structured data queries",
207
+ "Content analytics and insights"
208
+ ],
209
+ "usage_suggestions": [
210
+ "Use search_content() for finding specific information",
211
+ "Use semantic_search() for conceptual queries",
212
+ "Use read_rows() for structured data access",
213
+ "Use explore_tables() to discover available content"
214
+ ]
215
+ }
216
+
217
+ if context_type == "brief":
218
+ prompt = f"""Memory Bank Context (Brief):
219
+ Available tables: {', '.join(tables)}
220
+ Total tables: {len(tables)}
221
+
222
+ This memory bank contains structured information that can be searched and analyzed. Use the available tools to access specific content as needed."""
223
+ else:
224
+ # Get sample content from a few tables
225
+ sample_content = {}
226
+ for table in tables[:3]: # Sample from first 3 tables
227
+ try:
228
+ result = db.read_rows(table, {})
229
+ if result.get("success"):
230
+ rows = result.get("rows", [])
231
+ sample_content[table] = {
232
+ "row_count": len(rows),
233
+ "sample_row": rows[0] if rows else None
234
+ }
235
+ except Exception:
236
+ continue
237
+
238
+ prompt = f"""Memory Bank Context (Full):
239
+
240
+ {json.dumps(context_info, indent=2)}
241
+
242
+ Sample Content:
243
+ {json.dumps(sample_content, indent=2)}
244
+
245
+ This memory bank contains structured information that can be searched, analyzed, and leveraged for various tasks. The content is organized in tables with different types of information. Use the available search and query tools to access specific content as needed for your current task."""
246
+
247
+ return prompt
248
+
249
+
250
+ def setup_mcp_prompts(mcp_app: FastMCP, db_path: str) -> MemoryBankPrompts:
251
+ """Set up MCP Prompts for the memory bank."""
252
+ return MemoryBankPrompts(mcp_app, db_path)
@@ -0,0 +1,164 @@
1
+ """
2
+ MCP Resources Support for SQLite Memory Bank
3
+ ==========================================
4
+
5
+ This module adds MCP Resources support, allowing the memory bank to expose
6
+ stored content as MCP resources that can be consumed by LLM applications.
7
+
8
+ Resources provide context and data that can be accessed by AI models through
9
+ the standardized MCP protocol.
10
+
11
+ Author: Robert Meisner
12
+ """
13
+
14
+ from fastmcp import FastMCP
15
+ from .database import get_database
16
+ import json
17
+
18
+
19
+ class MemoryBankResources:
20
+ """Manages MCP Resources for the SQLite Memory Bank."""
21
+
22
+ def __init__(self, mcp_app: FastMCP, db_path: str):
23
+ self.mcp = mcp_app
24
+ self.db_path = db_path
25
+ self._register_resources()
26
+
27
+ def _register_resources(self):
28
+ """Register MCP resources with the FastMCP app."""
29
+
30
+ @self.mcp.resource("memory://tables/list")
31
+ async def get_tables_list() -> str:
32
+ """Provide a list of all available tables as an MCP resource."""
33
+ db = get_database(self.db_path)
34
+ result = db.list_tables()
35
+
36
+ if not result.get("success"):
37
+ return json.dumps({"error": "Failed to fetch tables", "details": result})
38
+
39
+ resource_content = {
40
+ "resource_type": "table_list",
41
+ "description": "List of all available tables in the memory bank",
42
+ "tables": result.get("tables", []),
43
+ "total_count": len(result.get("tables", [])),
44
+ "last_updated": "dynamic"
45
+ }
46
+
47
+ return json.dumps(resource_content, indent=2)
48
+
49
+ @self.mcp.resource("memory://tables/{table_name}/schema")
50
+ async def get_table_schema(table_name: str) -> str:
51
+ """Provide table schema information as an MCP resource."""
52
+ db = get_database(self.db_path)
53
+ result = db.describe_table(table_name)
54
+
55
+ if not result.get("success"):
56
+ return json.dumps({"error": f"Failed to fetch schema for table '{table_name}'", "details": result})
57
+
58
+ resource_content = {
59
+ "resource_type": "table_schema",
60
+ "table_name": table_name,
61
+ "description": f"Schema definition for table '{table_name}'",
62
+ "columns": result.get("columns", []),
63
+ "column_count": len(result.get("columns", [])),
64
+ "last_updated": "dynamic"
65
+ }
66
+
67
+ return json.dumps(resource_content, indent=2)
68
+
69
+ @self.mcp.resource("memory://tables/{table_name}/data")
70
+ async def get_table_data(table_name: str) -> str:
71
+ """Provide table data as an MCP resource."""
72
+ db = get_database(self.db_path)
73
+ result = db.read_rows(table_name, {})
74
+
75
+ if not result.get("success"):
76
+ return json.dumps({"error": f"Failed to fetch data for table '{table_name}'", "details": result})
77
+
78
+ rows = result.get("rows", [])
79
+ resource_content = {
80
+ "resource_type": "table_data",
81
+ "table_name": table_name,
82
+ "description": f"All data from table '{table_name}'",
83
+ "rows": rows,
84
+ "row_count": len(rows),
85
+ "last_updated": "dynamic"
86
+ }
87
+
88
+ return json.dumps(resource_content, indent=2)
89
+
90
+ @self.mcp.resource("memory://search/{query}")
91
+ async def search_memory_content(query: str) -> str:
92
+ """Provide search results as an MCP resource."""
93
+ db = get_database(self.db_path)
94
+ result = db.search_content(query, None, 50) # Search all tables, limit to 50 results
95
+
96
+ if not result.get("success"):
97
+ return json.dumps({"error": f"Failed to search for '{query}'", "details": result})
98
+
99
+ search_results = result.get("results", [])
100
+ resource_content = {
101
+ "resource_type": "search_results",
102
+ "query": query,
103
+ "description": f"Search results for query: '{query}'",
104
+ "results": search_results,
105
+ "result_count": len(search_results),
106
+ "last_updated": "dynamic"
107
+ }
108
+
109
+ return json.dumps(resource_content, indent=2)
110
+
111
+ @self.mcp.resource("memory://analytics/overview")
112
+ async def get_memory_overview() -> str:
113
+ """Provide memory bank overview analytics as an MCP resource."""
114
+ db = get_database(self.db_path)
115
+
116
+ # Get table list
117
+ tables_result = db.list_tables()
118
+ if not tables_result.get("success"):
119
+ return json.dumps({"error": "Failed to fetch memory overview", "details": tables_result})
120
+
121
+ tables = tables_result.get("tables", [])
122
+ total_rows = 0
123
+ table_stats = {}
124
+
125
+ # Get row counts for each table
126
+ for table in tables:
127
+ try:
128
+ rows_result = db.read_rows(table, {})
129
+ if rows_result.get("success"):
130
+ row_count = len(rows_result.get("rows", []))
131
+ table_stats[table] = {
132
+ "row_count": row_count,
133
+ "status": "accessible"
134
+ }
135
+ total_rows += row_count
136
+ else:
137
+ table_stats[table] = {
138
+ "row_count": 0,
139
+ "status": "error"
140
+ }
141
+ except Exception as e:
142
+ table_stats[table] = {
143
+ "row_count": 0,
144
+ "status": f"error: {str(e)}"
145
+ }
146
+
147
+ resource_content = {
148
+ "resource_type": "memory_overview",
149
+ "description": "Overview of memory bank contents and usage",
150
+ "summary": {
151
+ "total_tables": len(tables),
152
+ "total_rows": total_rows,
153
+ "largest_table": max(table_stats.items(), key=lambda x: x[1]["row_count"])[0] if table_stats else None
154
+ },
155
+ "table_statistics": table_stats,
156
+ "last_updated": "dynamic"
157
+ }
158
+
159
+ return json.dumps(resource_content, indent=2)
160
+
161
+
162
+ def setup_mcp_resources(mcp_app: FastMCP, db_path: str) -> MemoryBankResources:
163
+ """Set up MCP Resources for the memory bank."""
164
+ return MemoryBankResources(mcp_app, db_path)
@@ -65,6 +65,8 @@ from .types import (
65
65
  SelectQueryResponse,
66
66
  )
67
67
  from .utils import catch_errors
68
+ from .resources import setup_mcp_resources
69
+ from .prompts import setup_mcp_prompts
68
70
 
69
71
  # Initialize FastMCP app with explicit name
70
72
  mcp: FastMCP = FastMCP("SQLite Memory Bank for Copilot/AI Agents")
@@ -78,6 +80,12 @@ os.makedirs(os.path.dirname(os.path.abspath(DB_PATH)), exist_ok=True)
78
80
  # Initialize database
79
81
  db = get_database(DB_PATH)
80
82
 
83
+ # Set up MCP Resources for enhanced context provision
84
+ setup_mcp_resources(mcp, DB_PATH)
85
+
86
+ # Set up MCP Prompts for enhanced workflow support
87
+ setup_mcp_prompts(mcp, DB_PATH)
88
+
81
89
 
82
90
  # --- Schema Management Tools for SQLite Memory Bank ---
83
91
 
@@ -671,6 +679,122 @@ def embedding_stats(table_name: str, embedding_column: str = "embedding") -> Too
671
679
  return cast(ToolResponse, get_database(DB_PATH).get_embedding_stats(table_name, embedding_column))
672
680
 
673
681
 
682
+ # --- Enhanced Tool Discovery and Categorization ---
683
+
684
+
685
+ @mcp.tool
686
+ @catch_errors
687
+ def list_tool_categories() -> ToolResponse:
688
+ """
689
+ List all available tool categories for better organization and discovery.
690
+
691
+ Returns organized view of available functionality for LLMs and agents.
692
+
693
+ Returns:
694
+ ToolResponse: {"success": True, "categories": {category: [tool_names]}}
695
+ """
696
+ categories = {
697
+ "schema_management": [
698
+ "create_table", "list_tables", "describe_table",
699
+ "drop_table", "rename_table", "list_all_columns"
700
+ ],
701
+ "data_operations": [
702
+ "create_row", "read_rows", "update_rows",
703
+ "delete_rows", "run_select_query"
704
+ ],
705
+ "search_discovery": [
706
+ "search_content", "explore_tables"
707
+ ],
708
+ "semantic_search": [
709
+ "add_embeddings", "semantic_search", "find_related",
710
+ "smart_search", "embedding_stats"
711
+ ],
712
+ "workflow_shortcuts": [
713
+ "quick_note", "remember_decision", "store_context"
714
+ ],
715
+ "analytics_insights": [
716
+ "memory_usage_stats", "content_analytics"
717
+ ]
718
+ }
719
+
720
+ return cast(ToolResponse, {
721
+ "success": True,
722
+ "categories": categories,
723
+ "total_tools": sum(len(tools) for tools in categories.values()),
724
+ "description": "Organized view of all available memory bank capabilities"
725
+ })
726
+
727
+
728
+ @mcp.tool
729
+ @catch_errors
730
+ def get_tools_by_category(category: str) -> ToolResponse:
731
+ """
732
+ Get detailed information about tools in a specific category.
733
+
734
+ Args:
735
+ category (str): Category name (schema_management, data_operations,
736
+ search_discovery, semantic_search, workflow_shortcuts, analytics_insights)
737
+
738
+ Returns:
739
+ ToolResponse: {"success": True, "tools": [{"name": str, "description": str, "usage": str}]}
740
+ """
741
+ tool_details = {
742
+ "schema_management": [
743
+ {"name": "create_table", "description": "Create new tables with custom schemas", "usage": "create_table('table_name', [{'name': 'col', 'type': 'TEXT'}])"},
744
+ {"name": "list_tables", "description": "List all available tables", "usage": "list_tables()"},
745
+ {"name": "describe_table", "description": "Get detailed schema for a table", "usage": "describe_table('table_name')"},
746
+ {"name": "drop_table", "description": "Delete a table permanently", "usage": "drop_table('table_name')"},
747
+ {"name": "rename_table", "description": "Rename an existing table", "usage": "rename_table('old_name', 'new_name')"},
748
+ {"name": "list_all_columns", "description": "Get all columns across all tables", "usage": "list_all_columns()"},
749
+ ],
750
+ "data_operations": [
751
+ {"name": "create_row", "description": "Insert new data into any table", "usage": "create_row('table', {'col': 'value'})"},
752
+ {"name": "read_rows", "description": "Query data with optional filtering", "usage": "read_rows('table', {'filter_col': 'value'})"},
753
+ {"name": "update_rows", "description": "Modify existing data", "usage": "update_rows('table', {'new_data': 'value'}, {'where_col': 'value'})"},
754
+ {"name": "delete_rows", "description": "Remove data from tables", "usage": "delete_rows('table', {'filter_col': 'value'})"},
755
+ {"name": "run_select_query", "description": "Execute safe SELECT queries", "usage": "run_select_query('table', ['col1', 'col2'], {'filter': 'value'})"},
756
+ ],
757
+ "search_discovery": [
758
+ {"name": "search_content", "description": "Full-text search across all content", "usage": "search_content('search query', ['table1', 'table2'])"},
759
+ {"name": "explore_tables", "description": "Discover table structures and sample data", "usage": "explore_tables('pattern*')"},
760
+ ],
761
+ "semantic_search": [
762
+ {"name": "add_embeddings", "description": "Enable semantic search on tables", "usage": "add_embeddings('table', ['text_col1', 'text_col2'])"},
763
+ {"name": "semantic_search", "description": "Natural language content discovery", "usage": "semantic_search('find ML algorithms')"},
764
+ {"name": "find_related", "description": "Discover similar content", "usage": "find_related('table', row_id, 0.5)"},
765
+ {"name": "smart_search", "description": "Hybrid keyword + semantic search", "usage": "smart_search('search query')"},
766
+ {"name": "embedding_stats", "description": "Check semantic search readiness", "usage": "embedding_stats('table')"},
767
+ ],
768
+ "workflow_shortcuts": [
769
+ {"name": "quick_note", "description": "Rapidly store notes and observations", "usage": "quick_note('content', 'category')"},
770
+ {"name": "remember_decision", "description": "Store technical decisions with context", "usage": "remember_decision('decision', 'approach', 'rationale')"},
771
+ {"name": "store_context", "description": "Save session context and progress", "usage": "store_context('topic', 'current_state', 'next_steps')"},
772
+ ],
773
+ "analytics_insights": [
774
+ {"name": "memory_usage_stats", "description": "Analyze memory bank usage patterns", "usage": "memory_usage_stats()"},
775
+ {"name": "content_analytics", "description": "Get insights on stored content", "usage": "content_analytics('table_name')"},
776
+ ],
777
+ }
778
+
779
+ if category not in tool_details:
780
+ return cast(ToolResponse, {
781
+ "success": False,
782
+ "error": f"Unknown category '{category}'. Available: {list(tool_details.keys())}",
783
+ "category": "VALIDATION",
784
+ "details": {"available_categories": list(tool_details.keys())},
785
+ })
786
+
787
+ return cast(ToolResponse, {
788
+ "success": True,
789
+ "category": category,
790
+ "tools": tool_details[category],
791
+ "tool_count": len(tool_details[category]),
792
+ })
793
+
794
+
795
+ # ...existing code...
796
+
797
+
674
798
  # Export the FastMCP app for use in other modules and server runners
675
799
  app = mcp
676
800
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp_sqlite_memory_bank
3
- Version: 1.3.1
3
+ Version: 1.4.1
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
- - Explicit, discoverable APIs for LLMs and agents
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
- ### Table Management Tools
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 Management Tools
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
@@ -5,7 +5,9 @@ pyproject.toml
5
5
  setup.cfg
6
6
  src/mcp_sqlite_memory_bank/__init__.py
7
7
  src/mcp_sqlite_memory_bank/database.py
8
+ src/mcp_sqlite_memory_bank/prompts.py
8
9
  src/mcp_sqlite_memory_bank/py.typed
10
+ src/mcp_sqlite_memory_bank/resources.py
9
11
  src/mcp_sqlite_memory_bank/semantic.py
10
12
  src/mcp_sqlite_memory_bank/server.py
11
13
  src/mcp_sqlite_memory_bank/types.py