mcp-code-indexer 2.0.0__py3-none-any.whl → 2.0.2__py3-none-any.whl

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.
@@ -39,16 +39,26 @@ class DatabaseManager:
39
39
  and caching with proper transaction management and error handling.
40
40
  """
41
41
 
42
- def __init__(self, db_path: Path, pool_size: int = 3):
42
+ def __init__(self,
43
+ db_path: Path,
44
+ pool_size: int = 3,
45
+ retry_count: int = 5,
46
+ timeout: float = 10.0,
47
+ enable_wal_mode: bool = True,
48
+ health_check_interval: float = 30.0):
43
49
  """Initialize database manager with path to SQLite database."""
44
50
  self.db_path = db_path
45
51
  self.pool_size = pool_size
52
+ self.retry_count = retry_count
53
+ self.timeout = timeout
54
+ self.enable_wal_mode = enable_wal_mode
55
+ self.health_check_interval = health_check_interval
46
56
  self._connection_pool: List[aiosqlite.Connection] = []
47
57
  self._pool_lock = None # Will be initialized in async context
48
58
  self._write_lock = None # Write serialization lock, initialized in async context
49
59
 
50
- # Retry and recovery components
51
- self._retry_handler = create_retry_handler()
60
+ # Retry and recovery components - configure with provided settings
61
+ self._retry_handler = create_retry_handler(max_attempts=retry_count)
52
62
  self._recovery_manager = None # Initialized in async context
53
63
 
54
64
  # Health monitoring and metrics
@@ -66,8 +76,12 @@ class DatabaseManager:
66
76
  # Initialize connection recovery manager
67
77
  self._recovery_manager = ConnectionRecoveryManager(self)
68
78
 
69
- # Initialize health monitoring
70
- self._health_monitor = ConnectionHealthMonitor(self)
79
+ # Initialize health monitoring with configured interval
80
+ self._health_monitor = ConnectionHealthMonitor(
81
+ self,
82
+ check_interval=self.health_check_interval,
83
+ timeout_seconds=self.timeout
84
+ )
71
85
  await self._health_monitor.start_monitoring()
72
86
 
73
87
  # Ensure database directory exists
@@ -82,7 +96,7 @@ class DatabaseManager:
82
96
  db.row_factory = aiosqlite.Row
83
97
 
84
98
  # Configure WAL mode and optimizations for concurrent access
85
- await self._configure_database_optimizations(db)
99
+ await self._configure_database_optimizations(db, include_wal_mode=self.enable_wal_mode)
86
100
 
87
101
  # Apply each migration
88
102
  for migration_file in migration_files:
@@ -108,6 +122,7 @@ class DatabaseManager:
108
122
  # WAL mode is database-level, only set during initialization
109
123
  if include_wal_mode:
110
124
  optimizations.append("PRAGMA journal_mode = WAL")
125
+ logger.info("Enabling WAL mode for database concurrency")
111
126
 
112
127
  # Connection-level optimizations that can be set per connection
113
128
  optimizations.extend([
@@ -422,7 +437,7 @@ class DatabaseManager:
422
437
 
423
438
  async def create_project(self, project: Project) -> None:
424
439
  """Create a new project record."""
425
- async with self.get_write_connection() as db:
440
+ async with self.get_write_connection_with_retry("create_project") as db:
426
441
  await db.execute(
427
442
  """
428
443
  INSERT INTO projects (id, name, remote_origin, upstream_origin, aliases, created, last_accessed)
@@ -609,7 +624,7 @@ class DatabaseManager:
609
624
 
610
625
  async def update_project_access_time(self, project_id: str) -> None:
611
626
  """Update the last accessed time for a project."""
612
- async with self.get_write_connection() as db:
627
+ async with self.get_write_connection_with_retry("update_project_access_time") as db:
613
628
  await db.execute(
614
629
  "UPDATE projects SET last_accessed = ? WHERE id = ?",
615
630
  (datetime.utcnow(), project_id)
@@ -618,7 +633,7 @@ class DatabaseManager:
618
633
 
619
634
  async def update_project(self, project: Project) -> None:
620
635
  """Update an existing project record."""
621
- async with self.get_write_connection() as db:
636
+ async with self.get_write_connection_with_retry("update_project") as db:
622
637
  await db.execute(
623
638
  """
624
639
  UPDATE projects
@@ -680,7 +695,7 @@ class DatabaseManager:
680
695
 
681
696
  async def create_file_description(self, file_desc: FileDescription) -> None:
682
697
  """Create or update a file description."""
683
- async with self.get_write_connection() as db:
698
+ async with self.get_write_connection_with_retry("create_file_description") as db:
684
699
  await db.execute(
685
700
  """
686
701
  INSERT OR REPLACE INTO file_descriptions
@@ -83,7 +83,14 @@ class MCPCodeIndexServer:
83
83
  }
84
84
 
85
85
  # Initialize components
86
- self.db_manager = DatabaseManager(self.db_path, pool_size=db_pool_size)
86
+ self.db_manager = DatabaseManager(
87
+ db_path=self.db_path,
88
+ pool_size=db_pool_size,
89
+ retry_count=db_retry_count,
90
+ timeout=db_timeout,
91
+ enable_wal_mode=enable_wal_mode,
92
+ health_check_interval=health_check_interval
93
+ )
87
94
  self.token_counter = TokenCounter(token_limit)
88
95
  self.merge_handler = MergeHandler(self.db_manager)
89
96
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-code-indexer
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: MCP server that tracks file descriptions across codebases, enabling AI agents to efficiently navigate and understand code through searchable summaries and token-aware overviews.
5
5
  Author: MCP Code Indexer Contributors
6
6
  Maintainer: MCP Code Indexer Contributors
@@ -59,8 +59,8 @@ Dynamic: requires-python
59
59
 
60
60
  # MCP Code Indexer 🚀
61
61
 
62
- [![PyPI version](https://badge.fury.io/py/mcp-code-indexer.svg?11)](https://badge.fury.io/py/mcp-code-indexer)
63
- [![Python](https://img.shields.io/pypi/pyversions/mcp-code-indexer.svg?11)](https://pypi.org/project/mcp-code-indexer/)
62
+ [![PyPI version](https://badge.fury.io/py/mcp-code-indexer.svg?13)](https://badge.fury.io/py/mcp-code-indexer)
63
+ [![Python](https://img.shields.io/pypi/pyversions/mcp-code-indexer.svg?13)](https://pypi.org/project/mcp-code-indexer/)
64
64
  [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
65
65
 
66
66
  A production-ready **Model Context Protocol (MCP) server** that revolutionizes how AI agents navigate and understand codebases. Built for high-concurrency environments with advanced database resilience, the server provides instant access to intelligent descriptions, semantic search, and context-aware recommendations while maintaining 800+ writes/sec throughput.
@@ -10,18 +10,18 @@ mcp_code_indexer/token_counter.py,sha256=WrifOkbF99nWWHlRlhCHAB2KN7qr83GOHl7apE-
10
10
  mcp_code_indexer/data/stop_words_english.txt,sha256=7Zdd9ameVgA6tN_zuXROvHXD4hkWeELVywPhb7FJEkw,6343
11
11
  mcp_code_indexer/database/__init__.py,sha256=aPq_aaRp0aSwOBIq9GkuMNjmLxA411zg2vhdrAuHm-w,38
12
12
  mcp_code_indexer/database/connection_health.py,sha256=XJvUrHRhIroZlIPScVGdKb69lNP67lT9ZTTO67cFSEs,16721
13
- mcp_code_indexer/database/database.py,sha256=975bJCsj8G970UbRie3ge5ctFV5pmeOhqvNGt78Y5z8,48769
13
+ mcp_code_indexer/database/database.py,sha256=5G_1E-jSVMDJuyFCVki9tbNmoyNvHJa3x7dRIBB2UQE,49603
14
14
  mcp_code_indexer/database/models.py,sha256=_vCmJnPXZSiInRzyvs4c7QUWuNNW8qsOoDlGX8J-Gnk,7124
15
15
  mcp_code_indexer/database/retry_handler.py,sha256=zwwZ0V1PzzS1rtcfVQOI-CXqWnPGF-KGH4L_3d-_h1Y,11932
16
16
  mcp_code_indexer/middleware/__init__.py,sha256=p-mP0pMsfiU2yajCPvokCUxUEkh_lu4XJP1LyyMW2ug,220
17
17
  mcp_code_indexer/middleware/error_middleware.py,sha256=5agJTAkkPogfPGnja1V9JtG9RG-BiOALIJYctK3byJQ,11730
18
18
  mcp_code_indexer/server/__init__.py,sha256=16xMcuriUOBlawRqWNBk6niwrvtv_JD5xvI36X1Vsmk,41
19
- mcp_code_indexer/server/mcp_server.py,sha256=1GFvfORtUW3Am8me3joCg3Q61epipsB2I-1uv6WL15Q,66717
19
+ mcp_code_indexer/server/mcp_server.py,sha256=tQTZFnAnASStkbnQOsj2-3eH1DYSmY97q1pwo7geFXI,66934
20
20
  mcp_code_indexer/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4,sha256=Ijkht27pm96ZW3_3OFE-7xAPtR0YyTWXoRO8_-hlsqc,1681126
21
21
  mcp_code_indexer/tools/__init__.py,sha256=m01mxML2UdD7y5rih_XNhNSCMzQTz7WQ_T1TeOcYlnE,49
22
- mcp_code_indexer-2.0.0.dist-info/licenses/LICENSE,sha256=JN9dyPPgYwH9C-UjYM7FLNZjQ6BF7kAzpF3_4PwY4rY,1086
23
- mcp_code_indexer-2.0.0.dist-info/METADATA,sha256=vtQ3OS8AfTQuZmLqVFEyPzMtvvX9-V_KoyI4ygMvQ00,20165
24
- mcp_code_indexer-2.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
- mcp_code_indexer-2.0.0.dist-info/entry_points.txt,sha256=8HqWOw1Is7jOP1bvIgaSwouvT9z_Boe-9hd4NzyJOhY,68
26
- mcp_code_indexer-2.0.0.dist-info/top_level.txt,sha256=yKYCM-gMGt-cnupGfAhnZaoEsROLB6DQ1KFUuyKx4rw,17
27
- mcp_code_indexer-2.0.0.dist-info/RECORD,,
22
+ mcp_code_indexer-2.0.2.dist-info/licenses/LICENSE,sha256=JN9dyPPgYwH9C-UjYM7FLNZjQ6BF7kAzpF3_4PwY4rY,1086
23
+ mcp_code_indexer-2.0.2.dist-info/METADATA,sha256=BsEhIKscok46a5pfTyigsaMIHjMHZgmg-7-O_OyTrZY,20165
24
+ mcp_code_indexer-2.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ mcp_code_indexer-2.0.2.dist-info/entry_points.txt,sha256=8HqWOw1Is7jOP1bvIgaSwouvT9z_Boe-9hd4NzyJOhY,68
26
+ mcp_code_indexer-2.0.2.dist-info/top_level.txt,sha256=yKYCM-gMGt-cnupGfAhnZaoEsROLB6DQ1KFUuyKx4rw,17
27
+ mcp_code_indexer-2.0.2.dist-info/RECORD,,