mcp-code-indexer 1.6.4__py3-none-any.whl → 1.7.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/__init__.py +20 -4
- mcp_code_indexer/git_hook_handler.py +3 -2
- mcp_code_indexer/logging_config.py +53 -0
- mcp_code_indexer/main.py +1 -1
- {mcp_code_indexer-1.6.4.dist-info → mcp_code_indexer-1.7.0.dist-info}/METADATA +4 -3
- {mcp_code_indexer-1.6.4.dist-info → mcp_code_indexer-1.7.0.dist-info}/RECORD +10 -10
- {mcp_code_indexer-1.6.4.dist-info → mcp_code_indexer-1.7.0.dist-info}/WHEEL +0 -0
- {mcp_code_indexer-1.6.4.dist-info → mcp_code_indexer-1.7.0.dist-info}/entry_points.txt +0 -0
- {mcp_code_indexer-1.6.4.dist-info → mcp_code_indexer-1.7.0.dist-info}/licenses/LICENSE +0 -0
- {mcp_code_indexer-1.6.4.dist-info → mcp_code_indexer-1.7.0.dist-info}/top_level.txt +0 -0
mcp_code_indexer/__init__.py
CHANGED
@@ -7,7 +7,25 @@ token-aware overviews, and advanced merge capabilities.
|
|
7
7
|
"""
|
8
8
|
|
9
9
|
def _get_version() -> str:
|
10
|
-
"""
|
10
|
+
"""Get version from package metadata or pyproject.toml."""
|
11
|
+
# First try to get version from installed package metadata
|
12
|
+
try:
|
13
|
+
try:
|
14
|
+
from importlib.metadata import version
|
15
|
+
except ImportError:
|
16
|
+
# Python < 3.8 fallback
|
17
|
+
from importlib_metadata import version
|
18
|
+
|
19
|
+
# Try different package name variations
|
20
|
+
for pkg_name in ["mcp-code-indexer", "mcp_code_indexer"]:
|
21
|
+
try:
|
22
|
+
return version(pkg_name)
|
23
|
+
except Exception:
|
24
|
+
continue
|
25
|
+
except Exception:
|
26
|
+
pass
|
27
|
+
|
28
|
+
# Fallback to reading from pyproject.toml (for development)
|
11
29
|
try:
|
12
30
|
from pathlib import Path
|
13
31
|
import sys
|
@@ -18,15 +36,13 @@ def _get_version() -> str:
|
|
18
36
|
try:
|
19
37
|
import tomli as tomllib
|
20
38
|
except ImportError:
|
21
|
-
|
22
|
-
return "1.6.3"
|
39
|
+
return "dev"
|
23
40
|
|
24
41
|
pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml"
|
25
42
|
with open(pyproject_path, "rb") as f:
|
26
43
|
data = tomllib.load(f)
|
27
44
|
return data["project"]["version"]
|
28
45
|
except Exception:
|
29
|
-
# Return dev version if reading fails - indicates something is wrong
|
30
46
|
return "dev"
|
31
47
|
|
32
48
|
__version__ = _get_version()
|
@@ -49,17 +49,18 @@ class GitHookHandler:
|
|
49
49
|
OPENROUTER_API_URL = "https://openrouter.ai/api/v1/chat/completions"
|
50
50
|
OPENROUTER_MODEL = "anthropic/claude-sonnet-4"
|
51
51
|
|
52
|
-
def __init__(self, db_manager: DatabaseManager, cache_dir: Path):
|
52
|
+
def __init__(self, db_manager: DatabaseManager, cache_dir: Path, logger: Optional[logging.Logger] = None):
|
53
53
|
"""
|
54
54
|
Initialize GitHookHandler.
|
55
55
|
|
56
56
|
Args:
|
57
57
|
db_manager: Database manager instance
|
58
58
|
cache_dir: Cache directory for temporary files
|
59
|
+
logger: Logger instance to use (optional, creates default if not provided)
|
59
60
|
"""
|
60
61
|
self.db_manager = db_manager
|
61
62
|
self.cache_dir = cache_dir
|
62
|
-
self.logger = logging.getLogger(__name__)
|
63
|
+
self.logger = logger if logger is not None else logging.getLogger(__name__)
|
63
64
|
self.token_counter = TokenCounter()
|
64
65
|
|
65
66
|
# Git hook specific settings
|
@@ -163,6 +163,9 @@ def setup_command_logger(
|
|
163
163
|
|
164
164
|
logger.addHandler(file_handler)
|
165
165
|
|
166
|
+
# Set up component loggers to also log to this command's log file
|
167
|
+
_setup_component_loggers_for_command(command_name, file_handler, structured_formatter)
|
168
|
+
|
166
169
|
logger.info(f"=== {command_name.upper()} SESSION STARTED ===")
|
167
170
|
|
168
171
|
except (OSError, PermissionError) as e:
|
@@ -175,6 +178,56 @@ def setup_command_logger(
|
|
175
178
|
return logger
|
176
179
|
|
177
180
|
|
181
|
+
def _setup_component_loggers_for_command(
|
182
|
+
command_name: str,
|
183
|
+
file_handler: logging.Handler,
|
184
|
+
formatter: logging.Formatter
|
185
|
+
) -> None:
|
186
|
+
"""
|
187
|
+
Set up component loggers to also send logs to the command's log file.
|
188
|
+
|
189
|
+
Args:
|
190
|
+
command_name: Name of the command
|
191
|
+
file_handler: File handler to add to component loggers
|
192
|
+
formatter: Formatter to use for the handler
|
193
|
+
"""
|
194
|
+
# List of component logger names that should also log to command files
|
195
|
+
component_loggers = [
|
196
|
+
"mcp_code_indexer.database.database",
|
197
|
+
"mcp_code_indexer.server.mcp_server",
|
198
|
+
"mcp_code_indexer.token_counter",
|
199
|
+
"mcp_code_indexer.file_scanner",
|
200
|
+
"mcp_code_indexer.error_handler",
|
201
|
+
"mcp_code_indexer.merge_handler"
|
202
|
+
]
|
203
|
+
|
204
|
+
for component_logger_name in component_loggers:
|
205
|
+
component_logger = logging.getLogger(component_logger_name)
|
206
|
+
|
207
|
+
# Create a separate handler for this command to avoid interference
|
208
|
+
command_handler = logging.handlers.RotatingFileHandler(
|
209
|
+
file_handler.baseFilename,
|
210
|
+
maxBytes=file_handler.maxBytes,
|
211
|
+
backupCount=file_handler.backupCount,
|
212
|
+
encoding='utf-8'
|
213
|
+
)
|
214
|
+
command_handler.setLevel(logging.DEBUG)
|
215
|
+
command_handler.setFormatter(formatter)
|
216
|
+
|
217
|
+
# Add a marker to identify which command this handler belongs to
|
218
|
+
command_handler._command_name = command_name
|
219
|
+
|
220
|
+
# Remove any existing handlers for this command (in case of multiple calls)
|
221
|
+
existing_handlers = [h for h in component_logger.handlers if hasattr(h, '_command_name') and h._command_name == command_name]
|
222
|
+
for handler in existing_handlers:
|
223
|
+
component_logger.removeHandler(handler)
|
224
|
+
handler.close()
|
225
|
+
|
226
|
+
# Add the new handler
|
227
|
+
component_logger.addHandler(command_handler)
|
228
|
+
component_logger.setLevel(logging.DEBUG) # Ensure component loggers capture all levels
|
229
|
+
|
230
|
+
|
178
231
|
def log_performance_metrics(
|
179
232
|
logger: logging.Logger,
|
180
233
|
operation: str,
|
mcp_code_indexer/main.py
CHANGED
@@ -499,7 +499,7 @@ async def handle_githook(args: argparse.Namespace) -> None:
|
|
499
499
|
logger.debug("Database initialized successfully")
|
500
500
|
|
501
501
|
# Initialize git hook handler
|
502
|
-
git_handler = GitHookHandler(db_manager, cache_dir)
|
502
|
+
git_handler = GitHookHandler(db_manager, cache_dir, logger)
|
503
503
|
logger.debug("Git hook handler initialized")
|
504
504
|
|
505
505
|
# Run git hook analysis
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mcp-code-indexer
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.7.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
|
@@ -38,6 +38,7 @@ Requires-Dist: aiosqlite==0.19.0
|
|
38
38
|
Requires-Dist: aiohttp>=3.8.0
|
39
39
|
Requires-Dist: tenacity>=8.0.0
|
40
40
|
Requires-Dist: tomli>=1.2.0; python_version < "3.11"
|
41
|
+
Requires-Dist: importlib-metadata>=1.0.0; python_version < "3.8"
|
41
42
|
Provides-Extra: dev
|
42
43
|
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
43
44
|
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
@@ -58,8 +59,8 @@ Dynamic: requires-python
|
|
58
59
|
|
59
60
|
# MCP Code Indexer 🚀
|
60
61
|
|
61
|
-
[](https://badge.fury.io/py/mcp-code-indexer)
|
63
|
+
[](https://pypi.org/project/mcp-code-indexer/)
|
63
64
|
[](https://opensource.org/licenses/MIT)
|
64
65
|
|
65
66
|
A production-ready **Model Context Protocol (MCP) server** that revolutionizes how AI agents navigate and understand codebases. Instead of repeatedly scanning files, agents get instant access to intelligent descriptions, semantic search, and context-aware recommendations.
|
@@ -1,10 +1,10 @@
|
|
1
|
-
mcp_code_indexer/__init__.py,sha256=
|
1
|
+
mcp_code_indexer/__init__.py,sha256=GhY2NLQ6lH3n5mxqw0t8T1gmZGKhM6KvjhZH8xW5O-A,1686
|
2
2
|
mcp_code_indexer/__main__.py,sha256=4Edinoe0ug43hobuLYcjTmGp2YJnlFYN4_8iKvUBJ0Q,213
|
3
3
|
mcp_code_indexer/error_handler.py,sha256=cNSUFFrGBMLDv4qa78c7495L1wSl_dXCRbzCJOidx-Q,11590
|
4
4
|
mcp_code_indexer/file_scanner.py,sha256=ctXeZMROgDThEtjzsANTK9TbK-fhTScMBd4iyuleBT4,11734
|
5
|
-
mcp_code_indexer/git_hook_handler.py,sha256=
|
6
|
-
mcp_code_indexer/logging_config.py,sha256=
|
7
|
-
mcp_code_indexer/main.py,sha256=
|
5
|
+
mcp_code_indexer/git_hook_handler.py,sha256=LJde4V87QFs_DLGEQY_wqeeFsXuMETUPy7LkTgkxEUs,28894
|
6
|
+
mcp_code_indexer/logging_config.py,sha256=_bd9XGCLQ2VHPViJitaxGyREyfOXDPiklRh17jXeV0U,9523
|
7
|
+
mcp_code_indexer/main.py,sha256=U-f3AJYdycWhjh-vLryj7aH8DGCs4d3x1yjA852HTxM,31546
|
8
8
|
mcp_code_indexer/merge_handler.py,sha256=lJR8eVq2qSrF6MW9mR3Fy8UzrNAaQ7RsI2FMNXne3vQ,14692
|
9
9
|
mcp_code_indexer/token_counter.py,sha256=WrifOkbF99nWWHlRlhCHAB2KN7qr83GOHl7apE-hJcE,8460
|
10
10
|
mcp_code_indexer/data/stop_words_english.txt,sha256=7Zdd9ameVgA6tN_zuXROvHXD4hkWeELVywPhb7FJEkw,6343
|
@@ -17,9 +17,9 @@ mcp_code_indexer/server/__init__.py,sha256=16xMcuriUOBlawRqWNBk6niwrvtv_JD5xvI36
|
|
17
17
|
mcp_code_indexer/server/mcp_server.py,sha256=4goDZmRmhPgipImgfhTVa6nYJM7L1p56h34ITO6JhSw,64431
|
18
18
|
mcp_code_indexer/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4,sha256=Ijkht27pm96ZW3_3OFE-7xAPtR0YyTWXoRO8_-hlsqc,1681126
|
19
19
|
mcp_code_indexer/tools/__init__.py,sha256=m01mxML2UdD7y5rih_XNhNSCMzQTz7WQ_T1TeOcYlnE,49
|
20
|
-
mcp_code_indexer-1.
|
21
|
-
mcp_code_indexer-1.
|
22
|
-
mcp_code_indexer-1.
|
23
|
-
mcp_code_indexer-1.
|
24
|
-
mcp_code_indexer-1.
|
25
|
-
mcp_code_indexer-1.
|
20
|
+
mcp_code_indexer-1.7.0.dist-info/licenses/LICENSE,sha256=JN9dyPPgYwH9C-UjYM7FLNZjQ6BF7kAzpF3_4PwY4rY,1086
|
21
|
+
mcp_code_indexer-1.7.0.dist-info/METADATA,sha256=gGM-wW6Ezo3ww-bYL0n020yneNRxqbdzuHY2mzSFAak,17571
|
22
|
+
mcp_code_indexer-1.7.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
23
|
+
mcp_code_indexer-1.7.0.dist-info/entry_points.txt,sha256=8HqWOw1Is7jOP1bvIgaSwouvT9z_Boe-9hd4NzyJOhY,68
|
24
|
+
mcp_code_indexer-1.7.0.dist-info/top_level.txt,sha256=yKYCM-gMGt-cnupGfAhnZaoEsROLB6DQ1KFUuyKx4rw,17
|
25
|
+
mcp_code_indexer-1.7.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|