mcp-code-understanding

codingthefuturewithai/mcp-code-understanding

3.3

If you are the rightful owner of mcp-code-understanding and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Code Understanding MCP Server is designed to provide intelligent context to AI coding assistants by analyzing codebases, both local and remote, and supporting standard MCP-compliant operations.

Tools

Functions exposed to the LLM to take actions

get_repo_file_content

Retrieve file contents or directory listings from a repository. For files, returns the complete file content. For directories, returns a non-recursive listing of immediate files and subdirectories.

PARAMETER GUIDANCE:

  • repo_path: (Required) MUST match the exact format of the original input to clone_repo
    • If you cloned using a GitHub URL (e.g., 'https://github.com/username/repo'), you MUST use that identical URL here
    • If you cloned using a local directory path, you MUST use that identical local path here
    • Mismatched formats will result in 'Repository not found in cache' errors
  • resource_path: (Optional) Path to the target file or directory within the repository. If not provided, it defaults to the repository's root directory.

refresh_repo

Update a previously cloned repository in MCP's cache with latest changes and trigger reanalysis. Use this to ensure analysis is based on latest code.

REQUIRED PARAMETER GUIDANCE:

  • repo_path: MUST match the exact format of the original input to clone_repo
    • If you cloned using a GitHub URL (e.g., 'https://github.com/username/repo'), you MUST use that identical URL here
    • If you cloned using a local directory path, you MUST use that identical local path here
    • Mismatched formats will result in 'Repository not found in cache' errors

clone_repo

Clone a repository into the MCP server's analysis cache and initiate background analysis. Required before using other analysis endpoints like get_source_repo_map.

get_source_repo_map

Retrieve a semantic analysis map of the repository's source code structure, including file hierarchy, functions, classes, and their relationships. Repository must be previously cloned via clone_repo.

REQUIRED PARAMETER GUIDANCE:

  • repo_path: MUST match the exact format of the original input to clone_repo
    • If you cloned using a GitHub URL (e.g., 'https://github.com/username/repo'), you MUST use that identical URL here
    • If you cloned using a local directory path, you MUST use that identical local path here
    • Mismatched formats will result in 'Repository not found in cache' errors

RESPONSE CHARACTERISTICS:

  1. Status Types:
  • "threshold_exceeded": Indicates analysis scope exceeds processing limits
  • "building": Analysis in progress
  • "waiting": Waiting for prerequisite operation
  • "success": Analysis complete
  • "error": Operation failed
  1. Resource Management:
  • Repository size impacts processing time and token usage
  • 'max_tokens' parameter provides approximate control of response size Note: Actual token count may vary slightly above or below specified limit
  • File count threshold exists to prevent overload
  • Processing time scales with both file count and max_tokens Important: Clients should adjust their timeout values proportionally when:
    • Analyzing larger numbers of files
    • Specifying higher max_tokens values
    • Working with complex repositories
  1. Scope Control Options:
  • 'files': Analyze specific files. If only this is provided, the entire repository will be searched for matching file names.
  • 'directories': Analyze all source files within specific directories.
  • If BOTH 'files' and 'directories' are provided, the tool will perform an INTERSECTION, analyzing only the files named in 'files' that are also located within the specified 'directories'.
  1. Response Metadata:
  • Contains processing statistics and limitation details
  • Provides override_guidance when thresholds are exceeded
  • Reports excluded files and completion status

NOTE: This tool supports both broad and focused analysis strategies. Response handling can be adapted based on specific use case requirements and user preferences.

get_repo_structure

Retrieve directory structure and analyzable file counts for a repository to guide analysis decisions.

REQUIRED PARAMETER GUIDANCE:

  • repo_path: MUST match the exact format of the original input to clone_repo
    • If you cloned using a GitHub URL (e.g., 'https://github.com/username/repo'), you MUST use that identical URL here
    • If you cloned using a local directory path, you MUST use that identical local path here
    • Mismatched formats will result in 'Repository not found in cache' errors

RESPONSE CHARACTERISTICS:

  1. Directory Information:
  • Lists directories containing analyzable source code
  • Reports number of analyzable files per directory
  • Shows directory hierarchy
  • Indicates file extensions present in each location
  1. Usage:
  • Requires repository to be previously cloned via clone_repo
  • Helps identify main code directories
  • Supports planning targeted analysis
  • Shows where analyzable code is located

NOTE: Use this tool to understand repository structure and choose which directories to analyze in detail.

get_repo_critical_files

Identify and analyze the most structurally significant files in a repository to guide code understanding efforts.

REQUIRED PARAMETER GUIDANCE:

  • repo_path: MUST match the exact format of the original input to clone_repo
    • If you cloned using a GitHub URL (e.g., 'https://github.com/username/repo'), you MUST use that identical URL here
    • If you cloned using a local directory path, you MUST use that identical local path here
    • Mismatched formats will result in 'Repository not found in cache' errors

RESPONSE CHARACTERISTICS:

  1. Analysis Metrics:

    • Calculates importance scores based on:
      • Function count (weight: 2.0)
      • Total cyclomatic complexity (weight: 1.5)
      • Maximum cyclomatic complexity (weight: 1.2)
      • Lines of code (weight: 0.05)
    • Provides detailed metrics per file
    • Ranks files by composite importance score
  2. Resource Management:

    • Repository must be previously cloned via clone_repo
    • Analysis performed on-demand using Lizard
    • Efficient for both small and large codebases
    • Supports both full-repo and targeted analysis
  3. Scope Control Options:

    • 'files': Analyze specific files. If only this is provided, the entire repository will be searched for matching file names.
    • 'directories': Analyze all source files within specific directories.
    • If BOTH 'files' and 'directories' are provided, the tool will perform an INTERSECTION, analyzing only the files named in 'files' that are also located within the specified 'directories'.
    • 'limit': Control maximum results returned.
  4. Response Metadata:

    • Total files analyzed
    • Analysis completion status

NOTE: This tool is designed to guide initial codebase exploration by identifying structurally significant files. Results can be used to target subsequent get_source_repo_map calls for detailed analysis.

get_repo_documentation

Retrieve and analyze documentation files from a repository, including README files, API docs, design documents, and other documentation. Repository must be previously cloned via clone_repo.

REQUIRED PARAMETER GUIDANCE:

  • repo_path: MUST match the exact format of the original input to clone_repo
    • If you cloned using a GitHub URL (e.g., 'https://github.com/username/repo'), you MUST use that identical URL here
    • If you cloned using a local directory path, you MUST use that identical local path here
    • Mismatched formats will result in 'Repository not found in cache' errors

Prompts

Interactive templates invoked by user choice

No prompts

Resources

Contextual data attached and managed by the client

No resources