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:
Ankur
2026-11-25 13:29:50 +05:30
co-authored by Claude Sonnet 5.5
parent 26e0a3875a
commit e116c4d5a4
45 changed files with 2002 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
# code-search-mcp over HTTP, 2026-07-28: no handshake, no session
## 1. tools/list: the names and input schemas the model will see
< 200
search_code readOnlyHint=true
Find classes and methods by what they do. Ranks by similarity to the query, so describe behaviour rather than guessing an exact name. Use find_usages for callers.
find_usages readOnlyHint=true
List every place a class or method is used, with file, line and the calling method.
get_source readOnlyHint=true
Return the source of one method, so the model reads the body only when it needs it.
## 2. tools/call search_code sent to instance A
> POST /mcp
> MCP-Protocol-Version: 2026-07-28
> Mcp-Method: tools/call
> Mcp-Name: search_code
> {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"search_code","arguments":{"query":"charge the customer's card","k":2},"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"wire-test","version":"1"},"io.modelcontextprotocol/clientCapabilities":{}}}}
< 200
< {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"1. 0.607 PaymentService#charge payments/src/main/java/shop/payments/PaymentService.java:15\n public String charge(String customerId, BigDecimal amount)\n // Charges the customer's card for the given amount and returns the receipt id.\n2. 0.532 PaymentService payments/src/main/java/shop/payments/PaymentService.java:6\n class PaymentService\n // Takes payments from customers and refunds them, through a card gateway."}],"resultType":"complete","_meta":{"io.modelcontextprotocol/serverInfo":{"name":"code-search-mcp","version":"1.0.0"}}}}
## 3. the same call sent to instance B, a separate server that never saw request 2
< 200
same answer text as instance A: true