mcp-code-indexer 1.6.0__py3-none-any.whl → 1.6.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/git_hook_handler.py +13 -3
- {mcp_code_indexer-1.6.0.dist-info → mcp_code_indexer-1.6.2.dist-info}/METADATA +3 -3
- {mcp_code_indexer-1.6.0.dist-info → mcp_code_indexer-1.6.2.dist-info}/RECORD +7 -7
- {mcp_code_indexer-1.6.0.dist-info → mcp_code_indexer-1.6.2.dist-info}/WHEEL +0 -0
- {mcp_code_indexer-1.6.0.dist-info → mcp_code_indexer-1.6.2.dist-info}/entry_points.txt +0 -0
- {mcp_code_indexer-1.6.0.dist-info → mcp_code_indexer-1.6.2.dist-info}/licenses/LICENSE +0 -0
- {mcp_code_indexer-1.6.0.dist-info → mcp_code_indexer-1.6.2.dist-info}/top_level.txt +0 -0
@@ -22,6 +22,7 @@ from tenacity import retry, wait_exponential, stop_after_attempt, retry_if_excep
|
|
22
22
|
from .database.database import DatabaseManager
|
23
23
|
from .database.models import Project, FileDescription
|
24
24
|
from .error_handler import ValidationError
|
25
|
+
from .token_counter import TokenCounter
|
25
26
|
|
26
27
|
|
27
28
|
class GitHookError(Exception):
|
@@ -59,11 +60,12 @@ class GitHookHandler:
|
|
59
60
|
self.db_manager = db_manager
|
60
61
|
self.cache_dir = cache_dir
|
61
62
|
self.logger = logging.getLogger(__name__)
|
63
|
+
self.token_counter = TokenCounter()
|
62
64
|
|
63
65
|
# Git hook specific settings
|
64
66
|
self.config = {
|
65
67
|
"model": os.getenv("MCP_GITHOOK_MODEL", self.OPENROUTER_MODEL),
|
66
|
-
"
|
68
|
+
"max_diff_tokens": 136000, # Skip if diff larger than this (in tokens)
|
67
69
|
"timeout": 30,
|
68
70
|
"temperature": 0.3, # Lower temperature for consistent updates
|
69
71
|
}
|
@@ -102,8 +104,8 @@ class GitHookHandler:
|
|
102
104
|
git_diff = await self._get_git_diff()
|
103
105
|
commit_message = await self._get_commit_message()
|
104
106
|
|
105
|
-
if not git_diff
|
106
|
-
self.logger.info(f"Skipping git hook update -
|
107
|
+
if not git_diff:
|
108
|
+
self.logger.info(f"Skipping git hook update - no git diff")
|
107
109
|
return
|
108
110
|
|
109
111
|
# Fetch current state
|
@@ -124,6 +126,12 @@ class GitHookHandler:
|
|
124
126
|
changed_files
|
125
127
|
)
|
126
128
|
|
129
|
+
# Check total prompt token count
|
130
|
+
prompt_tokens = self.token_counter.count_tokens(prompt)
|
131
|
+
if prompt_tokens > self.config["max_diff_tokens"]:
|
132
|
+
self.logger.info(f"Skipping git hook update - prompt too large ({prompt_tokens} tokens > {self.config['max_diff_tokens']} limit)")
|
133
|
+
return
|
134
|
+
|
127
135
|
# Call OpenRouter API
|
128
136
|
updates = await self._call_openrouter(prompt)
|
129
137
|
|
@@ -535,6 +543,8 @@ Return ONLY the JSON, no other text."""
|
|
535
543
|
"max_tokens": 24000,
|
536
544
|
}
|
537
545
|
|
546
|
+
|
547
|
+
|
538
548
|
timeout = aiohttp.ClientTimeout(total=self.config["timeout"])
|
539
549
|
|
540
550
|
try:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mcp-code-indexer
|
3
|
-
Version: 1.6.
|
3
|
+
Version: 1.6.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
|
Author: MCP Code Indexer Contributors
|
6
6
|
Maintainer: MCP Code Indexer Contributors
|
@@ -57,8 +57,8 @@ Dynamic: requires-python
|
|
57
57
|
|
58
58
|
# MCP Code Indexer 🚀
|
59
59
|
|
60
|
-
[](https://badge.fury.io/py/mcp-code-indexer)
|
61
|
+
[](https://pypi.org/project/mcp-code-indexer/)
|
62
62
|
[](https://opensource.org/licenses/MIT)
|
63
63
|
|
64
64
|
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.
|
@@ -2,7 +2,7 @@ mcp_code_indexer/__init__.py,sha256=DKmuPpw8URDyojC4T1bttK8kGMI9lv_-B9UYP8dqb90,
|
|
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=
|
5
|
+
mcp_code_indexer/git_hook_handler.py,sha256=h6ge4dAl6rCRStxJiyiEWSq7BkXgKy6Hv__-megb6tk,25882
|
6
6
|
mcp_code_indexer/logging_config.py,sha256=yCGQD-xx9oobS-YctOFcaE1Q3iiuOj2E6cTfKHbh_wc,7358
|
7
7
|
mcp_code_indexer/main.py,sha256=7k00hj2C1CxTDDErbq2Ee072MbvqEAsRqrMHH-w1oM0,31538
|
8
8
|
mcp_code_indexer/merge_handler.py,sha256=lJR8eVq2qSrF6MW9mR3Fy8UzrNAaQ7RsI2FMNXne3vQ,14692
|
@@ -17,9 +17,9 @@ mcp_code_indexer/server/__init__.py,sha256=16xMcuriUOBlawRqWNBk6niwrvtv_JD5xvI36
|
|
17
17
|
mcp_code_indexer/server/mcp_server.py,sha256=bRl5JTFWlQ0MrIulkts6fDws6kPqfy6kKoQdenMOk04,61290
|
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.6.
|
21
|
-
mcp_code_indexer-1.6.
|
22
|
-
mcp_code_indexer-1.6.
|
23
|
-
mcp_code_indexer-1.6.
|
24
|
-
mcp_code_indexer-1.6.
|
25
|
-
mcp_code_indexer-1.6.
|
20
|
+
mcp_code_indexer-1.6.2.dist-info/licenses/LICENSE,sha256=JN9dyPPgYwH9C-UjYM7FLNZjQ6BF7kAzpF3_4PwY4rY,1086
|
21
|
+
mcp_code_indexer-1.6.2.dist-info/METADATA,sha256=e6UEB85dKY1zMkN6ateI4W3o73ckke7VPSIrcU8kxxc,17453
|
22
|
+
mcp_code_indexer-1.6.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
23
|
+
mcp_code_indexer-1.6.2.dist-info/entry_points.txt,sha256=8HqWOw1Is7jOP1bvIgaSwouvT9z_Boe-9hd4NzyJOhY,68
|
24
|
+
mcp_code_indexer-1.6.2.dist-info/top_level.txt,sha256=yKYCM-gMGt-cnupGfAhnZaoEsROLB6DQ1KFUuyKx4rw,17
|
25
|
+
mcp_code_indexer-1.6.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|