Skip to main content
Glama

EN 中文

Code Search MCP Server

High-performance, batch-oriented MCP (Model Context Protocol) code understanding toolkit for AI agents, specially optimized for Java.

Designed to solve the challenge where AI agents get "lost" in large codebases or lack precise context. It focuses on deep parsing, parallel batch processing, and panoramic context to explore large codebases efficiently, significantly reducing token usage while improving logical understanding.

Use Cases

  • Panoramic Context: Read multiple files in one call with dependency context auto-expanded.

  • Structural Mapping: Build project outlines fast with deep Java annotation awareness.

  • Precise Surgery: Precisely locate classes/methods/definitions and return in batch.

Related MCP server: Knowledge Graph MCP Server

Core Tools

Tool

Capability

Notes

view_files_full_context

Panoramic context

Batch read with dependency + model field expansion

view_files_outlines

Structural outline

Batch outline extraction with Java annotation awareness

view_code_items

Precise location

Batch locate classes/methods/definitions

Design Notes

  • stdio transport: JSON-RPC 2.0 via standard I/O.

  • Deterministic protocol: absolute paths only, no path wildcards.

  • Java outline enhancement: annotation backtracking merged into signatures.

Java Spring Deep Fit

More than just text search, it understands business logic:

  • Layer-Aware Ordering: Intelligent sorting (Controller → Service → Impl → MQ → Repository) so AI understands the business flow immediately.

  • Deep Annotation-Awareness: Instead of just seeing signatures, AI sees merged annotations (like @Transactional, @PreAuthorize) to understand business semantics.

  • Smart DI Parsing: Automatically identifies injected fields (dependencies), eliminating the need for AI to guess where userService comes from.

  • Project Structure: Full support for src/main/java and multi-module Maven/Gradle projects.

Requirements

  • Node.js v18.0.0 or later

Install & Build

npm install
npm run build

Integration

"mcpServers": {
  "code-search": {
    "command": "node",
    "args": ["{file}/code-search/index.js"]
  }
}

Tips

  • Prefer view_files_full_context for full context in one call.

  • Absolute paths are required for stability and reproducibility.

  • Complex queries should be split into precise calls.

Open Source

This project is open-sourced under the MIT License. You may use, modify, and distribute it under the license terms.

Available Tools

3 tools
view_code_itemsA

[Precise Code Retrieval] Best for cases where the file path and item name are known. Batch returns full definition blocks for classes/methods/functions. If the input is a Java interface and implementations exist, it will attempt to traverse to Impl classes and return same-named method snippets (multiple implementations are supported and labeled). It also parses fields referenced in the method snippet to infer their type-to-class paths. Ideal for interface/implementation comparison, fast location of key methods, and precise extraction before call-chain analysis; if the path or name is unknown, use file search tools first.

ParametersJSON Schema
NameRequiredDescriptionDefault
ItemsYesList of code items to query.

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: batch processing, traversal to implementation classes for Java interfaces, support for multiple implementations with labeling, parsing of referenced fields to infer type-to-class paths, and specific use cases. It doesn't mention error handling or performance characteristics, keeping it from a perfect score.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose in the first sentence. Every sentence adds value: the second explains advanced features, the third states ideal use cases and alternatives. Minor deduction for slightly dense phrasing in the middle sentence.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (with traversal, parsing, and batch features), no annotations, and no output schema, the description does well to cover purpose, usage, and key behaviors. It could be more complete by hinting at return format or error cases, but it provides substantial context for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the single parameter 'Items' as an array of objects with 'File' and 'ItemName'. The description adds context about what constitutes valid inputs ('Absolute path', 'Exact name') and examples, but doesn't provide additional syntax or format details beyond what the schema implies. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('retrieval', 'returns', 'parses') and resources ('full definition blocks for classes/methods/functions', 'method snippets', 'fields referenced'). It distinguishes from siblings by specifying this is for 'precise retrieval' when file path and item name are known, unlike file search tools mentioned.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use ('Best for cases where the file path and item name are known', 'Ideal for interface/implementation comparison, fast location of key methods, and precise extraction before call-chain analysis') and when not to use ('if the path or name is unknown, use file search tools first'), including clear alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

view_files_full_contextA

Code analysis tool with 'Panoramic Vision'. Optimized for Java/Spring to provide a bird's-eye view across multiple files. Key Effects:

  1. [Dependency Transparency]: Automatically lists injected components (Service/Mapper/MQ) and resolves local imports to absolute paths.

  2. [Model Auto-Expansion]: For any DTO/Entity/VO imported in the current file, it automatically extracts their fields and comments. You don't need to open those files separately to understand the data structure.

  3. [Logic Flow Alignment]: Auto-sorts files by architectural role (Controller -> Service -> Mapper) to follow the business call chain.

  4. [API Outline]: Provides method outlines for dependencies to understand their interface at a glance. Tips: (1) Batch related files (e.g. Controller+ServiceImpl) in one call. (2) NOT recommended to read DTO/VO/Entity/Query individually as they are auto-expanded when reading their consumers.

ParametersJSON Schema
NameRequiredDescriptionDefault
AbsolutePathsYesAbsolute paths of files to analyze.
StartLineNo
EndLineNo

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: automatic listing of injected components, resolution of imports, auto-expansion of model fields and comments, architectural sorting of files, and API outline generation. However, it lacks details on error handling, performance implications, or output format specifics, which prevents a perfect score.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with bullet points and tips, making it easy to scan. However, it could be more concise by integrating the tips into the main points and avoiding marketing phrases like 'Panoramic Vision'. Every sentence adds value, but some redundancy exists in explaining auto-expansion benefits.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of the tool (multi-file code analysis with automatic expansions), no annotations, and no output schema, the description does a good job covering key functionalities and usage. However, it lacks details on output format, error cases, or limitations (e.g., file size constraints), which would enhance completeness for such a sophisticated tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is low (33%), with only AbsolutePaths having a description. The tool description does not explain what AbsolutePaths, StartLine, or EndLine parameters mean or how they affect the analysis. It mentions analyzing 'multiple files' and 'batch related files', which loosely relates to AbsolutePaths, but adds minimal semantic value beyond the schema's basic documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool performs 'code analysis' with 'Panoramic Vision' to provide a 'bird's-eye view across multiple files', specifically optimized for Java/Spring. It distinguishes from siblings by emphasizing multi-file analysis with automatic dependency resolution and model expansion, unlike view_code_items or view_files_outlines which likely focus on single-file or structural overviews.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool vs alternatives: it recommends batching related files (e.g., Controller+ServiceImpl) in one call and explicitly advises NOT to read DTO/VO/Entity/Query files individually since they are auto-expanded when reading their consumers. This clearly differentiates usage from sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

view_files_outlinesA

[Deep Code Insight] Batch extraction of file structural outlines. The best tool for exploring global project structures, enhanced for Java with Spring annotation parsing (e.g., identifying API routes, Service components). Use this to concurrently fetch outlines for multiple files when building project maps, tracing interface logic, or performing large-scale code reviews.

ParametersJSON Schema
NameRequiredDescriptionDefault
AbsolutePathsYesList of absolute paths for target files.

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds useful context about batch extraction, enhanced Java/Spring parsing, and concurrency, but does not cover critical aspects like performance characteristics, error handling, rate limits, or authentication needs. It adequately describes the operation but lacks depth on behavioral traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with a clear purpose and key features. Every sentence adds value, but it could be slightly more concise by avoiding redundancy (e.g., 'exploring global project structures' and 'building project maps' are similar). Overall, it's efficient with minimal waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (batch extraction with enhanced parsing), no annotations, and no output schema, the description is moderately complete. It covers the purpose, usage context, and some behavioral insights, but lacks details on output format, error cases, or limitations. It's adequate but has clear gaps for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting the single parameter 'AbsolutePaths'. The description adds no specific parameter semantics beyond what the schema provides, such as format examples or constraints. With high schema coverage, the baseline score of 3 is appropriate as the description does not compensate but relies on the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('batch extraction', 'fetch outlines') and resources ('file structural outlines', 'multiple files'), and distinguishes it from siblings by mentioning its focus on exploring global project structures and enhanced Java/Spring parsing capabilities, unlike the more granular view_code_items or comprehensive view_files_full_context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('exploring global project structures', 'building project maps', 'tracing interface logic', 'large-scale code reviews') and implies it's for batch processing of multiple files. However, it does not explicitly state when not to use it or name specific alternatives beyond the general sibling tools, missing explicit exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A4/5.0
Disambiguation4/5

The tools have distinct primary purposes: view_code_items for precise retrieval of known items, view_files_full_context for panoramic analysis with auto-expansion, and view_files_outlines for structural exploration. However, view_files_full_context and view_files_outlines both involve file-level analysis and could be confused in some scenarios, though their descriptions clarify different focuses (context vs. outlines).

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with 'view_' prefix and descriptive suffixes (code_items, files_full_context, files_outlines). The naming is uniform and predictable, making it easy to understand the tool set's structure at a glance.

Tool Count4/5

With 3 tools, the count is appropriate for a code search server, covering precise retrieval, contextual analysis, and structural outlines. It is slightly lean but reasonable, as each tool serves a clear and distinct function without obvious redundancy, though a few more specialized tools might enhance coverage.

Completeness3/5

The tools cover key aspects of code search and analysis, including retrieval, context, and structure, but there are notable gaps. For example, there is no tool for searching code by content (e.g., text search) or for updating/modifying code, which are common in code-related workflows. The surface is functional but incomplete for a full code interaction domain.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    F
    maintenance
    A high-performance CLI tool that provides semantic code search, advanced architectural analysis, and codebase indexing with vector embeddings across multiple programming languages. Enables AI assistants to understand and navigate large codebases through graph-based relationships and intelligent code pattern detection.
    872
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables fast semantic code search and analysis across 15+ programming languages. Supports searching for functions and classes, tracing code usage, detecting syntax errors, and analyzing code quality and structure.
    34
    33
    GPL 3.0
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables LLMs to perform high-performance code search and analysis across multiple languages using symbol indexing, regex text search, and structural AST pattern matching. It also provides tools for technology stack detection and dependency analysis with persistent caching for optimized performance.
    7

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/raintear94/code-search-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server