mcp-code-indexer 2.3.0__py3-none-any.whl → 2.4.0__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/main.py CHANGED
@@ -294,6 +294,7 @@ async def handle_runcommand(args: argparse.Namespace) -> None:
294
294
  "update_codebase_overview": server._handle_update_codebase_overview,
295
295
  "get_word_frequency": server._handle_get_word_frequency,
296
296
  "merge_branch_descriptions": server._handle_merge_branch_descriptions,
297
+ "search_codebase_overview": server._handle_search_codebase_overview,
297
298
  }
298
299
 
299
300
  if tool_name not in tool_handlers:
@@ -478,6 +478,23 @@ src/
478
478
  "properties": {},
479
479
  "additionalProperties": False
480
480
  }
481
+ ),
482
+ types.Tool(
483
+ name="search_codebase_overview",
484
+ description="Search for a single word in the codebase overview and return 2 sentences before and after where the word is found. Useful for quickly finding specific information in large overviews.",
485
+ inputSchema={
486
+ "type": "object",
487
+ "properties": {
488
+ "projectName": {"type": "string", "description": "The name of the project"},
489
+ "folderPath": {"type": "string", "description": "Absolute path to the project folder on disk"},
490
+ "branch": {"type": "string", "description": "Git branch name"},
491
+ "remoteOrigin": {"type": "string", "description": "Git remote origin URL if available"},
492
+ "upstreamOrigin": {"type": "string", "description": "Upstream repository URL if this is a fork"},
493
+ "searchWord": {"type": "string", "description": "Single word to search for in the overview"}
494
+ },
495
+ "required": ["projectName", "folderPath", "branch", "searchWord"],
496
+ "additionalProperties": False
497
+ }
481
498
  )
482
499
  ]
483
500
 
@@ -503,6 +520,7 @@ src/
503
520
  "get_word_frequency": self._handle_get_word_frequency,
504
521
  "merge_branch_descriptions": self._handle_merge_branch_descriptions,
505
522
  "check_database_health": self._handle_check_database_health,
523
+ "search_codebase_overview": self._handle_search_codebase_overview,
506
524
  }
507
525
 
508
526
  if name not in tool_handlers:
@@ -889,18 +907,28 @@ src/
889
907
  # Use provided token limit or fall back to server default
890
908
  token_limit = arguments.get("tokenLimit", self.token_limit)
891
909
 
892
- # Calculate total tokens
910
+ # Calculate total tokens for descriptions
893
911
  logger.info("Calculating total token count...")
894
- total_tokens = self.token_counter.calculate_codebase_tokens(file_descriptions)
912
+ descriptions_tokens = self.token_counter.calculate_codebase_tokens(file_descriptions)
913
+
914
+ # Get overview tokens if available
915
+ overview = await self.db_manager.get_project_overview(project_id, resolved_branch)
916
+ overview_tokens = 0
917
+ if overview and overview.overview:
918
+ overview_tokens = self.token_counter.count_tokens(overview.overview)
919
+
920
+ total_tokens = descriptions_tokens + overview_tokens
895
921
  is_large = total_tokens > token_limit
896
922
  recommendation = "use_search" if is_large else "use_overview"
897
923
 
898
- logger.info(f"Codebase analysis complete: {total_tokens} tokens, {len(file_descriptions)} files")
924
+ logger.info(f"Codebase analysis complete: {total_tokens} tokens total ({descriptions_tokens} descriptions + {overview_tokens} overview), {len(file_descriptions)} files")
899
925
  logger.info(f"Size assessment: {'LARGE' if is_large else 'SMALL'} (limit: {token_limit})")
900
926
  logger.info(f"Recommendation: {recommendation}")
901
927
 
902
928
  return {
903
929
  "totalTokens": total_tokens,
930
+ "descriptionsTokens": descriptions_tokens,
931
+ "overviewTokens": overview_tokens,
904
932
  "isLarge": is_large,
905
933
  "recommendation": recommendation,
906
934
  "tokenLimit": token_limit,
@@ -1205,6 +1233,54 @@ src/
1205
1233
  "totalUniqueTerms": result.total_unique_terms
1206
1234
  }
1207
1235
 
1236
+ async def _handle_search_codebase_overview(self, arguments: Dict[str, Any]) -> Dict[str, Any]:
1237
+ """Handle search_codebase_overview tool calls."""
1238
+ project_id = await self._get_or_create_project_id(arguments)
1239
+ resolved_branch = await self._resolve_branch(project_id, arguments["branch"])
1240
+ search_word = arguments["searchWord"].lower()
1241
+
1242
+ # Get the overview
1243
+ overview = await self.db_manager.get_project_overview(project_id, resolved_branch)
1244
+
1245
+ if not overview or not overview.overview:
1246
+ return {
1247
+ "found": False,
1248
+ "message": "No overview found for this project",
1249
+ "searchWord": arguments["searchWord"]
1250
+ }
1251
+
1252
+ # Split overview into sentences
1253
+ import re
1254
+ sentences = re.split(r'[.!?]+', overview.overview)
1255
+ sentences = [s.strip() for s in sentences if s.strip()]
1256
+
1257
+ # Find matches
1258
+ matches = []
1259
+ for i, sentence in enumerate(sentences):
1260
+ if search_word in sentence.lower():
1261
+ # Get context: 2 sentences before and after
1262
+ start_idx = max(0, i - 2)
1263
+ end_idx = min(len(sentences), i + 3)
1264
+
1265
+ context_sentences = sentences[start_idx:end_idx]
1266
+ context = '. '.join(context_sentences) + '.'
1267
+
1268
+ matches.append({
1269
+ "matchIndex": i,
1270
+ "matchSentence": sentence,
1271
+ "context": context,
1272
+ "contextStartIndex": start_idx,
1273
+ "contextEndIndex": end_idx - 1
1274
+ })
1275
+
1276
+ return {
1277
+ "found": len(matches) > 0,
1278
+ "searchWord": arguments["searchWord"],
1279
+ "matches": matches,
1280
+ "totalMatches": len(matches),
1281
+ "totalSentences": len(sentences)
1282
+ }
1283
+
1208
1284
  async def _handle_check_database_health(self, arguments: Dict[str, Any]) -> Dict[str, Any]:
1209
1285
  """
1210
1286
  Handle check_database_health tool calls with comprehensive diagnostics.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-code-indexer
3
- Version: 2.3.0
3
+ Version: 2.4.0
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?17)](https://badge.fury.io/py/mcp-code-indexer)
63
- [![Python](https://img.shields.io/pypi/pyversions/mcp-code-indexer.svg?17)](https://pypi.org/project/mcp-code-indexer/)
62
+ [![PyPI version](https://badge.fury.io/py/mcp-code-indexer.svg?18)](https://badge.fury.io/py/mcp-code-indexer)
63
+ [![Python](https://img.shields.io/pypi/pyversions/mcp-code-indexer.svg?18)](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.
@@ -7,7 +7,7 @@ mcp_code_indexer/error_handler.py,sha256=cNSUFFrGBMLDv4qa78c7495L1wSl_dXCRbzCJOi
7
7
  mcp_code_indexer/file_scanner.py,sha256=ctXeZMROgDThEtjzsANTK9TbK-fhTScMBd4iyuleBT4,11734
8
8
  mcp_code_indexer/git_hook_handler.py,sha256=k6QpoLI-5D9EvrLQrHWMII2qNu21daRX_jXlk9U6bGI,36976
9
9
  mcp_code_indexer/logging_config.py,sha256=tf_U-Zz_axDXRV9s7TfHEeUrBjT1QBWkzPuiyZMffBU,10252
10
- mcp_code_indexer/main.py,sha256=U-f3AJYdycWhjh-vLryj7aH8DGCs4d3x1yjA852HTxM,31546
10
+ mcp_code_indexer/main.py,sha256=abCHbNFUYjkJcNYsU0EPdZQI-_Gz9cQCH7dYJ5Jp7I8,31627
11
11
  mcp_code_indexer/merge_handler.py,sha256=lJR8eVq2qSrF6MW9mR3Fy8UzrNAaQ7RsI2FMNXne3vQ,14692
12
12
  mcp_code_indexer/query_preprocessor.py,sha256=uHYy8FO4FTs7MFKsXoueYIafWDKOIirRgdUzwh8upb4,5773
13
13
  mcp_code_indexer/token_counter.py,sha256=WrifOkbF99nWWHlRlhCHAB2KN7qr83GOHl7apE-hJcE,8460
@@ -21,12 +21,12 @@ mcp_code_indexer/database/retry_executor.py,sha256=QUayjkCk8OsckVMYiJ_HBQ9NTUss-
21
21
  mcp_code_indexer/middleware/__init__.py,sha256=p-mP0pMsfiU2yajCPvokCUxUEkh_lu4XJP1LyyMW2ug,220
22
22
  mcp_code_indexer/middleware/error_middleware.py,sha256=5agJTAkkPogfPGnja1V9JtG9RG-BiOALIJYctK3byJQ,11730
23
23
  mcp_code_indexer/server/__init__.py,sha256=16xMcuriUOBlawRqWNBk6niwrvtv_JD5xvI36X1Vsmk,41
24
- mcp_code_indexer/server/mcp_server.py,sha256=Bu0H8HNqZ6S8_BUZndQLIQpq4cDys3Ry9eEKBuIJItQ,70505
24
+ mcp_code_indexer/server/mcp_server.py,sha256=BqRPF2pBQhNbPN-LrNq1IMYJzqDKD-A6BSHwQ_5dgK8,74382
25
25
  mcp_code_indexer/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4,sha256=Ijkht27pm96ZW3_3OFE-7xAPtR0YyTWXoRO8_-hlsqc,1681126
26
26
  mcp_code_indexer/tools/__init__.py,sha256=m01mxML2UdD7y5rih_XNhNSCMzQTz7WQ_T1TeOcYlnE,49
27
- mcp_code_indexer-2.3.0.dist-info/licenses/LICENSE,sha256=JN9dyPPgYwH9C-UjYM7FLNZjQ6BF7kAzpF3_4PwY4rY,1086
28
- mcp_code_indexer-2.3.0.dist-info/METADATA,sha256=lvPoSUWnbJ20uv59kQYBjiCpj9Ea6l439haNAK4WDQU,20165
29
- mcp_code_indexer-2.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
- mcp_code_indexer-2.3.0.dist-info/entry_points.txt,sha256=8HqWOw1Is7jOP1bvIgaSwouvT9z_Boe-9hd4NzyJOhY,68
31
- mcp_code_indexer-2.3.0.dist-info/top_level.txt,sha256=yKYCM-gMGt-cnupGfAhnZaoEsROLB6DQ1KFUuyKx4rw,17
32
- mcp_code_indexer-2.3.0.dist-info/RECORD,,
27
+ mcp_code_indexer-2.4.0.dist-info/licenses/LICENSE,sha256=JN9dyPPgYwH9C-UjYM7FLNZjQ6BF7kAzpF3_4PwY4rY,1086
28
+ mcp_code_indexer-2.4.0.dist-info/METADATA,sha256=6fbCl9tjJUT0x7EF77w-znQumIQw2fVkRes3FcN1Av4,20165
29
+ mcp_code_indexer-2.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
+ mcp_code_indexer-2.4.0.dist-info/entry_points.txt,sha256=8HqWOw1Is7jOP1bvIgaSwouvT9z_Boe-9hd4NzyJOhY,68
31
+ mcp_code_indexer-2.4.0.dist-info/top_level.txt,sha256=yKYCM-gMGt-cnupGfAhnZaoEsROLB6DQ1KFUuyKx4rw,17
32
+ mcp_code_indexer-2.4.0.dist-info/RECORD,,