mcp-sqlite-memory-bank 1.5.0__tar.gz → 1.5.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 (35) hide show
  1. {mcp_sqlite_memory_bank-1.5.0/src/mcp_sqlite_memory_bank.egg-info → mcp_sqlite_memory_bank-1.5.1}/PKG-INFO +1 -1
  2. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/pyproject.toml +1 -1
  3. mcp_sqlite_memory_bank-1.5.1/src/mcp_sqlite_memory_bank/__main__.py +59 -0
  4. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank/server.py +157 -1
  5. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank/tools/__init__.py +11 -0
  6. mcp_sqlite_memory_bank-1.5.1/src/mcp_sqlite_memory_bank/tools/discovery.py +1176 -0
  7. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1/src/mcp_sqlite_memory_bank.egg-info}/PKG-INFO +1 -1
  8. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank.egg-info/SOURCES.txt +8 -0
  9. mcp_sqlite_memory_bank-1.5.1/tests/README.md +287 -0
  10. mcp_sqlite_memory_bank-1.5.1/tests/conftest.py +372 -0
  11. mcp_sqlite_memory_bank-1.5.1/tests/test_discovery_tools.py +658 -0
  12. mcp_sqlite_memory_bank-1.5.1/tests/test_edge_cases.py +579 -0
  13. mcp_sqlite_memory_bank-1.5.1/tests/test_mocks.py +315 -0
  14. mcp_sqlite_memory_bank-1.5.1/tests/test_performance.py +517 -0
  15. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/LICENSE +0 -0
  16. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/MANIFEST.in +0 -0
  17. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/README.md +0 -0
  18. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/setup.cfg +0 -0
  19. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank/__init__.py +0 -0
  20. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank/database.py +0 -0
  21. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank/prompts.py +0 -0
  22. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank/py.typed +0 -0
  23. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank/resources.py +0 -0
  24. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank/semantic.py +0 -0
  25. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank/tools/analytics.py +0 -0
  26. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank/tools/basic.py +0 -0
  27. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank/tools/search.py +0 -0
  28. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank/types.py +0 -0
  29. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank/utils.py +0 -0
  30. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank.egg-info/dependency_links.txt +0 -0
  31. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank.egg-info/entry_points.txt +0 -0
  32. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank.egg-info/requires.txt +0 -0
  33. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/src/mcp_sqlite_memory_bank.egg-info/top_level.txt +0 -0
  34. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.1}/tests/test_api.py +0 -0
  35. {mcp_sqlite_memory_bank-1.5.0 → mcp_sqlite_memory_bank-1.5.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.5.0
3
+ Version: 1.5.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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mcp_sqlite_memory_bank"
7
- version = "1.5.0"
7
+ version = "1.5.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,59 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Entry point for running the SQLite Memory Bank MCP server.
4
+
5
+ This module provides a clean entry point for MCP clients to start the server
6
+ without import issues or circular dependencies.
7
+ """
8
+
9
+ import logging
10
+ import sys
11
+ import os
12
+
13
+ # Add the project root to Python path to avoid import issues
14
+ project_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
15
+ if project_root not in sys.path:
16
+ sys.path.insert(0, project_root)
17
+
18
+ # Configure logging before any other imports
19
+ logging.basicConfig(
20
+ level=logging.INFO,
21
+ format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
22
+ )
23
+
24
+ def main():
25
+ """Main entry point for the MCP server."""
26
+ try:
27
+ # Import here to avoid circular import issues
28
+ from .server import app, DB_PATH
29
+
30
+ # Handle help argument
31
+ if "--help" in sys.argv or "-h" in sys.argv:
32
+ print("SQLite Memory Bank MCP Server")
33
+ print("Usage: python -m src.mcp_sqlite_memory_bank")
34
+ print("")
35
+ print("This starts the SQLite Memory Bank as an MCP (Model Context Protocol) server.")
36
+ print("The server communicates via STDIO and provides memory management tools")
37
+ print("for LLMs and AI agents.")
38
+ print("")
39
+ print(f"Database location: {DB_PATH}")
40
+ print("")
41
+ print("Environment variables:")
42
+ print(" DB_PATH: Override the default database path")
43
+ return
44
+
45
+ # Log startup information
46
+ logging.info(f"Starting SQLite Memory Bank MCP server with database at {DB_PATH}")
47
+
48
+ # Run the FastMCP app in stdio mode for MCP clients
49
+ app.run(transport="stdio")
50
+
51
+ except KeyboardInterrupt:
52
+ logging.info("Server stopped by user")
53
+ sys.exit(0)
54
+ except Exception as e:
55
+ logging.error(f"Failed to start MCP server: {e}")
56
+ sys.exit(1)
57
+
58
+ if __name__ == "__main__":
59
+ main()
@@ -409,6 +409,13 @@ from .tools.search import (
409
409
  embedding_stats as embedding_stats_impl,
410
410
  )
411
411
 
412
+ # Import the implementation functions from discovery module
413
+ from .tools.discovery import (
414
+ intelligent_discovery as intelligent_discovery_impl,
415
+ discovery_templates as discovery_templates_impl,
416
+ discover_relationships as discover_relationships_impl,
417
+ )
418
+
412
419
  # --- MCP Tool Definitions (Required in main server.py for FastMCP) ---
413
420
 
414
421
  @mcp.tool
@@ -799,6 +806,147 @@ def find_related(
799
806
  return _find_related_impl(table_name, row_id, similarity_threshold, limit, model_name)
800
807
 
801
808
 
809
+ # --- Advanced Discovery Tools for SQLite Memory Bank ---
810
+
811
+ @mcp.tool
812
+ @catch_errors
813
+ def intelligent_discovery(
814
+ discovery_goal: str = "understand_content",
815
+ focus_area: Optional[str] = None,
816
+ depth: str = "moderate",
817
+ agent_id: Optional[str] = None,
818
+ ) -> ToolResponse:
819
+ """
820
+ 🧠 **INTELLIGENT DISCOVERY** - AI-guided exploration of your memory bank!
821
+
822
+ Orchestrates multiple discovery tools based on your exploration goals.
823
+ Provides step-by-step guidance and actionable insights tailored to your needs.
824
+
825
+ Args:
826
+ discovery_goal (str): What you want to achieve
827
+ - "understand_content": Learn what data is available and how it's organized
828
+ - "find_patterns": Discover themes, relationships, and content patterns
829
+ - "explore_structure": Understand database schema and organization
830
+ - "assess_quality": Evaluate content quality and completeness
831
+ - "prepare_search": Get ready for effective content searching
832
+ focus_area (Optional[str]): Specific table or topic to focus on (default: all)
833
+ depth (str): How thorough the discovery should be
834
+ - "quick": Fast overview with key insights
835
+ - "moderate": Balanced analysis with actionable recommendations
836
+ - "comprehensive": Deep dive with detailed analysis
837
+ agent_id (Optional[str]): Agent identifier for learning discovery patterns
838
+
839
+ Returns:
840
+ ToolResponse: On success: {"success": True, "discovery": Dict, "next_steps": List}
841
+ On error: {"success": False, "error": str, "category": str, "details": dict}
842
+
843
+ Examples:
844
+ >>> intelligent_discovery("understand_content")
845
+ {"success": True, "discovery": {
846
+ "overview": {"total_tables": 5, "total_rows": 234},
847
+ "content_summary": {...},
848
+ "recommendations": [...]
849
+ }, "next_steps": ["Use auto_smart_search() for specific queries"]}
850
+
851
+ FastMCP Tool Info:
852
+ - **COMPLETELY AUTOMATED**: No manual tool chaining required
853
+ - **GOAL-ORIENTED**: Tailored discovery based on your specific objectives
854
+ - **ACTIONABLE INSIGHTS**: Always includes concrete next steps
855
+ - **LEARNING**: Improves recommendations based on usage patterns
856
+ - **PERFECT FOR AGENTS**: Single tool that orchestrates complex discovery workflows
857
+ """
858
+ return intelligent_discovery_impl(discovery_goal, focus_area, depth, agent_id)
859
+
860
+
861
+ @mcp.tool
862
+ @catch_errors
863
+ def discovery_templates(
864
+ template_type: str = "first_time_exploration",
865
+ customize_for: Optional[str] = None
866
+ ) -> ToolResponse:
867
+ """
868
+ 📋 **DISCOVERY TEMPLATES** - Pre-built exploration workflows for common scenarios!
869
+
870
+ Provides step-by-step discovery templates optimized for specific agent use cases.
871
+ Each template includes the exact sequence of tools to call and what to look for.
872
+
873
+ Args:
874
+ template_type (str): Type of discovery template to provide
875
+ - "first_time_exploration": Complete workflow for new agents
876
+ - "content_audit": Systematic content quality review
877
+ - "search_optimization": Prepare memory bank for optimal searching
878
+ - "relationship_mapping": Discover connections between data
879
+ - "problem_solving": Find information to solve specific problems
880
+ - "knowledge_extraction": Extract insights from stored knowledge
881
+ customize_for (Optional[str]): Customize template for specific domain/topic
882
+
883
+ Returns:
884
+ ToolResponse: {"success": True, "template": Dict, "workflow": List}
885
+
886
+ Examples:
887
+ >>> discovery_templates("first_time_exploration")
888
+ {"success": True, "template": {
889
+ "name": "First Time Exploration",
890
+ "description": "Complete discovery workflow for new agents",
891
+ "workflow": [
892
+ {"step": 1, "tool": "intelligent_discovery", "params": {...}},
893
+ {"step": 2, "tool": "explore_tables", "params": {...}}
894
+ ]
895
+ }}
896
+
897
+ FastMCP Tool Info:
898
+ - **PROVEN WORKFLOWS**: Battle-tested discovery sequences
899
+ - **STEP-BY-STEP GUIDANCE**: Exact tools and parameters to use
900
+ - **CUSTOMIZABLE**: Adapt templates to your specific needs
901
+ - **LEARNING-OPTIMIZED**: Based on successful discovery patterns
902
+ """
903
+ return discovery_templates_impl(template_type, customize_for)
904
+
905
+
906
+ @mcp.tool
907
+ @catch_errors
908
+ def discover_relationships(
909
+ table_name: Optional[str] = None,
910
+ relationship_types: List[str] = ["foreign_keys", "semantic_similarity", "temporal_patterns"],
911
+ similarity_threshold: float = 0.6
912
+ ) -> ToolResponse:
913
+ """
914
+ 🔗 **RELATIONSHIP DISCOVERY** - Find hidden connections in your data!
915
+
916
+ Automatically discovers relationships between tables and content areas using
917
+ both structural analysis and semantic similarity to reveal data connections.
918
+
919
+ Args:
920
+ table_name (Optional[str]): Focus on relationships for specific table (default: all)
921
+ relationship_types (List[str]): Types of relationships to discover
922
+ - "foreign_keys": Structural relationships via foreign keys
923
+ - "semantic_similarity": Content-based relationships via semantic analysis
924
+ - "temporal_patterns": Time-based relationships and patterns
925
+ - "naming_patterns": Relationships based on naming conventions
926
+ similarity_threshold (float): Minimum similarity for semantic relationships (0.0-1.0)
927
+
928
+ Returns:
929
+ ToolResponse: {"success": True, "relationships": Dict, "insights": List}
930
+
931
+ Examples:
932
+ >>> discover_relationships("users")
933
+ {"success": True, "relationships": {
934
+ "users": {
935
+ "foreign_key_refs": ["posts.user_id", "comments.user_id"],
936
+ "semantic_similar": [{"table": "profiles", "similarity": 0.8}],
937
+ "temporal_related": ["user_sessions"]
938
+ }
939
+ }}
940
+
941
+ FastMCP Tool Info:
942
+ - **AUTOMATIC DETECTION**: Finds relationships you might not notice manually
943
+ - **MULTIPLE METHODS**: Combines structural, semantic, and temporal analysis
944
+ - **ACTIONABLE INSIGHTS**: Suggests how to leverage discovered relationships
945
+ - **PERFECT FOR EXPLORATION**: Reveals hidden data organization patterns
946
+ """
947
+ return discover_relationships_impl(table_name, relationship_types, similarity_threshold)
948
+
949
+
802
950
  # Export the FastMCP app for use in other modules and server runners
803
951
  app = mcp
804
952
 
@@ -851,6 +999,9 @@ __all__ = [
851
999
  "auto_semantic_search",
852
1000
  "auto_smart_search",
853
1001
  "embedding_stats",
1002
+ "intelligent_discovery",
1003
+ "discovery_templates",
1004
+ "discover_relationships",
854
1005
  ]
855
1006
 
856
1007
 
@@ -900,7 +1051,7 @@ if __name__ == "__main__":
900
1051
  logging.info(f"Starting SQLite Memory Bank with database at {DB_PATH}")
901
1052
 
902
1053
  # Run the FastMCP app in stdio mode for MCP clients
903
- app.run()
1054
+ app.run(transport="stdio")
904
1055
 
905
1056
 
906
1057
  # Compatibility aliases for tests that expect _impl functions
@@ -929,3 +1080,8 @@ _auto_smart_search_impl = search.auto_smart_search
929
1080
  # Analytics operation aliases
930
1081
  _analyze_memory_patterns_impl = analytics.analyze_memory_patterns
931
1082
  _get_content_health_score_impl = analytics.get_content_health_score
1083
+
1084
+ # Discovery operation aliases
1085
+ _intelligent_discovery_impl = intelligent_discovery_impl
1086
+ _discovery_templates_impl = discovery_templates_impl
1087
+ _discover_relationships_impl = discover_relationships_impl
@@ -4,6 +4,7 @@ Tools module for SQLite Memory Bank MCP server.
4
4
  This module organizes the various MCP tools into logical categories:
5
5
  - analytics: Content analysis and health assessment tools
6
6
  - search: Intelligent search and discovery tools
7
+ - discovery: Advanced exploration and relationship discovery tools
7
8
  - basic: Core CRUD operations and table management
8
9
  """
9
10
 
@@ -23,6 +24,11 @@ from .search import (
23
24
  auto_semantic_search,
24
25
  auto_smart_search,
25
26
  )
27
+ from .discovery import (
28
+ intelligent_discovery,
29
+ discovery_templates,
30
+ discover_relationships,
31
+ )
26
32
  from .basic import (
27
33
  create_table,
28
34
  list_tables,
@@ -53,6 +59,11 @@ __all__ = [
53
59
  'auto_semantic_search',
54
60
  'auto_smart_search',
55
61
 
62
+ # Discovery tools
63
+ 'intelligent_discovery',
64
+ 'discovery_templates',
65
+ 'discover_relationships',
66
+
56
67
  # Basic tools
57
68
  'create_table',
58
69
  'list_tables',