mcp-code-indexer 1.0.6__py3-none-any.whl → 1.0.8__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/database/database.py +21 -0
- mcp_code_indexer/server/mcp_server.py +27 -64
- {mcp_code_indexer-1.0.6.dist-info → mcp_code_indexer-1.0.8.dist-info}/METADATA +1 -1
- {mcp_code_indexer-1.0.6.dist-info → mcp_code_indexer-1.0.8.dist-info}/RECORD +8 -8
- {mcp_code_indexer-1.0.6.dist-info → mcp_code_indexer-1.0.8.dist-info}/WHEEL +0 -0
- {mcp_code_indexer-1.0.6.dist-info → mcp_code_indexer-1.0.8.dist-info}/entry_points.txt +0 -0
- {mcp_code_indexer-1.0.6.dist-info → mcp_code_indexer-1.0.8.dist-info}/licenses/LICENSE +0 -0
- {mcp_code_indexer-1.0.6.dist-info → mcp_code_indexer-1.0.8.dist-info}/top_level.txt +0 -0
@@ -189,6 +189,27 @@ class DatabaseManager:
|
|
189
189
|
)
|
190
190
|
await db.commit()
|
191
191
|
|
192
|
+
async def update_project(self, project: Project) -> None:
|
193
|
+
"""Update an existing project record."""
|
194
|
+
async with self.get_connection() as db:
|
195
|
+
await db.execute(
|
196
|
+
"""
|
197
|
+
UPDATE projects
|
198
|
+
SET name = ?, remote_origin = ?, upstream_origin = ?, aliases = ?, last_accessed = ?
|
199
|
+
WHERE id = ?
|
200
|
+
""",
|
201
|
+
(
|
202
|
+
project.name,
|
203
|
+
project.remote_origin,
|
204
|
+
project.upstream_origin,
|
205
|
+
json.dumps(project.aliases),
|
206
|
+
project.last_accessed,
|
207
|
+
project.id
|
208
|
+
)
|
209
|
+
)
|
210
|
+
await db.commit()
|
211
|
+
logger.debug(f"Updated project: {project.id}")
|
212
|
+
|
192
213
|
# File description operations
|
193
214
|
|
194
215
|
async def create_file_description(self, file_desc: FileDescription) -> None:
|
@@ -165,22 +165,7 @@ class MCPCodeIndexServer:
|
|
165
165
|
),
|
166
166
|
types.Tool(
|
167
167
|
name="find_missing_descriptions",
|
168
|
-
description="Scans the project folder to find files that don't have descriptions yet.
|
169
|
-
inputSchema={
|
170
|
-
"type": "object",
|
171
|
-
"properties": {
|
172
|
-
"projectName": {"type": "string", "description": "The name of the project"},
|
173
|
-
"folderPath": {"type": "string", "description": "Absolute path to the project folder on disk"},
|
174
|
-
"branch": {"type": "string", "description": "Git branch name"},
|
175
|
-
"remoteOrigin": {"type": ["string", "null"], "description": "Git remote origin URL if available"},
|
176
|
-
"upstreamOrigin": {"type": ["string", "null"], "description": "Upstream repository URL if this is a fork"}
|
177
|
-
},
|
178
|
-
"required": ["projectName", "folderPath", "branch"]
|
179
|
-
}
|
180
|
-
),
|
181
|
-
types.Tool(
|
182
|
-
name="update_missing_descriptions",
|
183
|
-
description="Batch updates descriptions for multiple files at once. This is stage 2 after find_missing_descriptions.",
|
168
|
+
description="Scans the project folder to find files that don't have descriptions yet. Use update_file_description to add descriptions for individual files.",
|
184
169
|
inputSchema={
|
185
170
|
"type": "object",
|
186
171
|
"properties": {
|
@@ -189,20 +174,9 @@ class MCPCodeIndexServer:
|
|
189
174
|
"branch": {"type": "string", "description": "Git branch name"},
|
190
175
|
"remoteOrigin": {"type": ["string", "null"], "description": "Git remote origin URL if available"},
|
191
176
|
"upstreamOrigin": {"type": ["string", "null"], "description": "Upstream repository URL if this is a fork"},
|
192
|
-
"
|
193
|
-
"type": "array",
|
194
|
-
"description": "Array of file paths and their descriptions",
|
195
|
-
"items": {
|
196
|
-
"type": "object",
|
197
|
-
"properties": {
|
198
|
-
"filePath": {"type": "string", "description": "Relative path to the file"},
|
199
|
-
"description": {"type": "string", "description": "Detailed description of the file"}
|
200
|
-
},
|
201
|
-
"required": ["filePath", "description"]
|
202
|
-
}
|
203
|
-
}
|
177
|
+
"limit": {"type": "integer", "description": "Maximum number of missing files to return (optional)"}
|
204
178
|
},
|
205
|
-
"required": ["projectName", "folderPath", "branch"
|
179
|
+
"required": ["projectName", "folderPath", "branch"]
|
206
180
|
}
|
207
181
|
),
|
208
182
|
types.Tool(
|
@@ -276,7 +250,6 @@ class MCPCodeIndexServer:
|
|
276
250
|
"update_file_description": self._handle_update_file_description,
|
277
251
|
"check_codebase_size": self._handle_check_codebase_size,
|
278
252
|
"find_missing_descriptions": self._handle_find_missing_descriptions,
|
279
|
-
"update_missing_descriptions": self._handle_update_missing_descriptions,
|
280
253
|
"search_descriptions": self._handle_search_descriptions,
|
281
254
|
"get_codebase_overview": self._handle_get_codebase_overview,
|
282
255
|
"merge_branch_descriptions": self._handle_merge_branch_descriptions,
|
@@ -310,10 +283,9 @@ class MCPCodeIndexServer:
|
|
310
283
|
folder_path = arguments["folderPath"]
|
311
284
|
branch = arguments.get("branch", "main")
|
312
285
|
|
313
|
-
# Create project ID from identifiers (
|
314
|
-
|
315
|
-
|
316
|
-
id_source = f"{project_name}:{remote_key}:{upstream_key}:{folder_path}"
|
286
|
+
# Create project ID from stable identifiers only (name + folder path)
|
287
|
+
# This ensures consistent project IDs regardless of whether remote_origin/upstream_origin are provided
|
288
|
+
id_source = f"{project_name}:{folder_path}"
|
317
289
|
project_id = hashlib.sha256(id_source.encode()).hexdigest()[:16]
|
318
290
|
|
319
291
|
# Check if project exists, create if not
|
@@ -342,6 +314,19 @@ class MCPCodeIndexServer:
|
|
342
314
|
# Update last accessed time
|
343
315
|
await self.db_manager.update_project_access_time(project_id)
|
344
316
|
|
317
|
+
# Update remote/upstream origins if provided and different from existing
|
318
|
+
should_update = False
|
319
|
+
if remote_origin and project.remote_origin != remote_origin:
|
320
|
+
project.remote_origin = remote_origin
|
321
|
+
should_update = True
|
322
|
+
if upstream_origin and project.upstream_origin != upstream_origin:
|
323
|
+
project.upstream_origin = upstream_origin
|
324
|
+
should_update = True
|
325
|
+
|
326
|
+
if should_update:
|
327
|
+
await self.db_manager.update_project(project)
|
328
|
+
logger.debug(f"Updated project metadata for {project_name}")
|
329
|
+
|
345
330
|
# Check if upstream inheritance is needed for existing project
|
346
331
|
if upstream_origin and await self.db_manager.check_upstream_inheritance_needed(project):
|
347
332
|
try:
|
@@ -445,45 +430,23 @@ class MCPCodeIndexServer:
|
|
445
430
|
missing_files = scanner.find_missing_files(existing_paths)
|
446
431
|
missing_paths = [scanner.get_relative_path(f) for f in missing_files]
|
447
432
|
|
433
|
+
# Apply limit if specified
|
434
|
+
limit = arguments.get("limit")
|
435
|
+
total_missing = len(missing_paths)
|
436
|
+
if limit is not None and isinstance(limit, int) and limit > 0:
|
437
|
+
missing_paths = missing_paths[:limit]
|
438
|
+
|
448
439
|
# Get project stats
|
449
440
|
stats = scanner.get_project_stats()
|
450
441
|
|
451
442
|
return {
|
452
443
|
"missingFiles": missing_paths,
|
453
|
-
"totalMissing":
|
444
|
+
"totalMissing": total_missing,
|
445
|
+
"returnedCount": len(missing_paths),
|
454
446
|
"existingDescriptions": len(existing_paths),
|
455
447
|
"projectStats": stats
|
456
448
|
}
|
457
449
|
|
458
|
-
async def _handle_update_missing_descriptions(self, arguments: Dict[str, Any]) -> Dict[str, Any]:
|
459
|
-
"""Handle update_missing_descriptions tool calls."""
|
460
|
-
project_id = await self._get_or_create_project_id(arguments)
|
461
|
-
descriptions_data = arguments["descriptions"]
|
462
|
-
|
463
|
-
# Create FileDescription objects
|
464
|
-
file_descriptions = []
|
465
|
-
for desc_data in descriptions_data:
|
466
|
-
file_desc = FileDescription(
|
467
|
-
project_id=project_id,
|
468
|
-
branch=arguments["branch"],
|
469
|
-
file_path=desc_data["filePath"],
|
470
|
-
description=desc_data["description"],
|
471
|
-
file_hash=None, # Hash not provided in batch operations
|
472
|
-
last_modified=datetime.utcnow(),
|
473
|
-
version=1
|
474
|
-
)
|
475
|
-
file_descriptions.append(file_desc)
|
476
|
-
|
477
|
-
# Batch create descriptions
|
478
|
-
await self.db_manager.batch_create_file_descriptions(file_descriptions)
|
479
|
-
|
480
|
-
return {
|
481
|
-
"success": True,
|
482
|
-
"updatedFiles": len(file_descriptions),
|
483
|
-
"files": [desc["filePath"] for desc in descriptions_data],
|
484
|
-
"message": f"Successfully updated descriptions for {len(file_descriptions)} files"
|
485
|
-
}
|
486
|
-
|
487
450
|
async def _handle_search_descriptions(self, arguments: Dict[str, Any]) -> Dict[str, Any]:
|
488
451
|
"""Handle search_descriptions tool calls."""
|
489
452
|
project_id = await self._get_or_create_project_id(arguments)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mcp-code-indexer
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.8
|
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
|
@@ -6,17 +6,17 @@ mcp_code_indexer/main.py,sha256=Rou-mAN9-12PPP8jC7dIs2_UNambJuC2F8BF--j-0m8,3715
|
|
6
6
|
mcp_code_indexer/merge_handler.py,sha256=lJR8eVq2qSrF6MW9mR3Fy8UzrNAaQ7RsI2FMNXne3vQ,14692
|
7
7
|
mcp_code_indexer/token_counter.py,sha256=WrifOkbF99nWWHlRlhCHAB2KN7qr83GOHl7apE-hJcE,8460
|
8
8
|
mcp_code_indexer/database/__init__.py,sha256=aPq_aaRp0aSwOBIq9GkuMNjmLxA411zg2vhdrAuHm-w,38
|
9
|
-
mcp_code_indexer/database/database.py,sha256=
|
9
|
+
mcp_code_indexer/database/database.py,sha256=ROGdosQSADI7EytNkdC4RauPD9zLtHTO1mQ8SxsmPVo,18755
|
10
10
|
mcp_code_indexer/database/models.py,sha256=3wOxHKb6j3zKPWFSwB5g1TLpI507vLNZcqsxZR4VuRs,5528
|
11
11
|
mcp_code_indexer/middleware/__init__.py,sha256=p-mP0pMsfiU2yajCPvokCUxUEkh_lu4XJP1LyyMW2ug,220
|
12
12
|
mcp_code_indexer/middleware/error_middleware.py,sha256=v6jaHmPxf3qerYdb85X1tHIXLxgcbybpitKVakFLQTA,10109
|
13
13
|
mcp_code_indexer/server/__init__.py,sha256=16xMcuriUOBlawRqWNBk6niwrvtv_JD5xvI36X1Vsmk,41
|
14
|
-
mcp_code_indexer/server/mcp_server.py,sha256=
|
14
|
+
mcp_code_indexer/server/mcp_server.py,sha256=DpAQ-A_creN5qGr584Xy4I0MvHHZ73r4_p9ly-iyhZ4,37888
|
15
15
|
mcp_code_indexer/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4,sha256=Ijkht27pm96ZW3_3OFE-7xAPtR0YyTWXoRO8_-hlsqc,1681126
|
16
16
|
mcp_code_indexer/tools/__init__.py,sha256=m01mxML2UdD7y5rih_XNhNSCMzQTz7WQ_T1TeOcYlnE,49
|
17
|
-
mcp_code_indexer-1.0.
|
18
|
-
mcp_code_indexer-1.0.
|
19
|
-
mcp_code_indexer-1.0.
|
20
|
-
mcp_code_indexer-1.0.
|
21
|
-
mcp_code_indexer-1.0.
|
22
|
-
mcp_code_indexer-1.0.
|
17
|
+
mcp_code_indexer-1.0.8.dist-info/licenses/LICENSE,sha256=JN9dyPPgYwH9C-UjYM7FLNZjQ6BF7kAzpF3_4PwY4rY,1086
|
18
|
+
mcp_code_indexer-1.0.8.dist-info/METADATA,sha256=EeCYxDxbAQxi_UgeiGuVzkpxx4j_6E7R_66EdHL6mF8,11930
|
19
|
+
mcp_code_indexer-1.0.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
20
|
+
mcp_code_indexer-1.0.8.dist-info/entry_points.txt,sha256=8HqWOw1Is7jOP1bvIgaSwouvT9z_Boe-9hd4NzyJOhY,68
|
21
|
+
mcp_code_indexer-1.0.8.dist-info/top_level.txt,sha256=yKYCM-gMGt-cnupGfAhnZaoEsROLB6DQ1KFUuyKx4rw,17
|
22
|
+
mcp_code_indexer-1.0.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|