mcp-code-indexer 3.2.0__py3-none-any.whl → 3.2.1__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.
- mcp_code_indexer/server/mcp_server.py +51 -20
- {mcp_code_indexer-3.2.0.dist-info → mcp_code_indexer-3.2.1.dist-info}/METADATA +3 -3
- {mcp_code_indexer-3.2.0.dist-info → mcp_code_indexer-3.2.1.dist-info}/RECORD +6 -6
- {mcp_code_indexer-3.2.0.dist-info → mcp_code_indexer-3.2.1.dist-info}/LICENSE +0 -0
- {mcp_code_indexer-3.2.0.dist-info → mcp_code_indexer-3.2.1.dist-info}/WHEEL +0 -0
- {mcp_code_indexer-3.2.0.dist-info → mcp_code_indexer-3.2.1.dist-info}/entry_points.txt +0 -0
@@ -10,6 +10,7 @@ import html
|
|
10
10
|
import json
|
11
11
|
import logging
|
12
12
|
import re
|
13
|
+
import time
|
13
14
|
import uuid
|
14
15
|
from datetime import datetime
|
15
16
|
from pathlib import Path
|
@@ -958,7 +959,9 @@ class MCPCodeIndexServer:
|
|
958
959
|
logger.info(f"Resolved project_id: {project_id}")
|
959
960
|
|
960
961
|
# Run cleanup if needed (respects 30-minute cooldown)
|
961
|
-
await self._run_cleanup_if_needed(
|
962
|
+
cleaned_up_count = await self._run_cleanup_if_needed(
|
963
|
+
project_id=project_id, project_root=folder_path
|
964
|
+
)
|
962
965
|
|
963
966
|
# Get file descriptions for this project (after cleanup)
|
964
967
|
logger.info("Retrieving file descriptions...")
|
@@ -1005,8 +1008,7 @@ class MCPCodeIndexServer:
|
|
1005
1008
|
"recommendation": recommendation,
|
1006
1009
|
"tokenLimit": token_limit,
|
1007
1010
|
"totalFiles": len(file_descriptions),
|
1008
|
-
"
|
1009
|
-
"cleanedUpCount": len(cleaned_up_files),
|
1011
|
+
"cleanedUpCount": cleaned_up_count,
|
1010
1012
|
}
|
1011
1013
|
|
1012
1014
|
async def _handle_find_missing_descriptions(
|
@@ -1490,20 +1492,20 @@ class MCPCodeIndexServer:
|
|
1490
1492
|
logger.error(f"Error in periodic cleanup: {e}")
|
1491
1493
|
# Continue running despite errors
|
1492
1494
|
|
1493
|
-
async def _run_cleanup_if_needed(self) ->
|
1495
|
+
async def _run_cleanup_if_needed(self, project_id: str = None, project_root: Path = None) -> int:
|
1494
1496
|
"""Run cleanup if conditions are met (not running, not run recently)."""
|
1495
1497
|
current_time = time.time()
|
1496
1498
|
|
1497
1499
|
# Check if cleanup is already running
|
1498
1500
|
if self._cleanup_running:
|
1499
1501
|
logger.debug("Cleanup already running, skipping")
|
1500
|
-
return
|
1502
|
+
return 0
|
1501
1503
|
|
1502
1504
|
# Check if cleanup was run in the last 30 minutes
|
1503
1505
|
if (self._last_cleanup_time and
|
1504
1506
|
current_time - self._last_cleanup_time < 30 * 60):
|
1505
1507
|
logger.debug("Cleanup ran recently, skipping")
|
1506
|
-
return
|
1508
|
+
return 0
|
1507
1509
|
|
1508
1510
|
# Set running flag and update time
|
1509
1511
|
self._cleanup_running = True
|
@@ -1511,37 +1513,66 @@ class MCPCodeIndexServer:
|
|
1511
1513
|
|
1512
1514
|
try:
|
1513
1515
|
logger.info("Starting cleanup")
|
1514
|
-
|
1515
|
-
# Get all projects and run cleanup on each
|
1516
|
-
projects = await self.db_manager.get_all_projects()
|
1517
1516
|
total_cleaned = 0
|
1518
1517
|
|
1519
|
-
|
1518
|
+
if project_id and project_root:
|
1519
|
+
# Single project cleanup
|
1520
1520
|
try:
|
1521
|
-
# Cleanup missing files
|
1522
1521
|
missing_files = await self.db_manager.cleanup_missing_files(
|
1523
|
-
project_id=
|
1524
|
-
project_root=Path(project.folder_path)
|
1522
|
+
project_id=project_id, project_root=project_root
|
1525
1523
|
)
|
1526
|
-
total_cleaned
|
1524
|
+
total_cleaned = len(missing_files)
|
1527
1525
|
|
1528
1526
|
# Perform permanent cleanup (retention policy)
|
1529
1527
|
deleted_count = await self.cleanup_manager.perform_cleanup(
|
1530
|
-
project_id=
|
1528
|
+
project_id=project_id
|
1531
1529
|
)
|
1532
1530
|
|
1533
1531
|
if missing_files or deleted_count:
|
1534
1532
|
logger.info(
|
1535
|
-
f"Cleanup
|
1536
|
-
f"{len(missing_files)} marked, "
|
1533
|
+
f"Cleanup: {len(missing_files)} marked, "
|
1537
1534
|
f"{deleted_count} permanently deleted"
|
1538
1535
|
)
|
1539
1536
|
except Exception as e:
|
1540
|
-
logger.error(
|
1541
|
-
|
1542
|
-
|
1537
|
+
logger.error(f"Error during cleanup: {e}")
|
1538
|
+
else:
|
1539
|
+
# All projects cleanup (for periodic task)
|
1540
|
+
projects = await self.db_manager.get_all_projects()
|
1541
|
+
|
1542
|
+
for project in projects:
|
1543
|
+
try:
|
1544
|
+
# Skip projects without folder paths in aliases
|
1545
|
+
if not project.aliases:
|
1546
|
+
continue
|
1547
|
+
|
1548
|
+
# Use first alias as folder path
|
1549
|
+
folder_path = Path(project.aliases[0])
|
1550
|
+
if not folder_path.exists():
|
1551
|
+
continue
|
1552
|
+
|
1553
|
+
missing_files = await self.db_manager.cleanup_missing_files(
|
1554
|
+
project_id=project.id, project_root=folder_path
|
1555
|
+
)
|
1556
|
+
total_cleaned += len(missing_files)
|
1557
|
+
|
1558
|
+
# Perform permanent cleanup (retention policy)
|
1559
|
+
deleted_count = await self.cleanup_manager.perform_cleanup(
|
1560
|
+
project_id=project.id
|
1561
|
+
)
|
1562
|
+
|
1563
|
+
if missing_files or deleted_count:
|
1564
|
+
logger.info(
|
1565
|
+
f"Cleanup for {project.name}: "
|
1566
|
+
f"{len(missing_files)} marked, "
|
1567
|
+
f"{deleted_count} permanently deleted"
|
1568
|
+
)
|
1569
|
+
except Exception as e:
|
1570
|
+
logger.error(
|
1571
|
+
f"Error during cleanup for project {project.name}: {e}"
|
1572
|
+
)
|
1543
1573
|
|
1544
1574
|
logger.info(f"Cleanup completed: {total_cleaned} files processed")
|
1575
|
+
return total_cleaned
|
1545
1576
|
|
1546
1577
|
finally:
|
1547
1578
|
self._cleanup_running = False
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: mcp-code-indexer
|
3
|
-
Version: 3.2.
|
3
|
+
Version: 3.2.1
|
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
|
License: MIT
|
6
6
|
Keywords: mcp,model-context-protocol,code-indexer,ai-tools,codebase-navigation,file-descriptions,llm-tools
|
@@ -40,8 +40,8 @@ Description-Content-Type: text/markdown
|
|
40
40
|
|
41
41
|
# MCP Code Indexer 🚀
|
42
42
|
|
43
|
-
[](https://badge.fury.io/py/mcp-code-indexer)
|
44
|
+
[](https://pypi.org/project/mcp-code-indexer/)
|
45
45
|
[](https://opensource.org/licenses/MIT)
|
46
46
|
|
47
47
|
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.
|
@@ -25,12 +25,12 @@ mcp_code_indexer/migrations/004_remove_branch_dependency.sql,sha256=whZvj2qfba1-
|
|
25
25
|
mcp_code_indexer/migrations/005_remove_git_remotes.sql,sha256=vT84AaV1hyN4zq5W67hR14TgAwhW7_RNtBHrCoksxA4,1299
|
26
26
|
mcp_code_indexer/query_preprocessor.py,sha256=PLFR1T9mSn2Mkxw6-GB4GkxyfzjJ2ia3dgLPcziHfVA,5483
|
27
27
|
mcp_code_indexer/server/__init__.py,sha256=16xMcuriUOBlawRqWNBk6niwrvtv_JD5xvI36X1Vsmk,41
|
28
|
-
mcp_code_indexer/server/mcp_server.py,sha256=
|
28
|
+
mcp_code_indexer/server/mcp_server.py,sha256=9AhgTF_pA5nJQXhGudbO_WYJZzc68TYvTm4RSlywbzg,70969
|
29
29
|
mcp_code_indexer/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4,sha256=Ijkht27pm96ZW3_3OFE-7xAPtR0YyTWXoRO8_-hlsqc,1681126
|
30
30
|
mcp_code_indexer/token_counter.py,sha256=e6WsyCEWMMSkMwLbcVtr5e8vEqh-kFqNmiJErCNdqHE,8220
|
31
31
|
mcp_code_indexer/tools/__init__.py,sha256=m01mxML2UdD7y5rih_XNhNSCMzQTz7WQ_T1TeOcYlnE,49
|
32
|
-
mcp_code_indexer-3.2.
|
33
|
-
mcp_code_indexer-3.2.
|
34
|
-
mcp_code_indexer-3.2.
|
35
|
-
mcp_code_indexer-3.2.
|
36
|
-
mcp_code_indexer-3.2.
|
32
|
+
mcp_code_indexer-3.2.1.dist-info/LICENSE,sha256=JN9dyPPgYwH9C-UjYM7FLNZjQ6BF7kAzpF3_4PwY4rY,1086
|
33
|
+
mcp_code_indexer-3.2.1.dist-info/METADATA,sha256=FuSsfCoT6LhhttJ_H9p7ILcXNWOysCLH0QILY8xmWog,19191
|
34
|
+
mcp_code_indexer-3.2.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
35
|
+
mcp_code_indexer-3.2.1.dist-info/entry_points.txt,sha256=UABj7HZ0mC6rvF22gxaz2LLNLGQShTrFmp5u00iUtvo,67
|
36
|
+
mcp_code_indexer-3.2.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|