mcp-code-indexer 3.1.6__tar.gz → 3.2.1__tar.gz
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-3.1.6/src/mcp_code_indexer.egg-info → mcp_code_indexer-3.2.1}/PKG-INFO +42 -53
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/README.md +19 -12
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/pyproject.toml +41 -56
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/git_hook_handler.py +2 -2
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/server/mcp_server.py +128 -6
- mcp_code_indexer-3.1.6/MANIFEST.in +0 -12
- mcp_code_indexer-3.1.6/PKG-INFO +0 -561
- mcp_code_indexer-3.1.6/docs/api-reference.md +0 -798
- mcp_code_indexer-3.1.6/docs/architecture.md +0 -575
- mcp_code_indexer-3.1.6/docs/configuration.md +0 -568
- mcp_code_indexer-3.1.6/docs/contributing.md +0 -659
- mcp_code_indexer-3.1.6/docs/database-resilience.md +0 -397
- mcp_code_indexer-3.1.6/docs/git-hook-setup.md +0 -320
- mcp_code_indexer-3.1.6/docs/monitoring.md +0 -738
- mcp_code_indexer-3.1.6/docs/performance-tuning.md +0 -554
- mcp_code_indexer-3.1.6/requirements.txt +0 -11
- mcp_code_indexer-3.1.6/setup.cfg +0 -17
- mcp_code_indexer-3.1.6/setup.py +0 -67
- mcp_code_indexer-3.1.6/src/mcp_code_indexer.egg-info/SOURCES.txt +0 -52
- mcp_code_indexer-3.1.6/src/mcp_code_indexer.egg-info/dependency_links.txt +0 -1
- mcp_code_indexer-3.1.6/src/mcp_code_indexer.egg-info/entry_points.txt +0 -2
- mcp_code_indexer-3.1.6/src/mcp_code_indexer.egg-info/requires.txt +0 -31
- mcp_code_indexer-3.1.6/src/mcp_code_indexer.egg-info/top_level.txt +0 -1
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/LICENSE +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/__init__.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/__main__.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/ask_handler.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/claude_api_handler.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/cleanup_manager.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/data/stop_words_english.txt +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/database/__init__.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/database/connection_health.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/database/database.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/database/exceptions.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/database/models.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/database/retry_executor.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/deepask_handler.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/error_handler.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/file_scanner.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/logging_config.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/main.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/middleware/__init__.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/middleware/error_middleware.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/migrations/001_initial.sql +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/migrations/002_performance_indexes.sql +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/migrations/003_project_overviews.sql +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/migrations/004_remove_branch_dependency.sql +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/migrations/005_remove_git_remotes.sql +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/query_preprocessor.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/server/__init__.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4 +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/token_counter.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.1}/src/mcp_code_indexer/tools/__init__.py +0 -0
@@ -1,66 +1,47 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.3
|
2
2
|
Name: mcp-code-indexer
|
3
|
-
Version: 3.1
|
3
|
+
Version: 3.2.1
|
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
|
-
Author: MCP Code Indexer Contributors
|
6
|
-
Maintainer: MCP Code Indexer Contributors
|
7
5
|
License: MIT
|
8
|
-
Project-URL: Homepage, https://github.com/fluffypony/mcp-code-indexer
|
9
|
-
Project-URL: Repository, https://github.com/fluffypony/mcp-code-indexer
|
10
|
-
Project-URL: Issues, https://github.com/fluffypony/mcp-code-indexer/issues
|
11
|
-
Project-URL: Documentation, https://github.com/fluffypony/mcp-code-indexer/blob/main/README.md
|
12
6
|
Keywords: mcp,model-context-protocol,code-indexer,ai-tools,codebase-navigation,file-descriptions,llm-tools
|
7
|
+
Author: MCP Code Indexer Contributors
|
8
|
+
Maintainer: MCP Code Indexer Contributors
|
9
|
+
Requires-Python: >=3.9,<4.0
|
13
10
|
Classifier: Development Status :: 5 - Production/Stable
|
11
|
+
Classifier: Environment :: Console
|
12
|
+
Classifier: Framework :: AsyncIO
|
14
13
|
Classifier: Intended Audience :: Developers
|
15
14
|
Classifier: License :: OSI Approved :: MIT License
|
16
15
|
Classifier: Operating System :: OS Independent
|
17
16
|
Classifier: Programming Language :: Python :: 3
|
18
|
-
Classifier: Programming Language :: Python :: 3.13
|
19
17
|
Classifier: Programming Language :: Python :: 3.9
|
20
18
|
Classifier: Programming Language :: Python :: 3.10
|
21
19
|
Classifier: Programming Language :: Python :: 3.11
|
22
20
|
Classifier: Programming Language :: Python :: 3.12
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
23
23
|
Classifier: Topic :: Software Development
|
24
24
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
25
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
26
|
-
Classifier: Framework :: AsyncIO
|
27
|
-
Classifier: Environment :: Console
|
28
25
|
Classifier: Typing :: Typed
|
29
|
-
Requires-
|
26
|
+
Requires-Dist: aiofiles (==23.2.0)
|
27
|
+
Requires-Dist: aiohttp (>=3.8.0)
|
28
|
+
Requires-Dist: aiosqlite (==0.19.0)
|
29
|
+
Requires-Dist: gitignore-parser (==0.1.11)
|
30
|
+
Requires-Dist: importlib-metadata (>=1.0.0) ; python_version < "3.8"
|
31
|
+
Requires-Dist: mcp (>=1.9.0)
|
32
|
+
Requires-Dist: pydantic (>=2.8.0)
|
33
|
+
Requires-Dist: tenacity (>=8.0.0)
|
34
|
+
Requires-Dist: tiktoken (>=0.9.0)
|
35
|
+
Requires-Dist: tomli (>=1.2.0) ; python_version < "3.11"
|
36
|
+
Project-URL: Documentation, https://github.com/fluffypony/mcp-code-indexer/blob/main/README.md
|
37
|
+
Project-URL: Homepage, https://github.com/fluffypony/mcp-code-indexer
|
38
|
+
Project-URL: Repository, https://github.com/fluffypony/mcp-code-indexer
|
30
39
|
Description-Content-Type: text/markdown
|
31
|
-
License-File: LICENSE
|
32
|
-
Requires-Dist: tiktoken>=0.9.0
|
33
|
-
Requires-Dist: mcp>=1.9.0
|
34
|
-
Requires-Dist: gitignore_parser==0.1.11
|
35
|
-
Requires-Dist: pydantic>=2.8.0
|
36
|
-
Requires-Dist: aiofiles==23.2.0
|
37
|
-
Requires-Dist: aiosqlite==0.19.0
|
38
|
-
Requires-Dist: aiohttp>=3.8.0
|
39
|
-
Requires-Dist: tenacity>=8.0.0
|
40
|
-
Requires-Dist: tomli>=1.2.0; python_version < "3.11"
|
41
|
-
Requires-Dist: importlib-metadata>=1.0.0; python_version < "3.8"
|
42
|
-
Provides-Extra: dev
|
43
|
-
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
44
|
-
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
45
|
-
Requires-Dist: pytest-mock>=3.11.0; extra == "dev"
|
46
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
47
|
-
Requires-Dist: black>=24.0.0; extra == "dev"
|
48
|
-
Requires-Dist: isort>=5.12.0; extra == "dev"
|
49
|
-
Requires-Dist: flake8>=7.0.0; extra == "dev"
|
50
|
-
Requires-Dist: mypy>=1.8.0; extra == "dev"
|
51
|
-
Requires-Dist: pre-commit>=3.5.0; extra == "dev"
|
52
|
-
Provides-Extra: test
|
53
|
-
Requires-Dist: pytest>=8.0.0; extra == "test"
|
54
|
-
Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
|
55
|
-
Requires-Dist: pytest-mock>=3.11.0; extra == "test"
|
56
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
|
57
|
-
Dynamic: license-file
|
58
|
-
Dynamic: requires-python
|
59
40
|
|
60
41
|
# MCP Code Indexer 🚀
|
61
42
|
|
62
|
-
[](https://badge.fury.io/py/mcp-code-indexer)
|
44
|
+
[](https://pypi.org/project/mcp-code-indexer/)
|
64
45
|
[](https://opensource.org/licenses/MIT)
|
65
46
|
|
66
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.
|
@@ -83,7 +64,10 @@ Perfect for AI-powered code review, refactoring tools, documentation generation,
|
|
83
64
|
Get started integrating MCP Code Indexer into your AI agent workflow:
|
84
65
|
|
85
66
|
```bash
|
86
|
-
# Install
|
67
|
+
# Install with Poetry
|
68
|
+
poetry add mcp-code-indexer
|
69
|
+
|
70
|
+
# Or with pip
|
87
71
|
pip install mcp-code-indexer
|
88
72
|
|
89
73
|
# Start the MCP server
|
@@ -113,7 +97,7 @@ mcp-code-indexer --version
|
|
113
97
|
|
114
98
|
**New to MCP Code Indexer?** Start here:
|
115
99
|
|
116
|
-
1. **Install**: `pip install mcp-code-indexer`
|
100
|
+
1. **Install**: `poetry add mcp-code-indexer` (or `pip install mcp-code-indexer`)
|
117
101
|
2. **Run**: `mcp-code-indexer --token-limit 32000`
|
118
102
|
3. **Connect**: Use your favorite MCP client
|
119
103
|
4. **Explore**: Try the `check_codebase_size` tool first
|
@@ -125,7 +109,10 @@ mcp-code-indexer --version
|
|
125
109
|
git clone https://github.com/fluffypony/mcp-code-indexer.git
|
126
110
|
cd mcp-code-indexer
|
127
111
|
|
128
|
-
# Install
|
112
|
+
# Install with Poetry (recommended)
|
113
|
+
poetry install
|
114
|
+
|
115
|
+
# Or install in development mode with pip
|
129
116
|
pip install -e .
|
130
117
|
|
131
118
|
# Run the server
|
@@ -181,14 +168,12 @@ Contributing to MCP Code Indexer? Follow these steps for a proper development en
|
|
181
168
|
git clone https://github.com/fluffypony/mcp-code-indexer.git
|
182
169
|
cd mcp-code-indexer
|
183
170
|
|
184
|
-
#
|
171
|
+
# Install with Poetry (recommended)
|
172
|
+
poetry install
|
173
|
+
|
174
|
+
# Or use pip with virtual environment
|
185
175
|
python -m venv venv
|
186
176
|
source venv/bin/activate # On Windows: venv\Scripts\activate
|
187
|
-
|
188
|
-
# Install package in editable mode (REQUIRED for development)
|
189
|
-
pip install -e .
|
190
|
-
|
191
|
-
# Install development dependencies
|
192
177
|
pip install -e .[dev]
|
193
178
|
|
194
179
|
# Verify installation
|
@@ -439,7 +424,10 @@ async def analyze_codebase(project_path):
|
|
439
424
|
## 🧪 Testing
|
440
425
|
|
441
426
|
```bash
|
442
|
-
# Install with test dependencies
|
427
|
+
# Install with test dependencies using Poetry
|
428
|
+
poetry install --with test
|
429
|
+
|
430
|
+
# Or with pip
|
443
431
|
pip install mcp-code-indexer[test]
|
444
432
|
|
445
433
|
# Run full test suite
|
@@ -559,3 +547,4 @@ MIT License - see **[LICENSE](LICENSE)** for details.
|
|
559
547
|
🎯 **New User?** [Get started in 2 minutes](#-quick-start)
|
560
548
|
👨💻 **Developer?** [Explore the complete API](docs/api-reference.md)
|
561
549
|
🔧 **Production?** [Deploy with confidence](docs/configuration.md)
|
550
|
+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# MCP Code Indexer 🚀
|
2
2
|
|
3
|
-
[](https://badge.fury.io/py/mcp-code-indexer)
|
4
|
+
[](https://pypi.org/project/mcp-code-indexer/)
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
6
6
|
|
7
7
|
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.
|
@@ -24,7 +24,10 @@ Perfect for AI-powered code review, refactoring tools, documentation generation,
|
|
24
24
|
Get started integrating MCP Code Indexer into your AI agent workflow:
|
25
25
|
|
26
26
|
```bash
|
27
|
-
# Install
|
27
|
+
# Install with Poetry
|
28
|
+
poetry add mcp-code-indexer
|
29
|
+
|
30
|
+
# Or with pip
|
28
31
|
pip install mcp-code-indexer
|
29
32
|
|
30
33
|
# Start the MCP server
|
@@ -54,7 +57,7 @@ mcp-code-indexer --version
|
|
54
57
|
|
55
58
|
**New to MCP Code Indexer?** Start here:
|
56
59
|
|
57
|
-
1. **Install**: `pip install mcp-code-indexer`
|
60
|
+
1. **Install**: `poetry add mcp-code-indexer` (or `pip install mcp-code-indexer`)
|
58
61
|
2. **Run**: `mcp-code-indexer --token-limit 32000`
|
59
62
|
3. **Connect**: Use your favorite MCP client
|
60
63
|
4. **Explore**: Try the `check_codebase_size` tool first
|
@@ -66,7 +69,10 @@ mcp-code-indexer --version
|
|
66
69
|
git clone https://github.com/fluffypony/mcp-code-indexer.git
|
67
70
|
cd mcp-code-indexer
|
68
71
|
|
69
|
-
# Install
|
72
|
+
# Install with Poetry (recommended)
|
73
|
+
poetry install
|
74
|
+
|
75
|
+
# Or install in development mode with pip
|
70
76
|
pip install -e .
|
71
77
|
|
72
78
|
# Run the server
|
@@ -122,14 +128,12 @@ Contributing to MCP Code Indexer? Follow these steps for a proper development en
|
|
122
128
|
git clone https://github.com/fluffypony/mcp-code-indexer.git
|
123
129
|
cd mcp-code-indexer
|
124
130
|
|
125
|
-
#
|
131
|
+
# Install with Poetry (recommended)
|
132
|
+
poetry install
|
133
|
+
|
134
|
+
# Or use pip with virtual environment
|
126
135
|
python -m venv venv
|
127
136
|
source venv/bin/activate # On Windows: venv\Scripts\activate
|
128
|
-
|
129
|
-
# Install package in editable mode (REQUIRED for development)
|
130
|
-
pip install -e .
|
131
|
-
|
132
|
-
# Install development dependencies
|
133
137
|
pip install -e .[dev]
|
134
138
|
|
135
139
|
# Verify installation
|
@@ -380,7 +384,10 @@ async def analyze_codebase(project_path):
|
|
380
384
|
## 🧪 Testing
|
381
385
|
|
382
386
|
```bash
|
383
|
-
# Install with test dependencies
|
387
|
+
# Install with test dependencies using Poetry
|
388
|
+
poetry install --with test
|
389
|
+
|
390
|
+
# Or with pip
|
384
391
|
pip install mcp-code-indexer[test]
|
385
392
|
|
386
393
|
# Run full test suite
|
@@ -1,19 +1,18 @@
|
|
1
1
|
[build-system]
|
2
|
-
requires = ["
|
3
|
-
build-backend = "
|
2
|
+
requires = ["poetry-core"]
|
3
|
+
build-backend = "poetry.core.masonry.api"
|
4
4
|
|
5
|
-
[
|
5
|
+
[tool.poetry]
|
6
6
|
name = "mcp-code-indexer"
|
7
|
-
version = "3.1
|
7
|
+
version = "3.2.1"
|
8
8
|
description = "MCP server that tracks file descriptions across codebases, enabling AI agents to efficiently navigate and understand code through searchable summaries and token-aware overviews."
|
9
|
+
authors = ["MCP Code Indexer Contributors"]
|
10
|
+
maintainers = ["MCP Code Indexer Contributors"]
|
11
|
+
license = "MIT"
|
9
12
|
readme = "README.md"
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
]
|
14
|
-
maintainers = [
|
15
|
-
{name = "MCP Code Indexer Contributors"}
|
16
|
-
]
|
13
|
+
homepage = "https://github.com/fluffypony/mcp-code-indexer"
|
14
|
+
repository = "https://github.com/fluffypony/mcp-code-indexer"
|
15
|
+
documentation = "https://github.com/fluffypony/mcp-code-indexer/blob/main/README.md"
|
17
16
|
keywords = [
|
18
17
|
"mcp",
|
19
18
|
"model-context-protocol",
|
@@ -29,11 +28,11 @@ classifiers = [
|
|
29
28
|
"License :: OSI Approved :: MIT License",
|
30
29
|
"Operating System :: OS Independent",
|
31
30
|
"Programming Language :: Python :: 3",
|
32
|
-
"Programming Language :: Python :: 3.13",
|
33
31
|
"Programming Language :: Python :: 3.9",
|
34
32
|
"Programming Language :: Python :: 3.10",
|
35
33
|
"Programming Language :: Python :: 3.11",
|
36
34
|
"Programming Language :: Python :: 3.12",
|
35
|
+
"Programming Language :: Python :: 3.13",
|
37
36
|
"Topic :: Software Development",
|
38
37
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
39
38
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
@@ -41,56 +40,42 @@ classifiers = [
|
|
41
40
|
"Environment :: Console",
|
42
41
|
"Typing :: Typed"
|
43
42
|
]
|
44
|
-
|
45
|
-
dependencies = [
|
46
|
-
"tiktoken>=0.9.0",
|
47
|
-
"mcp>=1.9.0",
|
48
|
-
"gitignore_parser==0.1.11",
|
49
|
-
"pydantic>=2.8.0",
|
50
|
-
"aiofiles==23.2.0",
|
51
|
-
"aiosqlite==0.19.0",
|
52
|
-
"aiohttp>=3.8.0",
|
53
|
-
"tenacity>=8.0.0",
|
54
|
-
"tomli>=1.2.0; python_version<'3.11'",
|
55
|
-
"importlib-metadata>=1.0.0; python_version<'3.8'"
|
56
|
-
]
|
43
|
+
packages = [{include = "mcp_code_indexer", from = "src"}]
|
57
44
|
|
58
|
-
[
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
test = [
|
71
|
-
"pytest>=8.0.0",
|
72
|
-
"pytest-asyncio>=0.21.0",
|
73
|
-
"pytest-mock>=3.11.0",
|
74
|
-
"pytest-cov>=4.0.0"
|
75
|
-
]
|
45
|
+
[tool.poetry.dependencies]
|
46
|
+
python = "^3.9"
|
47
|
+
tiktoken = ">=0.9.0"
|
48
|
+
mcp = ">=1.9.0"
|
49
|
+
gitignore-parser = "0.1.11"
|
50
|
+
pydantic = ">=2.8.0"
|
51
|
+
aiofiles = "23.2.0"
|
52
|
+
aiosqlite = "0.19.0"
|
53
|
+
aiohttp = ">=3.8.0"
|
54
|
+
tenacity = ">=8.0.0"
|
55
|
+
tomli = {version = ">=1.2.0", markers = "python_version < '3.11'"}
|
56
|
+
importlib-metadata = {version = ">=1.0.0", markers = "python_version < '3.8'"}
|
76
57
|
|
77
|
-
[
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
58
|
+
[tool.poetry.group.dev.dependencies]
|
59
|
+
pytest = ">=8.0.0"
|
60
|
+
pytest-asyncio = ">=0.21.0"
|
61
|
+
pytest-mock = ">=3.11.0"
|
62
|
+
pytest-cov = ">=4.0.0"
|
63
|
+
black = ">=24.0.0"
|
64
|
+
isort = ">=5.12.0"
|
65
|
+
flake8 = ">=7.0.0"
|
66
|
+
mypy = ">=1.8.0"
|
67
|
+
pre-commit = ">=3.5.0"
|
82
68
|
|
83
|
-
[
|
84
|
-
|
69
|
+
[tool.poetry.group.test.dependencies]
|
70
|
+
pytest = ">=8.0.0"
|
71
|
+
pytest-asyncio = ">=0.21.0"
|
72
|
+
pytest-mock = ">=3.11.0"
|
73
|
+
pytest-cov = ">=4.0.0"
|
85
74
|
|
86
|
-
[tool.
|
87
|
-
|
75
|
+
[tool.poetry.scripts]
|
76
|
+
mcp-code-indexer = "mcp_code_indexer.main:cli_main"
|
88
77
|
|
89
|
-
[tool.setuptools.packages.find]
|
90
|
-
where = ["src"]
|
91
78
|
|
92
|
-
[tool.setuptools.package-data]
|
93
|
-
mcp_code_indexer = ["tiktoken_cache/*", "*.sql", "data/*"]
|
94
79
|
|
95
80
|
# Black configuration
|
96
81
|
[tool.black]
|
@@ -313,7 +313,7 @@ INSTRUCTIONS:
|
|
313
313
|
directories)
|
314
314
|
- Architectural changes (new patterns, frameworks, or approaches)
|
315
315
|
- Significant dependency additions (Cargo.toml, package.json,
|
316
|
-
|
316
|
+
pyproject.toml changes)
|
317
317
|
- New API endpoints or workflows
|
318
318
|
- Changes to build/deployment processes
|
319
319
|
|
@@ -613,7 +613,7 @@ Update project overview ONLY if there are major structural changes like:
|
|
613
613
|
- New major features or components (indicated by commit message or new directories)
|
614
614
|
- Architectural changes (new patterns, frameworks, or approaches)
|
615
615
|
- Significant dependency additions (Cargo.toml, package.json,
|
616
|
-
|
616
|
+
pyproject.toml changes)
|
617
617
|
- New API endpoints or workflows
|
618
618
|
- Changes to build/deployment processes
|
619
619
|
|
@@ -10,6 +10,7 @@ import html
|
|
10
10
|
import json
|
11
11
|
import logging
|
12
12
|
import re
|
13
|
+
import time
|
13
14
|
import uuid
|
14
15
|
from datetime import datetime
|
15
16
|
from pathlib import Path
|
@@ -34,6 +35,7 @@ from mcp_code_indexer.middleware.error_middleware import (
|
|
34
35
|
AsyncTaskManager,
|
35
36
|
)
|
36
37
|
from mcp_code_indexer.logging_config import get_logger
|
38
|
+
from mcp_code_indexer.cleanup_manager import CleanupManager
|
37
39
|
|
38
40
|
|
39
41
|
logger = logging.getLogger(__name__)
|
@@ -106,6 +108,7 @@ class MCPCodeIndexServer:
|
|
106
108
|
retry_jitter=retry_jitter,
|
107
109
|
)
|
108
110
|
self.token_counter = TokenCounter(token_limit)
|
111
|
+
self.cleanup_manager = CleanupManager(self.db_manager, retention_months=6)
|
109
112
|
|
110
113
|
# Setup error handling
|
111
114
|
self.logger = get_logger(__name__)
|
@@ -119,6 +122,11 @@ class MCPCodeIndexServer:
|
|
119
122
|
# Register handlers
|
120
123
|
self._register_handlers()
|
121
124
|
|
125
|
+
# Background cleanup task tracking
|
126
|
+
self._cleanup_task: Optional[asyncio.Task] = None
|
127
|
+
self._last_cleanup_time: Optional[float] = None
|
128
|
+
self._cleanup_running: bool = False
|
129
|
+
|
122
130
|
# Add debug logging for server events
|
123
131
|
self.logger.debug("MCP server instance created and handlers registered")
|
124
132
|
|
@@ -233,6 +241,7 @@ class MCPCodeIndexServer:
|
|
233
241
|
async def initialize(self) -> None:
|
234
242
|
"""Initialize database and other resources."""
|
235
243
|
await self.db_manager.initialize()
|
244
|
+
self._start_background_cleanup()
|
236
245
|
logger.info("Server initialized successfully")
|
237
246
|
|
238
247
|
def _register_handlers(self) -> None:
|
@@ -949,12 +958,10 @@ class MCPCodeIndexServer:
|
|
949
958
|
|
950
959
|
logger.info(f"Resolved project_id: {project_id}")
|
951
960
|
|
952
|
-
#
|
953
|
-
|
954
|
-
cleaned_up_files = await self.db_manager.cleanup_missing_files(
|
961
|
+
# Run cleanup if needed (respects 30-minute cooldown)
|
962
|
+
cleaned_up_count = await self._run_cleanup_if_needed(
|
955
963
|
project_id=project_id, project_root=folder_path
|
956
964
|
)
|
957
|
-
logger.info(f"Cleaned up {len(cleaned_up_files)} missing files")
|
958
965
|
|
959
966
|
# Get file descriptions for this project (after cleanup)
|
960
967
|
logger.info("Retrieving file descriptions...")
|
@@ -1001,8 +1008,7 @@ class MCPCodeIndexServer:
|
|
1001
1008
|
"recommendation": recommendation,
|
1002
1009
|
"tokenLimit": token_limit,
|
1003
1010
|
"totalFiles": len(file_descriptions),
|
1004
|
-
"
|
1005
|
-
"cleanedUpCount": len(cleaned_up_files),
|
1011
|
+
"cleanedUpCount": cleaned_up_count,
|
1006
1012
|
}
|
1007
1013
|
|
1008
1014
|
async def _handle_find_missing_descriptions(
|
@@ -1472,6 +1478,114 @@ class MCPCodeIndexServer:
|
|
1472
1478
|
)
|
1473
1479
|
raise
|
1474
1480
|
|
1481
|
+
async def _periodic_cleanup(self) -> None:
|
1482
|
+
"""Background task that performs cleanup every 6 hours."""
|
1483
|
+
while True:
|
1484
|
+
try:
|
1485
|
+
await asyncio.sleep(6 * 60 * 60) # 6 hours
|
1486
|
+
await self._run_cleanup_if_needed()
|
1487
|
+
|
1488
|
+
except asyncio.CancelledError:
|
1489
|
+
logger.info("Periodic cleanup task cancelled")
|
1490
|
+
break
|
1491
|
+
except Exception as e:
|
1492
|
+
logger.error(f"Error in periodic cleanup: {e}")
|
1493
|
+
# Continue running despite errors
|
1494
|
+
|
1495
|
+
async def _run_cleanup_if_needed(self, project_id: str = None, project_root: Path = None) -> int:
|
1496
|
+
"""Run cleanup if conditions are met (not running, not run recently)."""
|
1497
|
+
current_time = time.time()
|
1498
|
+
|
1499
|
+
# Check if cleanup is already running
|
1500
|
+
if self._cleanup_running:
|
1501
|
+
logger.debug("Cleanup already running, skipping")
|
1502
|
+
return 0
|
1503
|
+
|
1504
|
+
# Check if cleanup was run in the last 30 minutes
|
1505
|
+
if (self._last_cleanup_time and
|
1506
|
+
current_time - self._last_cleanup_time < 30 * 60):
|
1507
|
+
logger.debug("Cleanup ran recently, skipping")
|
1508
|
+
return 0
|
1509
|
+
|
1510
|
+
# Set running flag and update time
|
1511
|
+
self._cleanup_running = True
|
1512
|
+
self._last_cleanup_time = current_time
|
1513
|
+
|
1514
|
+
try:
|
1515
|
+
logger.info("Starting cleanup")
|
1516
|
+
total_cleaned = 0
|
1517
|
+
|
1518
|
+
if project_id and project_root:
|
1519
|
+
# Single project cleanup
|
1520
|
+
try:
|
1521
|
+
missing_files = await self.db_manager.cleanup_missing_files(
|
1522
|
+
project_id=project_id, project_root=project_root
|
1523
|
+
)
|
1524
|
+
total_cleaned = len(missing_files)
|
1525
|
+
|
1526
|
+
# Perform permanent cleanup (retention policy)
|
1527
|
+
deleted_count = await self.cleanup_manager.perform_cleanup(
|
1528
|
+
project_id=project_id
|
1529
|
+
)
|
1530
|
+
|
1531
|
+
if missing_files or deleted_count:
|
1532
|
+
logger.info(
|
1533
|
+
f"Cleanup: {len(missing_files)} marked, "
|
1534
|
+
f"{deleted_count} permanently deleted"
|
1535
|
+
)
|
1536
|
+
except Exception as e:
|
1537
|
+
logger.error(f"Error during cleanup: {e}")
|
1538
|
+
else:
|
1539
|
+
# All projects cleanup (for periodic task)
|
1540
|
+
projects = await self.db_manager.get_all_projects()
|
1541
|
+
|
1542
|
+
for project in projects:
|
1543
|
+
try:
|
1544
|
+
# Skip projects without folder paths in aliases
|
1545
|
+
if not project.aliases:
|
1546
|
+
continue
|
1547
|
+
|
1548
|
+
# Use first alias as folder path
|
1549
|
+
folder_path = Path(project.aliases[0])
|
1550
|
+
if not folder_path.exists():
|
1551
|
+
continue
|
1552
|
+
|
1553
|
+
missing_files = await self.db_manager.cleanup_missing_files(
|
1554
|
+
project_id=project.id, project_root=folder_path
|
1555
|
+
)
|
1556
|
+
total_cleaned += len(missing_files)
|
1557
|
+
|
1558
|
+
# Perform permanent cleanup (retention policy)
|
1559
|
+
deleted_count = await self.cleanup_manager.perform_cleanup(
|
1560
|
+
project_id=project.id
|
1561
|
+
)
|
1562
|
+
|
1563
|
+
if missing_files or deleted_count:
|
1564
|
+
logger.info(
|
1565
|
+
f"Cleanup for {project.name}: "
|
1566
|
+
f"{len(missing_files)} marked, "
|
1567
|
+
f"{deleted_count} permanently deleted"
|
1568
|
+
)
|
1569
|
+
except Exception as e:
|
1570
|
+
logger.error(
|
1571
|
+
f"Error during cleanup for project {project.name}: {e}"
|
1572
|
+
)
|
1573
|
+
|
1574
|
+
logger.info(f"Cleanup completed: {total_cleaned} files processed")
|
1575
|
+
return total_cleaned
|
1576
|
+
|
1577
|
+
finally:
|
1578
|
+
self._cleanup_running = False
|
1579
|
+
|
1580
|
+
def _start_background_cleanup(self) -> None:
|
1581
|
+
"""Start the background cleanup task."""
|
1582
|
+
if self._cleanup_task is None or self._cleanup_task.done():
|
1583
|
+
self._cleanup_task = self.task_manager.create_task(
|
1584
|
+
self._periodic_cleanup(),
|
1585
|
+
name="periodic_cleanup"
|
1586
|
+
)
|
1587
|
+
logger.info("Started background cleanup task (6-hour interval)")
|
1588
|
+
|
1475
1589
|
async def run(self) -> None:
|
1476
1590
|
"""Run the MCP server with robust error handling."""
|
1477
1591
|
logger.info("Starting server initialization...")
|
@@ -1562,6 +1676,14 @@ class MCPCodeIndexServer:
|
|
1562
1676
|
async def shutdown(self) -> None:
|
1563
1677
|
"""Clean shutdown of server resources."""
|
1564
1678
|
try:
|
1679
|
+
# Cancel background cleanup task
|
1680
|
+
if self._cleanup_task and not self._cleanup_task.done():
|
1681
|
+
self._cleanup_task.cancel()
|
1682
|
+
try:
|
1683
|
+
await self._cleanup_task
|
1684
|
+
except asyncio.CancelledError:
|
1685
|
+
pass
|
1686
|
+
|
1565
1687
|
# Cancel any running tasks
|
1566
1688
|
self.task_manager.cancel_all()
|
1567
1689
|
|
@@ -1,12 +0,0 @@
|
|
1
|
-
include README.md
|
2
|
-
include LICENSE
|
3
|
-
include pyproject.toml
|
4
|
-
include requirements.txt
|
5
|
-
recursive-include src/mcp_code_indexer/tiktoken_cache *
|
6
|
-
recursive-include src/mcp_code_indexer/migrations *.sql
|
7
|
-
recursive-include docs *.md
|
8
|
-
recursive-exclude tests *
|
9
|
-
recursive-exclude venv *
|
10
|
-
recursive-exclude .git *
|
11
|
-
global-exclude *.pyc
|
12
|
-
global-exclude __pycache__
|