spatial-memory-mcp 1.0.2__tar.gz → 1.5.3__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.

Potentially problematic release.


This version of spatial-memory-mcp might be problematic. Click here for more details.

Files changed (135) hide show
  1. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/PKG-INFO +1 -1
  2. spatial_memory_mcp-1.5.3/docs/MCP_SERVER_INSTRUCTIONS.md +96 -0
  3. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/pyproject.toml +1 -1
  4. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/__init__.py +97 -97
  5. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/config.py +105 -0
  6. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/__init__.py +26 -0
  7. spatial_memory_mcp-1.5.3/spatial_memory/core/cache.py +317 -0
  8. spatial_memory_mcp-1.5.3/spatial_memory/core/circuit_breaker.py +297 -0
  9. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/database.py +167 -1
  10. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/embeddings.py +92 -2
  11. spatial_memory_mcp-1.5.3/spatial_memory/core/logging.py +194 -0
  12. spatial_memory_mcp-1.5.3/spatial_memory/core/rate_limiter.py +309 -0
  13. spatial_memory_mcp-1.5.3/spatial_memory/core/tracing.py +300 -0
  14. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/validation.py +319 -319
  15. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/server.py +230 -29
  16. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/services/memory.py +79 -2
  17. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/tools/definitions.py +695 -671
  18. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/test_database.py +15 -8
  19. spatial_memory_mcp-1.5.3/tests/integration/test_server_v153.py +383 -0
  20. spatial_memory_mcp-1.5.3/tests/unit/test_cache.py +701 -0
  21. spatial_memory_mcp-1.5.3/tests/unit/test_circuit_breaker.py +716 -0
  22. spatial_memory_mcp-1.5.3/tests/unit/test_tracing.py +609 -0
  23. spatial_memory_mcp-1.0.2/IMPLEMENTATION_PLAN.md +0 -601
  24. spatial_memory_mcp-1.0.2/PROPOSED_CHANGES.md +0 -486
  25. spatial_memory_mcp-1.0.2/spatial_memory/core/logging.py +0 -103
  26. spatial_memory_mcp-1.0.2/spatial_memory/core/rate_limiter.py +0 -105
  27. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/.env.example +0 -0
  28. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/.gitignore +0 -0
  29. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/CHANGELOG.md +0 -0
  30. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/CLAUDE.md +0 -0
  31. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/CONTRIBUTING.md +0 -0
  32. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/LICENSE +0 -0
  33. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/LIFECYCLE_PHASE_PLAN.md +0 -0
  34. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/PHASE4B_PLAN.md +0 -0
  35. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/PHASE4_PLAN.md +0 -0
  36. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/PHASE5_UTILITIES_PLAN.md +0 -0
  37. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/README.md +0 -0
  38. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/SECURITY.md +0 -0
  39. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/SPATIAL-MEMORY-ARCHITECTURE-DIAGRAMS.md +0 -0
  40. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/SPATIAL-MEMORY-MCP-SERVER-PLAN (1).md +0 -0
  41. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/docs/API.md +0 -0
  42. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/docs/BENCHMARKS.md +0 -0
  43. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/docs/METRICS.md +0 -0
  44. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/docs/troubleshooting.md +0 -0
  45. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/examples/demo_config_logging.py +0 -0
  46. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/scripts/benchmark.py +0 -0
  47. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/scripts/inspect_db.py +0 -0
  48. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/scripts/populate_test_data.py +0 -0
  49. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/scripts/test_all_tools.py +0 -0
  50. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/__main__.py +0 -0
  51. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/adapters/__init__.py +0 -0
  52. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/adapters/lancedb_repository.py +0 -0
  53. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/connection_pool.py +0 -0
  54. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/errors.py +0 -0
  55. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/file_security.py +0 -0
  56. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/health.py +0 -0
  57. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/helpers.py +0 -0
  58. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/import_security.py +0 -0
  59. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/lifecycle_ops.py +0 -0
  60. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/metrics.py +0 -0
  61. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/models.py +0 -0
  62. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/security.py +0 -0
  63. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/spatial_ops.py +0 -0
  64. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/core/utils.py +0 -0
  65. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/ports/__init__.py +0 -0
  66. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/ports/repositories.py +0 -0
  67. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/py.typed +0 -0
  68. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/services/__init__.py +0 -0
  69. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/services/export_import.py +0 -0
  70. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/services/lifecycle.py +0 -0
  71. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/services/spatial.py +0 -0
  72. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/services/utility.py +0 -0
  73. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/tools/__init__.py +0 -0
  74. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/spatial_memory/verify.py +0 -0
  75. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/hdbscan/__init__.pyi +0 -0
  76. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/lancedb/__init__.pyi +0 -0
  77. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/lancedb/index.pyi +0 -0
  78. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/lancedb/rerankers.pyi +0 -0
  79. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/lancedb/table.pyi +0 -0
  80. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/mcp/__init__.pyi +0 -0
  81. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/mcp/server/__init__.pyi +0 -0
  82. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/mcp/server/stdio.pyi +0 -0
  83. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/mcp/types.pyi +0 -0
  84. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/openai/__init__.pyi +0 -0
  85. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/pyarrow/__init__.pyi +0 -0
  86. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/pyarrow/parquet.pyi +0 -0
  87. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/sklearn/__init__.pyi +0 -0
  88. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/sklearn/metrics/__init__.pyi +0 -0
  89. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/stubs/umap/__init__.pyi +0 -0
  90. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/__init__.py +0 -0
  91. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/conftest.py +0 -0
  92. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/__init__.py +0 -0
  93. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/conftest.py +0 -0
  94. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/test_backup_restore.py +0 -0
  95. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/test_concurrent_writes.py +0 -0
  96. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/test_cross_process_locking.py +0 -0
  97. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/test_database_safeguards.py +0 -0
  98. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/test_embeddings.py +0 -0
  99. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/test_enterprise_features.py +0 -0
  100. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/test_indexing.py +0 -0
  101. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/test_mcp_server.py +0 -0
  102. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/test_namespace_ops.py +0 -0
  103. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/test_phase5_tools.py +0 -0
  104. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/test_security_edge_cases.py +0 -0
  105. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/integration/test_ttl_snapshots.py +0 -0
  106. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/test_config.py +0 -0
  107. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/test_connection_pool.py +0 -0
  108. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/test_health.py +0 -0
  109. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/test_helpers.py +0 -0
  110. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/test_logging.py +0 -0
  111. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/test_metrics.py +0 -0
  112. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/test_models.py +0 -0
  113. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/test_rate_limiter.py +0 -0
  114. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/test_validation.py +0 -0
  115. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/__init__.py +0 -0
  116. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_config_phase5.py +0 -0
  117. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_errors_phase5.py +0 -0
  118. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_export_import_service.py +0 -0
  119. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_export_ops.py +0 -0
  120. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_file_security.py +0 -0
  121. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_hybrid_search_ops.py +0 -0
  122. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_import_ops.py +0 -0
  123. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_import_security.py +0 -0
  124. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_lancedb_repository_phase5.py +0 -0
  125. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_lifecycle_ops.py +0 -0
  126. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_lifecycle_service.py +0 -0
  127. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_memory_service.py +0 -0
  128. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_models_phase5.py +0 -0
  129. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_process_lock.py +0 -0
  130. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_security_facade.py +0 -0
  131. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_spatial_ops.py +0 -0
  132. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_spatial_service.py +0 -0
  133. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_stats_ops.py +0 -0
  134. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_utility_service.py +0 -0
  135. {spatial_memory_mcp-1.0.2 → spatial_memory_mcp-1.5.3}/tests/unit/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spatial-memory-mcp
3
- Version: 1.0.2
3
+ Version: 1.5.3
4
4
  Summary: Spatial bidirectional persistent memory MCP server for LLMs - vector-based semantic memory as a navigable landscape
5
5
  Project-URL: Homepage, https://github.com/arman-tech/spatial-memory-mcp
6
6
  Project-URL: Repository, https://github.com/arman-tech/spatial-memory-mcp
@@ -0,0 +1,96 @@
1
+ # MCP Server Instructions: Auto-Injected AI Behavioral Guidelines
2
+
3
+ ## Discovery
4
+
5
+ When users install an MCP server, the server can provide **instructions** that are automatically injected into Claude's system prompt. This enables MCP servers to define behavioral guidelines that Claude follows without requiring users to manually configure anything.
6
+
7
+ ## Technical Implementation
8
+
9
+ The MCP Python SDK's `Server` class accepts an `instructions` parameter:
10
+
11
+ ```python
12
+ from mcp.server import Server
13
+
14
+ server = Server(
15
+ name="spatial-memory",
16
+ version="1.5.3",
17
+ instructions="""
18
+ Your behavioral instructions here...
19
+ """
20
+ )
21
+ ```
22
+
23
+ These instructions are:
24
+ - Sent during the MCP initialize handshake
25
+ - Automatically concatenated into Claude's system prompt
26
+ - Displayed under "# MCP Server Instructions" in Claude's context
27
+ - Require **zero user action** - fully automatic
28
+
29
+ ## Why This Matters
30
+
31
+ ### The Problem
32
+ - Users install MCP servers but don't know optimal usage patterns
33
+ - AI assistants use tools reactively rather than proactively
34
+ - Knowledge capture requires manual effort ("save this to memory")
35
+ - Each session starts from scratch without prior context
36
+
37
+ ### The Solution
38
+ Server-provided instructions enable:
39
+ 1. **Zero cognitive load** - Claude handles memory mechanics automatically
40
+ 2. **Proactive behavior** - Claude recognizes memory-worthy moments
41
+ 3. **Consistent UX** - All users get the same optimized experience
42
+ 4. **Seamless context** - Previous learnings auto-load at session start
43
+
44
+ ## Comparison of Approaches
45
+
46
+ | Approach | Auto-loaded? | User Action Required | Scope |
47
+ |----------|--------------|---------------------|-------|
48
+ | `~/.claude/CLAUDE.md` | Yes | User must create/edit | Global |
49
+ | `<project>/CLAUDE.md` | Yes | User must create/edit | Project |
50
+ | MCP `instructions` param | Yes | **None** | Per-server |
51
+
52
+ ## spatial-memory-mcp Instructions
53
+
54
+ The following instructions are injected when spatial-memory-mcp connects:
55
+
56
+ ```
57
+ ## Spatial Memory System
58
+
59
+ You have access to a persistent semantic memory system. Use it proactively.
60
+
61
+ ### Session Start
62
+ At conversation start, call `recall` with the user's apparent task/context to load relevant memories. Present insights naturally: "Based on previous work..." not "The database returned...".
63
+
64
+ ### Recognizing Memory-Worthy Moments
65
+ After these events, ask "Save this? y/n" (minimal friction):
66
+ - Decisions: "Let's use X approach...", "We decided..."
67
+ - Solutions: "The fix was...", "It failed because..."
68
+ - Patterns: "This pattern works...", "The trick is..."
69
+ - Discoveries: "I found that...", "Important:..."
70
+
71
+ ### Saving Memories
72
+ When confirmed, save with:
73
+ - **Detailed content**: Future agents need full context
74
+ - **Contextual namespace**: Project name, "decisions", "errors", etc.
75
+ - **Descriptive tags**: Technologies, concepts, patterns involved
76
+
77
+ ### Synthesizing Answers
78
+ When recalling memories, present as natural knowledge:
79
+ - Good: "In previous sessions, you decided to use PostgreSQL for..."
80
+ - Bad: "Here are the query results: [{id: '...', content: '...'}]"
81
+
82
+ ### Auto-Extract
83
+ For significant problem-solving conversations, offer to use `extract` to automatically capture key learnings.
84
+ ```
85
+
86
+ ## Implementation Location
87
+
88
+ - **File**: `spatial_memory/server.py`
89
+ - **Line**: Server initialization (~340)
90
+ - **Parameter**: `instructions`
91
+
92
+ ## Related Files
93
+
94
+ - `spatial_memory/server.py` - Server implementation
95
+ - `CLAUDE.md` - Project-level instructions (for contributors)
96
+ - `docs/MCP_SERVER_INSTRUCTIONS.md` - This document
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "spatial-memory-mcp"
3
- version = "1.0.2"
3
+ version = "1.5.3"
4
4
  description = "Spatial bidirectional persistent memory MCP server for LLMs - vector-based semantic memory as a navigable landscape"
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}
@@ -1,97 +1,97 @@
1
- """Spatial Memory MCP Server - Vector-based semantic memory for LLMs."""
2
-
3
- __version__ = "1.0.1"
4
- __author__ = "arman-tech"
5
-
6
- # Re-export core components for convenience
7
- # Adapters
8
- from spatial_memory.adapters.lancedb_repository import LanceDBMemoryRepository
9
- from spatial_memory.config import Settings, get_settings
10
- from spatial_memory.core import (
11
- ClusterInfo,
12
- ClusteringError,
13
- ConfigurationError,
14
- # Core services
15
- Database,
16
- EmbeddingError,
17
- EmbeddingService,
18
- Filter,
19
- FilterGroup,
20
- FilterOperator,
21
- JourneyStep,
22
- # Models
23
- Memory,
24
- MemoryNotFoundError,
25
- MemoryResult,
26
- MemorySource,
27
- NamespaceNotFoundError,
28
- # Errors
29
- SpatialMemoryError,
30
- StorageError,
31
- ValidationError,
32
- VisualizationCluster,
33
- VisualizationData,
34
- VisualizationEdge,
35
- VisualizationError,
36
- VisualizationNode,
37
- )
38
-
39
- # Server
40
- from spatial_memory.server import SpatialMemoryServer, create_server
41
-
42
- # Services
43
- from spatial_memory.services.memory import (
44
- ForgetResult,
45
- MemoryService,
46
- NearbyResult,
47
- RecallResult,
48
- RememberBatchResult,
49
- RememberResult,
50
- )
51
-
52
- __all__ = [
53
- # Version info
54
- "__version__",
55
- "__author__",
56
- # Configuration
57
- "Settings",
58
- "get_settings",
59
- # Errors
60
- "SpatialMemoryError",
61
- "MemoryNotFoundError",
62
- "NamespaceNotFoundError",
63
- "EmbeddingError",
64
- "StorageError",
65
- "ValidationError",
66
- "ConfigurationError",
67
- "ClusteringError",
68
- "VisualizationError",
69
- # Models
70
- "Memory",
71
- "MemorySource",
72
- "MemoryResult",
73
- "ClusterInfo",
74
- "JourneyStep",
75
- "VisualizationNode",
76
- "VisualizationEdge",
77
- "VisualizationCluster",
78
- "VisualizationData",
79
- "Filter",
80
- "FilterOperator",
81
- "FilterGroup",
82
- # Core services
83
- "Database",
84
- "EmbeddingService",
85
- # Services
86
- "MemoryService",
87
- "RememberResult",
88
- "RememberBatchResult",
89
- "RecallResult",
90
- "NearbyResult",
91
- "ForgetResult",
92
- # Adapters
93
- "LanceDBMemoryRepository",
94
- # Server
95
- "SpatialMemoryServer",
96
- "create_server",
97
- ]
1
+ """Spatial Memory MCP Server - Vector-based semantic memory for LLMs."""
2
+
3
+ __version__ = "1.5.3"
4
+ __author__ = "arman-tech"
5
+
6
+ # Re-export core components for convenience
7
+ # Adapters
8
+ from spatial_memory.adapters.lancedb_repository import LanceDBMemoryRepository
9
+ from spatial_memory.config import Settings, get_settings
10
+ from spatial_memory.core import (
11
+ ClusterInfo,
12
+ ClusteringError,
13
+ ConfigurationError,
14
+ # Core services
15
+ Database,
16
+ EmbeddingError,
17
+ EmbeddingService,
18
+ Filter,
19
+ FilterGroup,
20
+ FilterOperator,
21
+ JourneyStep,
22
+ # Models
23
+ Memory,
24
+ MemoryNotFoundError,
25
+ MemoryResult,
26
+ MemorySource,
27
+ NamespaceNotFoundError,
28
+ # Errors
29
+ SpatialMemoryError,
30
+ StorageError,
31
+ ValidationError,
32
+ VisualizationCluster,
33
+ VisualizationData,
34
+ VisualizationEdge,
35
+ VisualizationError,
36
+ VisualizationNode,
37
+ )
38
+
39
+ # Server
40
+ from spatial_memory.server import SpatialMemoryServer, create_server
41
+
42
+ # Services
43
+ from spatial_memory.services.memory import (
44
+ ForgetResult,
45
+ MemoryService,
46
+ NearbyResult,
47
+ RecallResult,
48
+ RememberBatchResult,
49
+ RememberResult,
50
+ )
51
+
52
+ __all__ = [
53
+ # Version info
54
+ "__version__",
55
+ "__author__",
56
+ # Configuration
57
+ "Settings",
58
+ "get_settings",
59
+ # Errors
60
+ "SpatialMemoryError",
61
+ "MemoryNotFoundError",
62
+ "NamespaceNotFoundError",
63
+ "EmbeddingError",
64
+ "StorageError",
65
+ "ValidationError",
66
+ "ConfigurationError",
67
+ "ClusteringError",
68
+ "VisualizationError",
69
+ # Models
70
+ "Memory",
71
+ "MemorySource",
72
+ "MemoryResult",
73
+ "ClusterInfo",
74
+ "JourneyStep",
75
+ "VisualizationNode",
76
+ "VisualizationEdge",
77
+ "VisualizationCluster",
78
+ "VisualizationData",
79
+ "Filter",
80
+ "FilterOperator",
81
+ "FilterGroup",
82
+ # Core services
83
+ "Database",
84
+ "EmbeddingService",
85
+ # Services
86
+ "MemoryService",
87
+ "RememberResult",
88
+ "RememberBatchResult",
89
+ "RecallResult",
90
+ "NearbyResult",
91
+ "ForgetResult",
92
+ # Adapters
93
+ "LanceDBMemoryRepository",
94
+ # Server
95
+ "SpatialMemoryServer",
96
+ "create_server",
97
+ ]
@@ -480,6 +480,111 @@ class Settings(BaseSettings):
480
480
  description="Maximum alpha for hybrid search (1.0=pure vector)",
481
481
  )
482
482
 
483
+ # =========================================================================
484
+ # v1.5.3 Phase 1: Observability Settings
485
+ # =========================================================================
486
+
487
+ include_request_meta: bool = Field(
488
+ default=False,
489
+ description="Include _meta object in responses (request_id, timing, etc.)",
490
+ )
491
+ log_include_trace_context: bool = Field(
492
+ default=True,
493
+ description="Add [req=][agent=] trace context to log messages",
494
+ )
495
+ include_timing_breakdown: bool = Field(
496
+ default=False,
497
+ description="Include timing_ms breakdown in _meta (requires include_request_meta)",
498
+ )
499
+
500
+ # =========================================================================
501
+ # v1.5.3 Phase 2: Efficiency Settings
502
+ # =========================================================================
503
+
504
+ warm_up_on_start: bool = Field(
505
+ default=True,
506
+ description="Pre-load embedding model on startup for faster first request",
507
+ )
508
+ response_cache_enabled: bool = Field(
509
+ default=True,
510
+ description="Enable response caching for idempotent operations",
511
+ )
512
+ response_cache_max_size: int = Field(
513
+ default=1000,
514
+ ge=100,
515
+ le=100000,
516
+ description="Maximum number of cached responses (LRU eviction)",
517
+ )
518
+ response_cache_default_ttl: float = Field(
519
+ default=60.0,
520
+ ge=1.0,
521
+ le=3600.0,
522
+ description="Default TTL in seconds for cached responses",
523
+ )
524
+ response_cache_regions_ttl: float = Field(
525
+ default=300.0,
526
+ ge=60.0,
527
+ le=3600.0,
528
+ description="TTL in seconds for regions() responses (expensive operation)",
529
+ )
530
+ idempotency_enabled: bool = Field(
531
+ default=True,
532
+ description="Enable idempotency key support for write operations",
533
+ )
534
+ idempotency_key_ttl_hours: float = Field(
535
+ default=24.0,
536
+ ge=1.0,
537
+ le=168.0,
538
+ description="Hours to remember idempotency keys (max 7 days)",
539
+ )
540
+
541
+ # =========================================================================
542
+ # v1.5.3 Phase 3: Resilience Settings
543
+ # =========================================================================
544
+
545
+ rate_limit_per_agent_enabled: bool = Field(
546
+ default=True,
547
+ description="Enable per-agent rate limiting",
548
+ )
549
+ rate_limit_per_agent_rate: float = Field(
550
+ default=25.0,
551
+ ge=1.0,
552
+ le=1000.0,
553
+ description="Maximum operations per second per agent",
554
+ )
555
+ rate_limit_max_tracked_agents: int = Field(
556
+ default=20,
557
+ ge=1,
558
+ le=1000,
559
+ description="Maximum number of agents to track for rate limiting (LRU eviction)",
560
+ )
561
+ circuit_breaker_enabled: bool = Field(
562
+ default=True,
563
+ description="Enable circuit breaker for external dependencies",
564
+ )
565
+ circuit_breaker_failure_threshold: int = Field(
566
+ default=5,
567
+ ge=1,
568
+ le=100,
569
+ description="Number of consecutive failures before circuit opens",
570
+ )
571
+ circuit_breaker_reset_timeout: float = Field(
572
+ default=60.0,
573
+ ge=5.0,
574
+ le=600.0,
575
+ description="Seconds to wait before attempting half-open state",
576
+ )
577
+ backpressure_queue_enabled: bool = Field(
578
+ default=False,
579
+ description="Enable backpressure queue for overload protection (future)",
580
+ )
581
+ backpressure_queue_max_size: int = Field(
582
+ default=100,
583
+ ge=10,
584
+ le=10000,
585
+ description="Maximum queue depth when backpressure is enabled",
586
+ )
587
+
483
588
  model_config = {
484
589
  "env_prefix": "SPATIAL_MEMORY_",
485
590
  "env_file": ".env",
@@ -1,5 +1,10 @@
1
1
  """Core components for Spatial Memory MCP Server."""
2
2
 
3
+ from spatial_memory.core.circuit_breaker import (
4
+ CircuitBreaker,
5
+ CircuitOpenError,
6
+ CircuitState,
7
+ )
3
8
  from spatial_memory.core.database import Database
4
9
  from spatial_memory.core.embeddings import EmbeddingService
5
10
  from spatial_memory.core.rate_limiter import RateLimiter
@@ -37,6 +42,15 @@ from spatial_memory.core.models import (
37
42
  VisualizationNode,
38
43
  )
39
44
  from spatial_memory.core.utils import to_aware_utc, to_naive_utc, utc_now, utc_now_naive
45
+ from spatial_memory.core.tracing import (
46
+ RequestContext,
47
+ TimingContext,
48
+ clear_context,
49
+ format_context_prefix,
50
+ get_current_context,
51
+ request_context,
52
+ set_context,
53
+ )
40
54
 
41
55
  __all__ = [
42
56
  # Errors - Base
@@ -80,4 +94,16 @@ __all__ = [
80
94
  "utc_now_naive",
81
95
  "to_naive_utc",
82
96
  "to_aware_utc",
97
+ # Tracing
98
+ "RequestContext",
99
+ "TimingContext",
100
+ "get_current_context",
101
+ "set_context",
102
+ "clear_context",
103
+ "request_context",
104
+ "format_context_prefix",
105
+ # Circuit Breaker
106
+ "CircuitBreaker",
107
+ "CircuitOpenError",
108
+ "CircuitState",
83
109
  ]