mcp-code-indexer 1.0.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.
Files changed (36) hide show
  1. mcp_code_indexer-1.0.0/LICENSE +21 -0
  2. mcp_code_indexer-1.0.0/MANIFEST.in +12 -0
  3. mcp_code_indexer-1.0.0/PKG-INFO +364 -0
  4. mcp_code_indexer-1.0.0/README.md +309 -0
  5. mcp_code_indexer-1.0.0/docs/api-reference.md +716 -0
  6. mcp_code_indexer-1.0.0/docs/architecture.md +573 -0
  7. mcp_code_indexer-1.0.0/docs/configuration.md +562 -0
  8. mcp_code_indexer-1.0.0/docs/contributing.md +653 -0
  9. mcp_code_indexer-1.0.0/migrations/001_initial.sql +100 -0
  10. mcp_code_indexer-1.0.0/migrations/002_performance_indexes.sql +61 -0
  11. mcp_code_indexer-1.0.0/pyproject.toml +180 -0
  12. mcp_code_indexer-1.0.0/requirements.txt +9 -0
  13. mcp_code_indexer-1.0.0/setup.cfg +4 -0
  14. mcp_code_indexer-1.0.0/setup.py +47 -0
  15. mcp_code_indexer-1.0.0/src/mcp_code_indexer/__init__.py +16 -0
  16. mcp_code_indexer-1.0.0/src/mcp_code_indexer/database/__init__.py +1 -0
  17. mcp_code_indexer-1.0.0/src/mcp_code_indexer/database/database.py +480 -0
  18. mcp_code_indexer-1.0.0/src/mcp_code_indexer/database/models.py +123 -0
  19. mcp_code_indexer-1.0.0/src/mcp_code_indexer/error_handler.py +365 -0
  20. mcp_code_indexer-1.0.0/src/mcp_code_indexer/file_scanner.py +375 -0
  21. mcp_code_indexer-1.0.0/src/mcp_code_indexer/logging_config.py +183 -0
  22. mcp_code_indexer-1.0.0/src/mcp_code_indexer/main.py +129 -0
  23. mcp_code_indexer-1.0.0/src/mcp_code_indexer/merge_handler.py +386 -0
  24. mcp_code_indexer-1.0.0/src/mcp_code_indexer/middleware/__init__.py +7 -0
  25. mcp_code_indexer-1.0.0/src/mcp_code_indexer/middleware/error_middleware.py +286 -0
  26. mcp_code_indexer-1.0.0/src/mcp_code_indexer/server/__init__.py +1 -0
  27. mcp_code_indexer-1.0.0/src/mcp_code_indexer/server/mcp_server.py +699 -0
  28. mcp_code_indexer-1.0.0/src/mcp_code_indexer/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4 +100256 -0
  29. mcp_code_indexer-1.0.0/src/mcp_code_indexer/token_counter.py +243 -0
  30. mcp_code_indexer-1.0.0/src/mcp_code_indexer/tools/__init__.py +1 -0
  31. mcp_code_indexer-1.0.0/src/mcp_code_indexer.egg-info/PKG-INFO +364 -0
  32. mcp_code_indexer-1.0.0/src/mcp_code_indexer.egg-info/SOURCES.txt +34 -0
  33. mcp_code_indexer-1.0.0/src/mcp_code_indexer.egg-info/dependency_links.txt +1 -0
  34. mcp_code_indexer-1.0.0/src/mcp_code_indexer.egg-info/entry_points.txt +2 -0
  35. mcp_code_indexer-1.0.0/src/mcp_code_indexer.egg-info/requires.txt +23 -0
  36. mcp_code_indexer-1.0.0/src/mcp_code_indexer.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 MCP Code Indexer Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,12 @@
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 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__
@@ -0,0 +1,364 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-code-indexer
3
+ Version: 1.0.0
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
+ 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
+ Keywords: mcp,model-context-protocol,code-indexer,ai-tools,codebase-navigation,file-descriptions,llm-tools
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Software Development
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
26
+ Classifier: Framework :: AsyncIO
27
+ Classifier: Environment :: Console
28
+ Classifier: Typing :: Typed
29
+ Requires-Python: >=3.9
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: tiktoken==0.7.0
33
+ Requires-Dist: mcp==1.0.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
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
40
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
41
+ Requires-Dist: pytest-mock>=3.11.0; extra == "dev"
42
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
43
+ Requires-Dist: black>=23.0.0; extra == "dev"
44
+ Requires-Dist: isort>=5.12.0; extra == "dev"
45
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
46
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
47
+ Requires-Dist: pre-commit>=3.0.0; extra == "dev"
48
+ Provides-Extra: test
49
+ Requires-Dist: pytest>=8.0.0; extra == "test"
50
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
51
+ Requires-Dist: pytest-mock>=3.11.0; extra == "test"
52
+ Requires-Dist: pytest-cov>=4.0.0; extra == "test"
53
+ Dynamic: license-file
54
+ Dynamic: requires-python
55
+
56
+ # MCP Code Indexer ๐Ÿš€
57
+
58
+ [![PyPI version](https://badge.fury.io/py/mcp-code-indexer.svg)](https://badge.fury.io/py/mcp-code-indexer)
59
+ [![Python](https://img.shields.io/pypi/pyversions/mcp-code-indexer.svg)](https://pypi.org/project/mcp-code-indexer/)
60
+ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
61
+
62
+ A production-ready **Model Context Protocol (MCP) server** that provides intelligent codebase navigation for AI agents through searchable file descriptions, token-aware overviews, and advanced merge capabilities.
63
+
64
+ ## ๐ŸŽฏ What It Does
65
+
66
+ The MCP Code Indexer solves a critical problem for AI agents working with large codebases: **understanding code structure without repeatedly scanning files**. Instead of reading every file, agents can:
67
+
68
+ - **Query file purposes** instantly with natural language descriptions
69
+ - **Search across codebases** using full-text search
70
+ - **Get intelligent recommendations** based on codebase size (overview vs search)
71
+ - **Merge branch descriptions** with conflict resolution
72
+ - **Inherit descriptions** from upstream repositories automatically
73
+
74
+ Perfect for AI-powered code review, refactoring tools, documentation generation, and codebase analysis workflows.
75
+
76
+ ## โšก Quick Start
77
+
78
+ ### Install from PyPI
79
+
80
+ ```bash
81
+ # Install the package
82
+ pip install mcp-code-indexer
83
+
84
+ # Run the server
85
+ mcp-code-indexer --token-limit 32000
86
+
87
+ # Check version
88
+ mcp-code-indexer --version
89
+ ```
90
+
91
+ ### Install from Source
92
+
93
+ ```bash
94
+ # Clone and setup
95
+ git clone https://github.com/your-username/mcp-code-indexer.git
96
+ cd mcp-code-indexer
97
+
98
+ # Install in development mode
99
+ pip install -e .
100
+
101
+ # Run the server
102
+ mcp-code-indexer --token-limit 32000
103
+ ```
104
+
105
+ ## ๐Ÿ”ง Development Setup
106
+
107
+ For development work, you **must** install the package in editable mode to ensure proper import resolution:
108
+
109
+ ```bash
110
+ # Setup development environment
111
+ git clone https://github.com/your-username/mcp-code-indexer.git
112
+ cd mcp-code-indexer
113
+
114
+ # Create and activate virtual environment
115
+ python -m venv venv
116
+ source venv/bin/activate # On Windows: venv\Scripts\activate
117
+
118
+ # Install package in editable mode (REQUIRED for development)
119
+ pip install -e .
120
+
121
+ # Install development dependencies
122
+ pip install -e .[dev]
123
+
124
+ # Verify installation
125
+ python main.py --help
126
+ mcp-code-indexer --version
127
+ ```
128
+
129
+ ### Why Editable Install is Required
130
+
131
+ The project uses a proper PyPI package structure with absolute imports like `from mcp_code_indexer.database.database import DatabaseManager`. Without the editable installation (`pip install -e .`), Python cannot resolve these imports and you'll get `ModuleNotFoundError` exceptions.
132
+
133
+ ### Development Workflow
134
+
135
+ ```bash
136
+ # Activate virtual environment
137
+ source venv/bin/activate
138
+
139
+ # Run the server directly
140
+ python main.py --token-limit 32000
141
+
142
+ # Or use the installed CLI command
143
+ mcp-code-indexer --token-limit 32000
144
+
145
+ # Run tests
146
+ python -m pytest tests/ -v
147
+
148
+ # Run with coverage
149
+ python -m pytest tests/ --cov=src --cov-report=html
150
+
151
+ # Format code
152
+ black src/ tests/
153
+ isort src/ tests/
154
+
155
+ # Type checking
156
+ mypy src/
157
+ ```
158
+
159
+ ## ๐Ÿ› ๏ธ MCP Tools Available
160
+
161
+ The server provides **8 powerful MCP tools** for intelligent codebase management:
162
+
163
+ ### Core Operations
164
+ - **`get_file_description`** - Retrieve stored file descriptions instantly
165
+ - **`update_file_description`** - Store detailed file summaries and metadata
166
+ - **`check_codebase_size`** - Get token count and size-based recommendations
167
+
168
+ ### Batch Operations
169
+ - **`find_missing_descriptions`** - Scan projects for files without descriptions
170
+ - **`update_missing_descriptions`** - Bulk update multiple file descriptions
171
+
172
+ ### Search & Discovery
173
+ - **`search_descriptions`** - Fast full-text search across all descriptions
174
+ - **`get_codebase_overview`** - Complete hierarchical project structure
175
+
176
+ ### Advanced Features
177
+ - **`merge_branch_descriptions`** - Two-phase merge with conflict resolution
178
+
179
+ ## ๐Ÿ—๏ธ Architecture Highlights
180
+
181
+ ### Performance Optimized
182
+ - **SQLite with WAL mode** for high-concurrency access
183
+ - **Connection pooling** for efficient database operations
184
+ - **FTS5 full-text search** with prefix indexing
185
+ - **Token-aware caching** to minimize expensive operations
186
+
187
+ ### Production Ready
188
+ - **Comprehensive error handling** with structured JSON logging
189
+ - **Async-first design** with proper resource cleanup
190
+ - **Upstream inheritance** for fork workflows
191
+ - **Git integration** with .gitignore support
192
+
193
+ ### Developer Friendly
194
+ - **95%+ test coverage** with async support
195
+ - **Integration tests** for complete workflows
196
+ - **Performance benchmarks** for large codebases
197
+ - **Clear error messages** with MCP protocol compliance
198
+
199
+ ## ๐Ÿ“– Documentation
200
+
201
+ - **[API Reference](docs/api-reference.md)** - Complete MCP tool documentation
202
+ - **[Configuration Guide](docs/configuration.md)** - Setup and tuning options
203
+ - **[Architecture Overview](docs/architecture.md)** - Technical deep dive
204
+ - **[Contributing Guide](docs/contributing.md)** - Development workflow
205
+
206
+ ## ๐Ÿšฆ System Requirements
207
+
208
+ - **Python 3.8+** with asyncio support
209
+ - **SQLite 3.35+** (included with Python)
210
+ - **4GB+ RAM** for large codebases (1000+ files)
211
+ - **SSD storage** recommended for optimal performance
212
+
213
+ ## ๐Ÿ“Š Performance
214
+
215
+ Tested with codebases up to **10,000 files**:
216
+ - File description retrieval: **< 10ms**
217
+ - Full-text search: **< 100ms**
218
+ - Codebase overview generation: **< 2s**
219
+ - Merge conflict detection: **< 5s**
220
+
221
+ ## ๐Ÿ”ง Advanced Configuration
222
+
223
+ ```bash
224
+ # Production setup with custom limits
225
+ mcp-code-indexer \
226
+ --token-limit 50000 \
227
+ --db-path /data/mcp-index.db \
228
+ --cache-dir /tmp/mcp-cache \
229
+ --log-level INFO
230
+
231
+ # Enable structured logging
232
+ export MCP_LOG_FORMAT=json
233
+ mcp-code-indexer
234
+ ```
235
+
236
+ ## ๐Ÿค Integration Examples
237
+
238
+ ### With AI Agents
239
+ ```python
240
+ # Example: AI agent using MCP tools
241
+ async def analyze_codebase(project_path):
242
+ # Check if codebase is large
243
+ size_info = await mcp_client.call_tool("check_codebase_size", {
244
+ "projectName": "my-project",
245
+ "folderPath": project_path,
246
+ "branch": "main"
247
+ })
248
+
249
+ if size_info["isLarge"]:
250
+ # Use search for large codebases
251
+ results = await mcp_client.call_tool("search_descriptions", {
252
+ "projectName": "my-project",
253
+ "folderPath": project_path,
254
+ "branch": "main",
255
+ "query": "authentication logic"
256
+ })
257
+ else:
258
+ # Get full overview for smaller projects
259
+ overview = await mcp_client.call_tool("get_codebase_overview", {
260
+ "projectName": "my-project",
261
+ "folderPath": project_path,
262
+ "branch": "main"
263
+ })
264
+ ```
265
+
266
+ ### With CI/CD Pipelines
267
+ ```yaml
268
+ # Example: GitHub Actions integration
269
+ - name: Update Code Descriptions
270
+ run: |
271
+ python -c "
272
+ import asyncio
273
+ from mcp_client import MCPClient
274
+
275
+ async def update_descriptions():
276
+ client = MCPClient('mcp-code-indexer')
277
+
278
+ # Find files without descriptions
279
+ missing = await client.call_tool('find_missing_descriptions', {
280
+ 'projectName': '${{ github.repository }}',
281
+ 'folderPath': '.',
282
+ 'branch': '${{ github.ref_name }}'
283
+ })
284
+
285
+ # Process with AI and update...
286
+
287
+ asyncio.run(update_descriptions())
288
+ "
289
+ ```
290
+
291
+ ## ๐Ÿงช Testing
292
+
293
+ ```bash
294
+ # Install with test dependencies
295
+ pip install mcp-code-indexer[test]
296
+
297
+ # Run full test suite
298
+ python -m pytest tests/ -v
299
+
300
+ # Run with coverage
301
+ python -m pytest tests/ --cov=src --cov-report=html
302
+
303
+ # Run performance tests
304
+ python -m pytest tests/ -m performance
305
+
306
+ # Run integration tests only
307
+ python -m pytest tests/integration/ -v
308
+ ```
309
+
310
+ ## ๐Ÿ“ˆ Monitoring
311
+
312
+ The server provides structured JSON logs for monitoring:
313
+
314
+ ```json
315
+ {
316
+ "timestamp": "2024-01-15T10:30:00Z",
317
+ "level": "INFO",
318
+ "message": "Tool search_descriptions completed",
319
+ "tool_usage": {
320
+ "tool_name": "search_descriptions",
321
+ "success": true,
322
+ "duration_seconds": 0.045,
323
+ "result_size": 1247
324
+ }
325
+ }
326
+ ```
327
+
328
+ ## ๐Ÿ›ก๏ธ Security Features
329
+
330
+ - **Input validation** on all MCP tool parameters
331
+ - **SQL injection protection** via parameterized queries
332
+ - **File system sandboxing** with .gitignore respect
333
+ - **Error sanitization** to prevent information leakage
334
+ - **Async resource cleanup** to prevent memory leaks
335
+
336
+ ## ๐Ÿš€ Next Steps
337
+
338
+ 1. **[Read the API docs](docs/api-reference.md)** to understand available tools
339
+ 2. **[Check the configuration guide](docs/configuration.md)** for advanced setup
340
+ 3. **[Review the architecture](docs/architecture.md)** for technical details
341
+ 4. **[Contribute](docs/contributing.md)** to help improve the project
342
+
343
+ ## ๐Ÿค Contributing
344
+
345
+ We welcome contributions! See our **[Contributing Guide](docs/contributing.md)** for:
346
+ - Development setup
347
+ - Code style guidelines
348
+ - Testing requirements
349
+ - Pull request process
350
+
351
+ ## ๐Ÿ“„ License
352
+
353
+ MIT License - see **[LICENSE](LICENSE)** for details.
354
+
355
+ ## ๐Ÿ™ Built With
356
+
357
+ - **[Model Context Protocol](https://github.com/modelcontextprotocol/python-sdk)** - The foundation for tool integration
358
+ - **[tiktoken](https://pypi.org/project/tiktoken/)** - Fast BPE tokenization
359
+ - **[aiosqlite](https://pypi.org/project/aiosqlite/)** - Async SQLite operations
360
+ - **[Pydantic](https://pydantic.dev/)** - Data validation and settings
361
+
362
+ ---
363
+
364
+ **Ready to supercharge your AI agents with intelligent codebase navigation?** ๐Ÿš€ [Install from PyPI](#install-from-pypi) or [explore the API docs](docs/api-reference.md)!
@@ -0,0 +1,309 @@
1
+ # MCP Code Indexer ๐Ÿš€
2
+
3
+ [![PyPI version](https://badge.fury.io/py/mcp-code-indexer.svg)](https://badge.fury.io/py/mcp-code-indexer)
4
+ [![Python](https://img.shields.io/pypi/pyversions/mcp-code-indexer.svg)](https://pypi.org/project/mcp-code-indexer/)
5
+ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ A production-ready **Model Context Protocol (MCP) server** that provides intelligent codebase navigation for AI agents through searchable file descriptions, token-aware overviews, and advanced merge capabilities.
8
+
9
+ ## ๐ŸŽฏ What It Does
10
+
11
+ The MCP Code Indexer solves a critical problem for AI agents working with large codebases: **understanding code structure without repeatedly scanning files**. Instead of reading every file, agents can:
12
+
13
+ - **Query file purposes** instantly with natural language descriptions
14
+ - **Search across codebases** using full-text search
15
+ - **Get intelligent recommendations** based on codebase size (overview vs search)
16
+ - **Merge branch descriptions** with conflict resolution
17
+ - **Inherit descriptions** from upstream repositories automatically
18
+
19
+ Perfect for AI-powered code review, refactoring tools, documentation generation, and codebase analysis workflows.
20
+
21
+ ## โšก Quick Start
22
+
23
+ ### Install from PyPI
24
+
25
+ ```bash
26
+ # Install the package
27
+ pip install mcp-code-indexer
28
+
29
+ # Run the server
30
+ mcp-code-indexer --token-limit 32000
31
+
32
+ # Check version
33
+ mcp-code-indexer --version
34
+ ```
35
+
36
+ ### Install from Source
37
+
38
+ ```bash
39
+ # Clone and setup
40
+ git clone https://github.com/your-username/mcp-code-indexer.git
41
+ cd mcp-code-indexer
42
+
43
+ # Install in development mode
44
+ pip install -e .
45
+
46
+ # Run the server
47
+ mcp-code-indexer --token-limit 32000
48
+ ```
49
+
50
+ ## ๐Ÿ”ง Development Setup
51
+
52
+ For development work, you **must** install the package in editable mode to ensure proper import resolution:
53
+
54
+ ```bash
55
+ # Setup development environment
56
+ git clone https://github.com/your-username/mcp-code-indexer.git
57
+ cd mcp-code-indexer
58
+
59
+ # Create and activate virtual environment
60
+ python -m venv venv
61
+ source venv/bin/activate # On Windows: venv\Scripts\activate
62
+
63
+ # Install package in editable mode (REQUIRED for development)
64
+ pip install -e .
65
+
66
+ # Install development dependencies
67
+ pip install -e .[dev]
68
+
69
+ # Verify installation
70
+ python main.py --help
71
+ mcp-code-indexer --version
72
+ ```
73
+
74
+ ### Why Editable Install is Required
75
+
76
+ The project uses a proper PyPI package structure with absolute imports like `from mcp_code_indexer.database.database import DatabaseManager`. Without the editable installation (`pip install -e .`), Python cannot resolve these imports and you'll get `ModuleNotFoundError` exceptions.
77
+
78
+ ### Development Workflow
79
+
80
+ ```bash
81
+ # Activate virtual environment
82
+ source venv/bin/activate
83
+
84
+ # Run the server directly
85
+ python main.py --token-limit 32000
86
+
87
+ # Or use the installed CLI command
88
+ mcp-code-indexer --token-limit 32000
89
+
90
+ # Run tests
91
+ python -m pytest tests/ -v
92
+
93
+ # Run with coverage
94
+ python -m pytest tests/ --cov=src --cov-report=html
95
+
96
+ # Format code
97
+ black src/ tests/
98
+ isort src/ tests/
99
+
100
+ # Type checking
101
+ mypy src/
102
+ ```
103
+
104
+ ## ๐Ÿ› ๏ธ MCP Tools Available
105
+
106
+ The server provides **8 powerful MCP tools** for intelligent codebase management:
107
+
108
+ ### Core Operations
109
+ - **`get_file_description`** - Retrieve stored file descriptions instantly
110
+ - **`update_file_description`** - Store detailed file summaries and metadata
111
+ - **`check_codebase_size`** - Get token count and size-based recommendations
112
+
113
+ ### Batch Operations
114
+ - **`find_missing_descriptions`** - Scan projects for files without descriptions
115
+ - **`update_missing_descriptions`** - Bulk update multiple file descriptions
116
+
117
+ ### Search & Discovery
118
+ - **`search_descriptions`** - Fast full-text search across all descriptions
119
+ - **`get_codebase_overview`** - Complete hierarchical project structure
120
+
121
+ ### Advanced Features
122
+ - **`merge_branch_descriptions`** - Two-phase merge with conflict resolution
123
+
124
+ ## ๐Ÿ—๏ธ Architecture Highlights
125
+
126
+ ### Performance Optimized
127
+ - **SQLite with WAL mode** for high-concurrency access
128
+ - **Connection pooling** for efficient database operations
129
+ - **FTS5 full-text search** with prefix indexing
130
+ - **Token-aware caching** to minimize expensive operations
131
+
132
+ ### Production Ready
133
+ - **Comprehensive error handling** with structured JSON logging
134
+ - **Async-first design** with proper resource cleanup
135
+ - **Upstream inheritance** for fork workflows
136
+ - **Git integration** with .gitignore support
137
+
138
+ ### Developer Friendly
139
+ - **95%+ test coverage** with async support
140
+ - **Integration tests** for complete workflows
141
+ - **Performance benchmarks** for large codebases
142
+ - **Clear error messages** with MCP protocol compliance
143
+
144
+ ## ๐Ÿ“– Documentation
145
+
146
+ - **[API Reference](docs/api-reference.md)** - Complete MCP tool documentation
147
+ - **[Configuration Guide](docs/configuration.md)** - Setup and tuning options
148
+ - **[Architecture Overview](docs/architecture.md)** - Technical deep dive
149
+ - **[Contributing Guide](docs/contributing.md)** - Development workflow
150
+
151
+ ## ๐Ÿšฆ System Requirements
152
+
153
+ - **Python 3.8+** with asyncio support
154
+ - **SQLite 3.35+** (included with Python)
155
+ - **4GB+ RAM** for large codebases (1000+ files)
156
+ - **SSD storage** recommended for optimal performance
157
+
158
+ ## ๐Ÿ“Š Performance
159
+
160
+ Tested with codebases up to **10,000 files**:
161
+ - File description retrieval: **< 10ms**
162
+ - Full-text search: **< 100ms**
163
+ - Codebase overview generation: **< 2s**
164
+ - Merge conflict detection: **< 5s**
165
+
166
+ ## ๐Ÿ”ง Advanced Configuration
167
+
168
+ ```bash
169
+ # Production setup with custom limits
170
+ mcp-code-indexer \
171
+ --token-limit 50000 \
172
+ --db-path /data/mcp-index.db \
173
+ --cache-dir /tmp/mcp-cache \
174
+ --log-level INFO
175
+
176
+ # Enable structured logging
177
+ export MCP_LOG_FORMAT=json
178
+ mcp-code-indexer
179
+ ```
180
+
181
+ ## ๐Ÿค Integration Examples
182
+
183
+ ### With AI Agents
184
+ ```python
185
+ # Example: AI agent using MCP tools
186
+ async def analyze_codebase(project_path):
187
+ # Check if codebase is large
188
+ size_info = await mcp_client.call_tool("check_codebase_size", {
189
+ "projectName": "my-project",
190
+ "folderPath": project_path,
191
+ "branch": "main"
192
+ })
193
+
194
+ if size_info["isLarge"]:
195
+ # Use search for large codebases
196
+ results = await mcp_client.call_tool("search_descriptions", {
197
+ "projectName": "my-project",
198
+ "folderPath": project_path,
199
+ "branch": "main",
200
+ "query": "authentication logic"
201
+ })
202
+ else:
203
+ # Get full overview for smaller projects
204
+ overview = await mcp_client.call_tool("get_codebase_overview", {
205
+ "projectName": "my-project",
206
+ "folderPath": project_path,
207
+ "branch": "main"
208
+ })
209
+ ```
210
+
211
+ ### With CI/CD Pipelines
212
+ ```yaml
213
+ # Example: GitHub Actions integration
214
+ - name: Update Code Descriptions
215
+ run: |
216
+ python -c "
217
+ import asyncio
218
+ from mcp_client import MCPClient
219
+
220
+ async def update_descriptions():
221
+ client = MCPClient('mcp-code-indexer')
222
+
223
+ # Find files without descriptions
224
+ missing = await client.call_tool('find_missing_descriptions', {
225
+ 'projectName': '${{ github.repository }}',
226
+ 'folderPath': '.',
227
+ 'branch': '${{ github.ref_name }}'
228
+ })
229
+
230
+ # Process with AI and update...
231
+
232
+ asyncio.run(update_descriptions())
233
+ "
234
+ ```
235
+
236
+ ## ๐Ÿงช Testing
237
+
238
+ ```bash
239
+ # Install with test dependencies
240
+ pip install mcp-code-indexer[test]
241
+
242
+ # Run full test suite
243
+ python -m pytest tests/ -v
244
+
245
+ # Run with coverage
246
+ python -m pytest tests/ --cov=src --cov-report=html
247
+
248
+ # Run performance tests
249
+ python -m pytest tests/ -m performance
250
+
251
+ # Run integration tests only
252
+ python -m pytest tests/integration/ -v
253
+ ```
254
+
255
+ ## ๐Ÿ“ˆ Monitoring
256
+
257
+ The server provides structured JSON logs for monitoring:
258
+
259
+ ```json
260
+ {
261
+ "timestamp": "2024-01-15T10:30:00Z",
262
+ "level": "INFO",
263
+ "message": "Tool search_descriptions completed",
264
+ "tool_usage": {
265
+ "tool_name": "search_descriptions",
266
+ "success": true,
267
+ "duration_seconds": 0.045,
268
+ "result_size": 1247
269
+ }
270
+ }
271
+ ```
272
+
273
+ ## ๐Ÿ›ก๏ธ Security Features
274
+
275
+ - **Input validation** on all MCP tool parameters
276
+ - **SQL injection protection** via parameterized queries
277
+ - **File system sandboxing** with .gitignore respect
278
+ - **Error sanitization** to prevent information leakage
279
+ - **Async resource cleanup** to prevent memory leaks
280
+
281
+ ## ๐Ÿš€ Next Steps
282
+
283
+ 1. **[Read the API docs](docs/api-reference.md)** to understand available tools
284
+ 2. **[Check the configuration guide](docs/configuration.md)** for advanced setup
285
+ 3. **[Review the architecture](docs/architecture.md)** for technical details
286
+ 4. **[Contribute](docs/contributing.md)** to help improve the project
287
+
288
+ ## ๐Ÿค Contributing
289
+
290
+ We welcome contributions! See our **[Contributing Guide](docs/contributing.md)** for:
291
+ - Development setup
292
+ - Code style guidelines
293
+ - Testing requirements
294
+ - Pull request process
295
+
296
+ ## ๐Ÿ“„ License
297
+
298
+ MIT License - see **[LICENSE](LICENSE)** for details.
299
+
300
+ ## ๐Ÿ™ Built With
301
+
302
+ - **[Model Context Protocol](https://github.com/modelcontextprotocol/python-sdk)** - The foundation for tool integration
303
+ - **[tiktoken](https://pypi.org/project/tiktoken/)** - Fast BPE tokenization
304
+ - **[aiosqlite](https://pypi.org/project/aiosqlite/)** - Async SQLite operations
305
+ - **[Pydantic](https://pydantic.dev/)** - Data validation and settings
306
+
307
+ ---
308
+
309
+ **Ready to supercharge your AI agents with intelligent codebase navigation?** ๐Ÿš€ [Install from PyPI](#install-from-pypi) or [explore the API docs](docs/api-reference.md)!