mcp-code-indexer 3.5.0__py3-none-any.whl → 3.5.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.
- mcp_code_indexer/commands/makelocal.py +18 -7
- mcp_code_indexer/main.py +56 -0
- {mcp_code_indexer-3.5.0.dist-info → mcp_code_indexer-3.5.2.dist-info}/METADATA +3 -3
- {mcp_code_indexer-3.5.0.dist-info → mcp_code_indexer-3.5.2.dist-info}/RECORD +7 -7
- {mcp_code_indexer-3.5.0.dist-info → mcp_code_indexer-3.5.2.dist-info}/LICENSE +0 -0
- {mcp_code_indexer-3.5.0.dist-info → mcp_code_indexer-3.5.2.dist-info}/WHEEL +0 -0
- {mcp_code_indexer-3.5.0.dist-info → mcp_code_indexer-3.5.2.dist-info}/entry_points.txt +0 -0
@@ -52,10 +52,20 @@ class MakeLocalCommand:
|
|
52
52
|
if not folder_path_obj.is_dir():
|
53
53
|
raise ValueError(f"Path is not a directory: {folder_path}")
|
54
54
|
|
55
|
-
# Check if local database already exists
|
55
|
+
# Check if local database already exists and has data
|
56
56
|
local_db_path = folder_path_obj / ".code-index.db"
|
57
57
|
if local_db_path.exists() and local_db_path.stat().st_size > 0:
|
58
|
-
|
58
|
+
# Check if it actually has project data (not just schema)
|
59
|
+
from sqlite3 import connect
|
60
|
+
try:
|
61
|
+
with connect(local_db_path) as conn:
|
62
|
+
cursor = conn.execute("SELECT COUNT(*) FROM projects")
|
63
|
+
project_count = cursor.fetchone()[0]
|
64
|
+
if project_count > 0:
|
65
|
+
raise ValueError(f"Local database already contains {project_count} project(s): {local_db_path}")
|
66
|
+
except Exception:
|
67
|
+
# If we can't check, assume it has data to be safe
|
68
|
+
raise ValueError(f"Local database already exists: {local_db_path}")
|
59
69
|
|
60
70
|
# Get global database manager
|
61
71
|
global_db_manager = await self.db_factory.get_database_manager()
|
@@ -78,13 +88,14 @@ class MakeLocalCommand:
|
|
78
88
|
if project_overview:
|
79
89
|
logger.info("Found project overview to migrate")
|
80
90
|
|
81
|
-
# Create local database (
|
82
|
-
if local_db_path.exists():
|
83
|
-
local_db_path.unlink()
|
84
|
-
|
85
|
-
# Create local database manager
|
91
|
+
# Create local database manager (this will initialize schema if needed)
|
86
92
|
local_db_manager = await self.db_factory.get_database_manager(str(folder_path_obj))
|
87
93
|
|
94
|
+
# Check if project already exists in local database
|
95
|
+
existing_local_project = await local_db_manager.get_project(project.id)
|
96
|
+
if existing_local_project:
|
97
|
+
raise ValueError(f"Project '{project.name}' (ID: {project.id}) already exists in local database")
|
98
|
+
|
88
99
|
# Migrate data
|
89
100
|
await self._migrate_project_data(
|
90
101
|
local_db_manager, project, file_descriptions, project_overview
|
mcp_code_indexer/main.py
CHANGED
@@ -110,6 +110,12 @@ def parse_arguments() -> argparse.Namespace:
|
|
110
110
|
),
|
111
111
|
)
|
112
112
|
|
113
|
+
parser.add_argument(
|
114
|
+
"--makelocal",
|
115
|
+
type=str,
|
116
|
+
help="Create local database in specified folder and migrate project data from global DB",
|
117
|
+
)
|
118
|
+
|
113
119
|
return parser.parse_args()
|
114
120
|
|
115
121
|
|
@@ -837,6 +843,52 @@ def generate_project_markdown(project, overview, files, logger):
|
|
837
843
|
return "\n".join(markdown_lines)
|
838
844
|
|
839
845
|
|
846
|
+
async def handle_makelocal(args: argparse.Namespace) -> None:
|
847
|
+
"""Handle --makelocal command."""
|
848
|
+
try:
|
849
|
+
from .database.database_factory import DatabaseFactory
|
850
|
+
from .commands.makelocal import MakeLocalCommand
|
851
|
+
|
852
|
+
# Initialize database factory
|
853
|
+
db_path = Path(args.db_path).expanduser()
|
854
|
+
cache_dir = Path(args.cache_dir).expanduser()
|
855
|
+
|
856
|
+
# Create directories if they don't exist
|
857
|
+
db_path.parent.mkdir(parents=True, exist_ok=True)
|
858
|
+
cache_dir.mkdir(parents=True, exist_ok=True)
|
859
|
+
|
860
|
+
db_factory = DatabaseFactory(
|
861
|
+
global_db_path=db_path,
|
862
|
+
pool_size=3,
|
863
|
+
retry_count=5,
|
864
|
+
timeout=10.0,
|
865
|
+
enable_wal_mode=True,
|
866
|
+
health_check_interval=30.0,
|
867
|
+
retry_min_wait=0.1,
|
868
|
+
retry_max_wait=2.0,
|
869
|
+
retry_jitter=0.2,
|
870
|
+
)
|
871
|
+
|
872
|
+
# Initialize make local command
|
873
|
+
makelocal_cmd = MakeLocalCommand(db_factory)
|
874
|
+
|
875
|
+
# Execute the command
|
876
|
+
result = await makelocal_cmd.execute(args.makelocal)
|
877
|
+
|
878
|
+
print(f"Successfully migrated project '{result['project_name']}' to local database")
|
879
|
+
print(f"Local database created at: {result['local_database_path']}")
|
880
|
+
print(f"Migrated {result['migrated_files']} file descriptions")
|
881
|
+
if result['migrated_overview']:
|
882
|
+
print("Migrated project overview")
|
883
|
+
|
884
|
+
# Close all database connections
|
885
|
+
await db_factory.close_all()
|
886
|
+
|
887
|
+
except Exception as e:
|
888
|
+
print(f"Make local command error: {e}", file=sys.stderr)
|
889
|
+
sys.exit(1)
|
890
|
+
|
891
|
+
|
840
892
|
async def main() -> None:
|
841
893
|
"""Main entry point for the MCP server."""
|
842
894
|
args = parse_arguments()
|
@@ -867,6 +919,10 @@ async def main() -> None:
|
|
867
919
|
await handle_map(args)
|
868
920
|
return
|
869
921
|
|
922
|
+
if args.makelocal:
|
923
|
+
await handle_makelocal(args)
|
924
|
+
return
|
925
|
+
|
870
926
|
# Setup structured logging
|
871
927
|
log_file = (
|
872
928
|
Path(args.cache_dir).expanduser() / "server.log" if args.cache_dir else None
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: mcp-code-indexer
|
3
|
-
Version: 3.5.
|
3
|
+
Version: 3.5.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
|
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.
|
@@ -4,7 +4,7 @@ mcp_code_indexer/ask_handler.py,sha256=cy7gVFyXF0c10GZ3Aquktvgw1A8e4_NtBsbjlE1Bc
|
|
4
4
|
mcp_code_indexer/claude_api_handler.py,sha256=uZF6P64Cac9AHfO2Q3Whe4exhZyZmqZ1grWT1nHw-Wc,13616
|
5
5
|
mcp_code_indexer/cleanup_manager.py,sha256=qjIAMiJ-F1pfgCwVbNaNE0dfs8Wh9aaWh51DBMCWFuI,9491
|
6
6
|
mcp_code_indexer/commands/__init__.py,sha256=141U722dS_NnFTZyxTPipzhXKdU21kCv-mcrN4djyHo,45
|
7
|
-
mcp_code_indexer/commands/makelocal.py,sha256=
|
7
|
+
mcp_code_indexer/commands/makelocal.py,sha256=rqb0JQHh2-lei1hl7F4BnssgajcDsG5WvOXyq79YIpk,8325
|
8
8
|
mcp_code_indexer/data/stop_words_english.txt,sha256=7Zdd9ameVgA6tN_zuXROvHXD4hkWeELVywPhb7FJEkw,6343
|
9
9
|
mcp_code_indexer/database/__init__.py,sha256=aPq_aaRp0aSwOBIq9GkuMNjmLxA411zg2vhdrAuHm-w,38
|
10
10
|
mcp_code_indexer/database/connection_health.py,sha256=vu8c8lDLEwva7ldTdxvlACTKT59kO-KjZ9I3tMbwr3s,25240
|
@@ -19,7 +19,7 @@ mcp_code_indexer/error_handler.py,sha256=XBjjEriq1diPTGKpHcaBh9fj88_qhuNMwPeLiTW
|
|
19
19
|
mcp_code_indexer/file_scanner.py,sha256=smY1Yfxfyqb_J5RQz5ETaSgE2_syC2SUUwzJxby3Bg8,11432
|
20
20
|
mcp_code_indexer/git_hook_handler.py,sha256=mP8uvtQFo4C6dPNSBlG4NUXwVTXofDzDpjZVSk43yzw,45542
|
21
21
|
mcp_code_indexer/logging_config.py,sha256=hexJWw7-6QQkH_2BwtKGO1CDOtQnP8F3Yss_yHKnzE4,9816
|
22
|
-
mcp_code_indexer/main.py,sha256=
|
22
|
+
mcp_code_indexer/main.py,sha256=ayiXfkSIXpE6K04rVQdpJvIXPRlS9XRfaBzB1nuuDqA,32621
|
23
23
|
mcp_code_indexer/middleware/__init__.py,sha256=p-mP0pMsfiU2yajCPvokCUxUEkh_lu4XJP1LyyMW2ug,220
|
24
24
|
mcp_code_indexer/middleware/error_middleware.py,sha256=YHd7sm4PdNPIMKD8Nub_N7WaOH2JtiqkHBbTOGyxTno,11685
|
25
25
|
mcp_code_indexer/migrations/001_initial.sql,sha256=hIXkCP4LA_4A9HJ1CHU0a1DD-a6EN6u-uJPMqW0c2Yo,4120
|
@@ -33,8 +33,8 @@ mcp_code_indexer/server/mcp_server.py,sha256=o6G5vNxtyWwL_x4UXTB9XfG6acoba5P9hTJ
|
|
33
33
|
mcp_code_indexer/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4,sha256=Ijkht27pm96ZW3_3OFE-7xAPtR0YyTWXoRO8_-hlsqc,1681126
|
34
34
|
mcp_code_indexer/token_counter.py,sha256=e6WsyCEWMMSkMwLbcVtr5e8vEqh-kFqNmiJErCNdqHE,8220
|
35
35
|
mcp_code_indexer/tools/__init__.py,sha256=m01mxML2UdD7y5rih_XNhNSCMzQTz7WQ_T1TeOcYlnE,49
|
36
|
-
mcp_code_indexer-3.5.
|
37
|
-
mcp_code_indexer-3.5.
|
38
|
-
mcp_code_indexer-3.5.
|
39
|
-
mcp_code_indexer-3.5.
|
40
|
-
mcp_code_indexer-3.5.
|
36
|
+
mcp_code_indexer-3.5.2.dist-info/LICENSE,sha256=JN9dyPPgYwH9C-UjYM7FLNZjQ6BF7kAzpF3_4PwY4rY,1086
|
37
|
+
mcp_code_indexer-3.5.2.dist-info/METADATA,sha256=25-ZLpMXyX2ZkaS1132tpVbDVt4RYoYGhsCMJhR41xo,19359
|
38
|
+
mcp_code_indexer-3.5.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
39
|
+
mcp_code_indexer-3.5.2.dist-info/entry_points.txt,sha256=UABj7HZ0mC6rvF22gxaz2LLNLGQShTrFmp5u00iUtvo,67
|
40
|
+
mcp_code_indexer-3.5.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|