mcp-code-indexer 3.1.6__tar.gz → 3.2.0__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.0}/PKG-INFO +42 -53
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/README.md +19 -12
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/pyproject.toml +41 -56
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/git_hook_handler.py +2 -2
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/server/mcp_server.py +97 -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.0}/LICENSE +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/__init__.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/__main__.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/ask_handler.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/claude_api_handler.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/cleanup_manager.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/data/stop_words_english.txt +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/database/__init__.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/database/connection_health.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/database/database.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/database/exceptions.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/database/models.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/database/retry_executor.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/deepask_handler.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/error_handler.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/file_scanner.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/logging_config.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/main.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/middleware/__init__.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/middleware/error_middleware.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/migrations/001_initial.sql +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/migrations/002_performance_indexes.sql +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/migrations/003_project_overviews.sql +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/migrations/004_remove_branch_dependency.sql +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/migrations/005_remove_git_remotes.sql +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/query_preprocessor.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/server/__init__.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4 +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/src/mcp_code_indexer/token_counter.py +0 -0
- {mcp_code_indexer-3.1.6 → mcp_code_indexer-3.2.0}/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.
|
3
|
+
Version: 3.2.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
|
-
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.
|
7
|
+
version = "3.2.0"
|
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
|
|
@@ -34,6 +34,7 @@ from mcp_code_indexer.middleware.error_middleware import (
|
|
34
34
|
AsyncTaskManager,
|
35
35
|
)
|
36
36
|
from mcp_code_indexer.logging_config import get_logger
|
37
|
+
from mcp_code_indexer.cleanup_manager import CleanupManager
|
37
38
|
|
38
39
|
|
39
40
|
logger = logging.getLogger(__name__)
|
@@ -106,6 +107,7 @@ class MCPCodeIndexServer:
|
|
106
107
|
retry_jitter=retry_jitter,
|
107
108
|
)
|
108
109
|
self.token_counter = TokenCounter(token_limit)
|
110
|
+
self.cleanup_manager = CleanupManager(self.db_manager, retention_months=6)
|
109
111
|
|
110
112
|
# Setup error handling
|
111
113
|
self.logger = get_logger(__name__)
|
@@ -119,6 +121,11 @@ class MCPCodeIndexServer:
|
|
119
121
|
# Register handlers
|
120
122
|
self._register_handlers()
|
121
123
|
|
124
|
+
# Background cleanup task tracking
|
125
|
+
self._cleanup_task: Optional[asyncio.Task] = None
|
126
|
+
self._last_cleanup_time: Optional[float] = None
|
127
|
+
self._cleanup_running: bool = False
|
128
|
+
|
122
129
|
# Add debug logging for server events
|
123
130
|
self.logger.debug("MCP server instance created and handlers registered")
|
124
131
|
|
@@ -233,6 +240,7 @@ class MCPCodeIndexServer:
|
|
233
240
|
async def initialize(self) -> None:
|
234
241
|
"""Initialize database and other resources."""
|
235
242
|
await self.db_manager.initialize()
|
243
|
+
self._start_background_cleanup()
|
236
244
|
logger.info("Server initialized successfully")
|
237
245
|
|
238
246
|
def _register_handlers(self) -> None:
|
@@ -949,12 +957,8 @@ class MCPCodeIndexServer:
|
|
949
957
|
|
950
958
|
logger.info(f"Resolved project_id: {project_id}")
|
951
959
|
|
952
|
-
#
|
953
|
-
|
954
|
-
cleaned_up_files = await self.db_manager.cleanup_missing_files(
|
955
|
-
project_id=project_id, project_root=folder_path
|
956
|
-
)
|
957
|
-
logger.info(f"Cleaned up {len(cleaned_up_files)} missing files")
|
960
|
+
# Run cleanup if needed (respects 30-minute cooldown)
|
961
|
+
await self._run_cleanup_if_needed()
|
958
962
|
|
959
963
|
# Get file descriptions for this project (after cleanup)
|
960
964
|
logger.info("Retrieving file descriptions...")
|
@@ -1472,6 +1476,85 @@ class MCPCodeIndexServer:
|
|
1472
1476
|
)
|
1473
1477
|
raise
|
1474
1478
|
|
1479
|
+
async def _periodic_cleanup(self) -> None:
|
1480
|
+
"""Background task that performs cleanup every 6 hours."""
|
1481
|
+
while True:
|
1482
|
+
try:
|
1483
|
+
await asyncio.sleep(6 * 60 * 60) # 6 hours
|
1484
|
+
await self._run_cleanup_if_needed()
|
1485
|
+
|
1486
|
+
except asyncio.CancelledError:
|
1487
|
+
logger.info("Periodic cleanup task cancelled")
|
1488
|
+
break
|
1489
|
+
except Exception as e:
|
1490
|
+
logger.error(f"Error in periodic cleanup: {e}")
|
1491
|
+
# Continue running despite errors
|
1492
|
+
|
1493
|
+
async def _run_cleanup_if_needed(self) -> None:
|
1494
|
+
"""Run cleanup if conditions are met (not running, not run recently)."""
|
1495
|
+
current_time = time.time()
|
1496
|
+
|
1497
|
+
# Check if cleanup is already running
|
1498
|
+
if self._cleanup_running:
|
1499
|
+
logger.debug("Cleanup already running, skipping")
|
1500
|
+
return
|
1501
|
+
|
1502
|
+
# Check if cleanup was run in the last 30 minutes
|
1503
|
+
if (self._last_cleanup_time and
|
1504
|
+
current_time - self._last_cleanup_time < 30 * 60):
|
1505
|
+
logger.debug("Cleanup ran recently, skipping")
|
1506
|
+
return
|
1507
|
+
|
1508
|
+
# Set running flag and update time
|
1509
|
+
self._cleanup_running = True
|
1510
|
+
self._last_cleanup_time = current_time
|
1511
|
+
|
1512
|
+
try:
|
1513
|
+
logger.info("Starting cleanup")
|
1514
|
+
|
1515
|
+
# Get all projects and run cleanup on each
|
1516
|
+
projects = await self.db_manager.get_all_projects()
|
1517
|
+
total_cleaned = 0
|
1518
|
+
|
1519
|
+
for project in projects:
|
1520
|
+
try:
|
1521
|
+
# Cleanup missing files
|
1522
|
+
missing_files = await self.db_manager.cleanup_missing_files(
|
1523
|
+
project_id=project.id,
|
1524
|
+
project_root=Path(project.folder_path)
|
1525
|
+
)
|
1526
|
+
total_cleaned += len(missing_files)
|
1527
|
+
|
1528
|
+
# Perform permanent cleanup (retention policy)
|
1529
|
+
deleted_count = await self.cleanup_manager.perform_cleanup(
|
1530
|
+
project_id=project.id
|
1531
|
+
)
|
1532
|
+
|
1533
|
+
if missing_files or deleted_count:
|
1534
|
+
logger.info(
|
1535
|
+
f"Cleanup for {project.name}: "
|
1536
|
+
f"{len(missing_files)} marked, "
|
1537
|
+
f"{deleted_count} permanently deleted"
|
1538
|
+
)
|
1539
|
+
except Exception as e:
|
1540
|
+
logger.error(
|
1541
|
+
f"Error during cleanup for project {project.name}: {e}"
|
1542
|
+
)
|
1543
|
+
|
1544
|
+
logger.info(f"Cleanup completed: {total_cleaned} files processed")
|
1545
|
+
|
1546
|
+
finally:
|
1547
|
+
self._cleanup_running = False
|
1548
|
+
|
1549
|
+
def _start_background_cleanup(self) -> None:
|
1550
|
+
"""Start the background cleanup task."""
|
1551
|
+
if self._cleanup_task is None or self._cleanup_task.done():
|
1552
|
+
self._cleanup_task = self.task_manager.create_task(
|
1553
|
+
self._periodic_cleanup(),
|
1554
|
+
name="periodic_cleanup"
|
1555
|
+
)
|
1556
|
+
logger.info("Started background cleanup task (6-hour interval)")
|
1557
|
+
|
1475
1558
|
async def run(self) -> None:
|
1476
1559
|
"""Run the MCP server with robust error handling."""
|
1477
1560
|
logger.info("Starting server initialization...")
|
@@ -1562,6 +1645,14 @@ class MCPCodeIndexServer:
|
|
1562
1645
|
async def shutdown(self) -> None:
|
1563
1646
|
"""Clean shutdown of server resources."""
|
1564
1647
|
try:
|
1648
|
+
# Cancel background cleanup task
|
1649
|
+
if self._cleanup_task and not self._cleanup_task.done():
|
1650
|
+
self._cleanup_task.cancel()
|
1651
|
+
try:
|
1652
|
+
await self._cleanup_task
|
1653
|
+
except asyncio.CancelledError:
|
1654
|
+
pass
|
1655
|
+
|
1565
1656
|
# Cancel any running tasks
|
1566
1657
|
self.task_manager.cancel_all()
|
1567
1658
|
|
@@ -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__
|