Skip to content

Commit 89f03e5

Browse files
committed
Update documentation and complete Java file support integration
This commit includes: 1. Java file support integration from PR johnhuang316#9: - Add comprehensive Java analysis in get_file_summary function - Support for packages, classes, interfaces, enums, and methods - Resolved merge conflicts while preserving master branch features 2. Documentation updates: - Fix Python version requirement from 3.8+ to 3.10+ in all READMEs - Update tool name from search_code to search_code_advanced - Add regex search documentation with ReDoS protection details - Enhanced Java file analysis descriptions - Create comprehensive Japanese README (README_ja.md) 3. Technical improvements: - Maintain all master branch regex search functionality - Preserve improved glob pattern handling for ag backend - Keep ReDoS protection and safety validation All changes ensure consistency across English, Chinese, and Japanese documentation while integrating Java parsing capabilities without losing existing features.
1 parent 7847d25 commit 89f03e5

File tree

3 files changed

+314
-12
lines changed

3 files changed

+314
-12
lines changed

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div align="center">
44

55
[![MCP Server](https://img.shields.io/badge/MCP-Server-blue)](https://modelcontextprotocol.io)
6-
[![Python](https://img.shields.io/badge/Python-3.8%2B-green)](https://www.python.org/)
6+
[![Python](https://img.shields.io/badge/Python-3.10%2B-green)](https://www.python.org/)
77
[![License](https://img.shields.io/badge/License-MIT-yellow)](LICENSE)
88

99
A Model Context Protocol server for code indexing, searching, and analysis.
@@ -24,8 +24,11 @@ This server integrates with the [Model Context Protocol](https://modelcontextpro
2424

2525
- **Project Indexing**: Recursively scans directories to build a searchable index of code files
2626
- **Advanced Search**: Intelligent search with automatic detection of ugrep, ripgrep, ag, or grep for enhanced performance
27-
- **Fuzzy Search**: Native fuzzy matching with ugrep, or safe fuzzy patterns for other tools
28-
- **File Analysis**: Get detailed insights about file structure, imports, and complexity
27+
- **Regex Search**: Full regex pattern matching with safety validation to prevent ReDoS attacks
28+
- **Fuzzy Search**: Native fuzzy matching with ugrep, or word boundary patterns for other tools
29+
- **File Analysis**: Get detailed insights about file structure, imports, classes, methods, and complexity
30+
- **Java Support**: Comprehensive analysis including packages, classes, interfaces, enums, and methods
31+
- **Python/JavaScript Support**: Functions, classes, and import analysis
2932
- **Smart Filtering**: Automatically ignores build directories, dependencies, and non-code files
3033
- **Persistent Storage**: Caches indexes for improved performance across sessions
3134
- **Lazy Loading**: Search tools are detected only when needed for optimal startup performance
@@ -67,7 +70,7 @@ There are several ways to set up and use Code Index MCP, depending on your needs
6770

6871
This is the easiest and most common way to use the server. It's designed for users who want to use Code Index MCP within an AI application like Claude Desktop.
6972

70-
1. **Prerequisite**: Make sure you have Python 3.8+ and [uv](https://github.com/astral-sh/uv) installed.
73+
1. **Prerequisite**: Make sure you have Python 3.10+ and [uv](https://github.com/astral-sh/uv) installed.
7174

7275
2. **Configure the Host App**: Add the following to your host application's MCP configuration file.
7376

@@ -153,7 +156,7 @@ If you prefer to manage your Python packages manually with `pip`, you can instal
153156
### Core Tools
154157

155158
- **set_project_path**: Sets the base project path for indexing.
156-
- **search_code**: Enhanced search using external tools (ugrep/ripgrep/ag/grep) with fuzzy matching support.
159+
- **search_code_advanced**: Enhanced search using external tools (ugrep/ripgrep/ag/grep) with regex and fuzzy matching support.
157160
- **find_files**: Finds files in the project matching a given pattern.
158161
- **get_file_summary**: Gets a summary of a specific file, including line count, functions, imports, etc.
159162
- **refresh_index**: Refreshes the project index.
@@ -223,11 +226,16 @@ Search for all occurrences of the "processData" function.
223226
I'm looking for a function related to user authentication, it might be named 'authUser', 'authenticateUser', or something similar. Can you do a fuzzy search for 'authUser'?
224227
```
225228
229+
**Example: Search with Regular Expressions**
230+
```
231+
Search for all function calls that match the pattern "get.*Data" using regex.
232+
```
233+
226234
**Example: Search within Specific Files**
227235
```
228236
Search for the string "API_ENDPOINT" only in Python files.
229237
```
230-
*(The assistant would use the `search_code` tool with the `file_pattern` parameter set to `*.py`)*
238+
*(The assistant would use the `search_code_advanced` tool with the `file_pattern` parameter set to `*.py`)*
231239
232240
## Development
233241

README_ja.md

Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
1+
# Code Index MCP
2+
3+
<div align="center">
4+
5+
[![MCP Server](https://img.shields.io/badge/MCP-Server-blue)](https://modelcontextprotocol.io)
6+
[![Python](https://img.shields.io/badge/Python-3.10%2B-green)](https://www.python.org/)
7+
[![License](https://img.shields.io/badge/License-MIT-yellow)](LICENSE)
8+
9+
コードのインデックス作成、検索、解析のためのModel Context Protocol(MCP)サーバー。
10+
11+
</div>
12+
13+
<a href="https://glama.ai/mcp/servers/@johnhuang316/code-index-mcp">
14+
<img width="380" height="200" src="https://glama.ai/mcp/servers/@johnhuang316/code-index-mcp/badge" alt="code-index-mcp MCP server" />
15+
</a>
16+
17+
## Code Index MCPとは?
18+
19+
Code Index MCPは、インテリジェントなコードインデックス作成と解析機能を提供する専用のMCPサーバーです。大規模言語モデルがあなたのコードリポジトリと対話し、複雑なコードベースに対するリアルタイムの洞察とナビゲーションを提供することを可能にします。
20+
21+
このサーバーは、AIモデルが外部ツールやデータソースと対話するための標準化された方法である[Model Context Protocol](https://modelcontextprotocol.io)(MCP)と統合されています。
22+
23+
## 主な機能
24+
25+
- **プロジェクトインデックス作成**: ディレクトリを再帰的にスキャンして、検索可能なコードファイルのインデックスを構築
26+
- **高度な検索**: ugrep、ripgrep、ag、grepの自動検出による高性能なインテリジェント検索
27+
- **正規表現検索**: ReDoS攻撃を防ぐための安全性検証を備えた完全な正規表現パターンマッチング
28+
- **ファジー検索**: ugrepのネイティブファジーマッチング、または他のツールでの単語境界パターンマッチング
29+
- **ファイル解析**: ファイル構造、インポート、クラス、メソッド、複雑さに関する詳細な洞察を取得
30+
- **Javaサポート**: パッケージ、クラス、インターフェース、列挙型、メソッドを含む包括的な解析
31+
- **Python/JavaScriptサポート**: 関数、クラス、インポートの解析
32+
- **スマートフィルタリング**: ビルドディレクトリ、依存関係、非コードファイルを自動的に無視
33+
- **永続ストレージ**: セッション間でのパフォーマンス向上のためにインデックスをキャッシュ
34+
- **遅延ロード**: 最適な起動パフォーマンスのために、必要な時のみ検索ツールを検出
35+
36+
## サポートされているファイルタイプ
37+
38+
サーバーは複数のプログラミング言語とファイル拡張子をサポートしています:
39+
40+
- Python (.py)
41+
- JavaScript/TypeScript (.js, .ts, .jsx, .tsx, .mjs, .cjs)
42+
- フロントエンドフレームワーク (.vue, .svelte, .astro)
43+
- Java (.java)
44+
- C/C++ (.c, .cpp, .h, .hpp)
45+
- C# (.cs)
46+
- Go (.go)
47+
- Ruby (.rb)
48+
- PHP (.php)
49+
- Swift (.swift)
50+
- Kotlin (.kt)
51+
- Rust (.rs)
52+
- Scala (.scala)
53+
- シェルスクリプト (.sh, .bash)
54+
- Zig (.zig)
55+
- Webファイル (.html, .css, .scss, .less, .sass, .stylus, .styl)
56+
- テンプレートエンジン (.hbs, .handlebars, .ejs, .pug)
57+
- **データベース & SQL**:
58+
- SQLファイル (.sql, .ddl, .dml)
59+
- データベース固有 (.mysql, .postgresql, .psql, .sqlite, .mssql, .oracle, .ora, .db2)
60+
- データベースオブジェクト (.proc, .procedure, .func, .function, .view, .trigger, .index)
61+
- マイグレーション & ツール (.migration, .seed, .fixture, .schema, .liquibase, .flyway)
62+
- NoSQL & モダン (.cql, .cypher, .sparql, .gql)
63+
- ドキュメント/設定 (.md, .mdx, .json, .xml, .yml, .yaml)
64+
65+
## セットアップと統合
66+
67+
ニーズに応じて、Code Index MCPをセットアップして使用する方法がいくつかあります。
68+
69+
### ホストアプリケーションでの一般使用(推奨)
70+
71+
これは最も簡単で一般的な使用方法です。Claude DesktopなどのAIアプリケーション内でCode Index MCPを使用したいユーザー向けに設計されています。
72+
73+
1. **前提条件**: Python 3.10+と[uv](https://github.com/astral-sh/uv)がインストールされていることを確認してください。
74+
75+
2. **ホストアプリの設定**: ホストアプリケーションのMCP設定ファイルに以下を追加してください。
76+
77+
*Claude Desktop* -> `claude_desktop_config.json`
78+
79+
*Claude Code* -> `~/.claude.json`。プロジェクトごとに1つの`mcpServers`とグローバルに1つがあります
80+
81+
```json
82+
{
83+
"mcpServers": {
84+
"code-index": {
85+
"command": "uvx",
86+
"args": [
87+
"code-index-mcp"
88+
]
89+
}
90+
}
91+
}
92+
```
93+
94+
3. **ホストアプリの再起動**: 設定を追加した後、アプリケーションを再起動してください。`uvx`コマンドがバックグラウンドで`code-index-mcp`サーバーのインストールと実行を自動的に処理します。
95+
96+
### ローカル開発用
97+
98+
このプロジェクトの開発に貢献したい場合は、以下の手順に従ってください:
99+
100+
1. **リポジトリをクローン**:
101+
```bash
102+
git clone https://github.com/johnhuang316/code-index-mcp.git
103+
cd code-index-mcp
104+
```
105+
106+
2. **依存関係をインストール** `uv`を使用:
107+
```bash
108+
uv sync
109+
```
110+
111+
3. **ローカル開発用にホストアプリを設定**: ホストアプリケーション(例:Claude Desktop)がローカルのソースコードを使用するように、設定ファイルを更新して`uv run`経由でサーバーを実行します。これにより、コードに加えた変更がホストアプリがサーバーを起動する際に即座に反映されます。
112+
113+
```json
114+
{
115+
"mcpServers": {
116+
"code-index": {
117+
"command": "uv",
118+
"args": [
119+
"run",
120+
"code_index_mcp"
121+
]
122+
}
123+
}
124+
}
125+
```
126+
127+
4. **MCP Inspectorでデバッグ**: ローカルサーバーをデバッグするには、インスペクターにも`uv run`を使用するよう指示する必要があります。
128+
```bash
129+
npx @modelcontextprotocol/inspector uv run code_index_mcp
130+
```
131+
132+
### pipによる手動インストール(代替方法)
133+
134+
`pip`でPythonパッケージを手動管理したい場合は、サーバーを直接インストールできます。
135+
136+
1. **パッケージをインストール**:
137+
```bash
138+
pip install code-index-mcp
139+
```
140+
141+
2. **ホストアプリを設定**: ホストアプリケーションのMCP設定を手動で更新して、インストールされたスクリプトを指すようにする必要があります。`"command": "uvx"`を`"command": "code-index-mcp"`に置き換えてください。
142+
143+
```json
144+
{
145+
"mcpServers": {
146+
"code-index": {
147+
"command": "code-index-mcp",
148+
"args": []
149+
}
150+
}
151+
}
152+
```
153+
154+
## 利用可能なツール
155+
156+
### コアツール
157+
158+
- **set_project_path**: インデックス作成用のベースプロジェクトパスを設定します。
159+
- **search_code_advanced**: 外部ツール(ugrep/ripgrep/ag/grep)を使用した拡張検索で、正規表現とファジーマッチングをサポート。
160+
- **find_files**: プロジェクト内で指定されたパターンにマッチするファイルを検索します。
161+
- **get_file_summary**: 行数、関数、インポートなどを含む特定ファイルの要約を取得します。
162+
- **refresh_index**: プロジェクトインデックスを更新します。
163+
- **get_settings_info**: プロジェクト設定に関する情報を取得します。
164+
165+
### ユーティリティツール
166+
167+
- **create_temp_directory**: インデックスデータの保存に使用される一時ディレクトリを作成します。
168+
- **check_temp_directory**: インデックスデータの保存に使用される一時ディレクトリをチェックします。
169+
- **clear_settings**: すべての設定とキャッシュデータをクリアします。
170+
- **refresh_search_tools**: 利用可能なコマンドライン検索ツール(ripgrepなど)を手動で再検出します。
171+
172+
## 一般的なワークフローと例
173+
174+
ClaudeなどのAIアシスタントでCode Index MCPを使用する典型的なワークフローです。
175+
176+
### 1. プロジェクトパスの設定と初期インデックス作成
177+
178+
これは最初の最も重要なステップです。プロジェクトパスを設定すると、サーバーは初回のファイルインデックスを自動的に作成するか、以前にキャッシュされたものを読み込みます。
179+
180+
**プロンプト例:**
181+
```
182+
プロジェクトパスを C:\Users\username\projects\my-react-app に設定してください
183+
```
184+
185+
### 2. インデックスの更新(必要に応じて)
186+
187+
初期設定後にプロジェクトファイルに大幅な変更を加えた場合、手動でインデックスを更新して、すべてのツールが最新の情報で動作するようにできます。
188+
189+
**プロンプト例:**
190+
```
191+
いくつかの新しいコンポーネントを追加したので、プロジェクトインデックスを更新してください。
192+
```
193+
*(アシスタントは`refresh_index`ツールを使用します)*
194+
195+
### 3. プロジェクト構造の探索
196+
197+
インデックスの準備ができたら、パターン(グロブ)を使用してファイルを検索し、コードベースを理解して関連ファイルを見つけることができます。
198+
199+
**プロンプト例:**
200+
```
201+
'src/components'ディレクトリ内のすべてのTypeScriptコンポーネントファイルを検索してください。
202+
```
203+
*(アシスタントは`src/components/**/*.tsx`のようなパターンで`find_files`ツールを使用します)*
204+
205+
### 4. 特定ファイルの解析
206+
207+
ファイルの完全な内容に詳しく入る前に、関数、クラス、インポートを含む構造の簡単な要約を取得できます。
208+
209+
**プロンプト例:**
210+
```
211+
'src/api/userService.ts'ファイルの要約を教えてください。
212+
```
213+
*(アシスタントは`get_file_summary`ツールを使用します)*
214+
215+
### 5. コードの検索
216+
217+
最新のインデックスがあれば、コードスニペット、関数名、または任意のテキストパターンを検索して、特定のロジックが実装されている場所を見つけることができます。
218+
219+
**例: シンプル検索**
220+
```
221+
"processData"関数のすべての出現箇所を検索してください。
222+
```
223+
224+
**例: ファジーマッチング検索**
225+
```
226+
ユーザー認証に関連する関数を探しています。'authUser'、'authenticateUser'、または類似の名前かもしれません。'authUser'でファジー検索できますか?
227+
```
228+
229+
**例: 正規表現検索**
230+
```
231+
正規表現を使用して、パターン"get.*Data"にマッチするすべての関数呼び出しを検索してください。
232+
```
233+
234+
**例: 特定ファイル内の検索**
235+
```
236+
Pythonファイル内のみで文字列"API_ENDPOINT"を検索してください。
237+
```
238+
*(アシスタントは`file_pattern`パラメータを`*.py`に設定して`search_code_advanced`ツールを使用します)*
239+
240+
## 開発
241+
242+
### ソースからのビルド
243+
244+
1. リポジトリをクローン:
245+
246+
```bash
247+
git clone https://github.com/username/code-index-mcp.git
248+
cd code-index-mcp
249+
```
250+
251+
2. 依存関係をインストール:
252+
253+
```bash
254+
uv sync
255+
```
256+
257+
3. サーバーをローカルで実行:
258+
259+
```bash
260+
uv run code_index_mcp
261+
```
262+
263+
## デバッグ
264+
265+
MCP inspectorを使用してサーバーをデバッグできます:
266+
267+
```bash
268+
npx @modelcontextprotocol/inspector uvx code-index-mcp
269+
```
270+
271+
## ライセンス
272+
273+
[MIT License](LICENSE)
274+
275+
## 貢献
276+
277+
貢献を歓迎します!プルリクエストをお気軽に提出してください。
278+
279+
## 言語
280+
281+
- [English](README.md)
282+
- [繁體中文](README_zh.md)
283+
284+
---
285+
286+
*この日本語READMEは[Claude Code](https://claude.ai/code)で作成されました 🤖*

0 commit comments

Comments
 (0)