Add code-search-mcp module: JavaParser index, swappable embedder and three MCP tools on the 2026-07-28 stateless spec (MCP Java SDK 2.2.0)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6BHcz4muRH44T3br3
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
26e0a3875a
commit
e116c4d5a4
@@ -0,0 +1,23 @@
|
||||
# code-search-mcp
|
||||
|
||||
A code-search MCP server for a Java monorepo, on the stateless MCP 2026-07-28 spec. JavaParser turns every
|
||||
`src/main/java` folder under a root into one unit per type and method; an `Embedder` turns each unit into a vector;
|
||||
three read-only tools (`search_code`, `find_usages`, `get_source`) are served over Streamable HTTP at `/mcp`.
|
||||
|
||||
```bash
|
||||
export JAVA_HOME=/path/to/jdk-25
|
||||
mvn test -pl code-search-mcp # tests write output/01..09
|
||||
bash code-search-mcp/scripts/run-all.sh # also packages the jar and writes output/10 with curl
|
||||
java -jar code-search-mcp/target/code-search-mcp.jar <monorepo-root> [port]
|
||||
```
|
||||
|
||||
| Class | Role |
|
||||
|---|---|
|
||||
| `CodeIndexer` | JavaParser + one `CombinedTypeSolver` over every module's source folder |
|
||||
| `Embedder`, `HashingEmbedder`, `OpenAiCompatibleEmbedder` | the seam: offline word-overlap vectors, or any `/v1/embeddings` endpoint |
|
||||
| `VectorIndex` | brute-force cosine search |
|
||||
| `UsageFinder` | name match vs symbol-solved usages, unresolved candidates kept and flagged |
|
||||
| `CodeSearchTools`, `CodeSearchServer`, `Main` | the three MCP tools, Jetty wiring, the entry point |
|
||||
|
||||
`sample-monorepo/` is the four-module shop the tests index. It is deliberately not part of the build.
|
||||
`output/` holds the transcripts the tests and `scripts/curl-demo.sh` write; the post quotes them verbatim.
|
||||
Reference in New Issue
Block a user