MCP.so
ログイン

Easy Code Reader

@FangYuan33

Easy Code Reader について

一个强大的 MCP (Model Context Protocol) 服务器,用于智能读取 Java 源代码。支持从 Maven 依赖和本地项目中提取源码,配备双反编译器(CFR/Fernflower)自动选择机制,智能处理 SNAPSHOT 版本,完美支持多模块项目,让 AI 助手能够深入理解你的 Java 代码库。

基本情報

カテゴリ

開発者ツール

トランスポート

stdio

公開者

FangYuan33

投稿者

方圆

設定

以下の設定を使って、このサーバーを MCP 対応クライアントに追加してください。

{
  "mcpServers": {
    "easy-code-reader": {
      "command": "uvx",
      "args": [
        "easy-code-reader",
        "--maven-repo",
        "/custom/path/to/maven/repository",
        "--project-dir",
        "/path/to/projects"
      ],
      "env": {}
    }
  }
}

ツール

4

从 Maven 依赖中读取 Java 类的源代码。工作流程:1) 首先尝试从 -sources.jar 中提取原始源代码;2) 如果 sources jar 不存在,自动使用反编译器(CFR 或 Fernflower)反编译 class 文件。支持 SNAPSHOT 版本的智能处理,会自动查找带时间戳的最新版本。适用场景:阅读第三方库源码(如 Spring、MyBatis)、理解依赖实现细节、排查依赖相关问题。注意:需要提供完整的 Maven 坐标(group_id、artifact_id、version)和完全限定的类名(如 org.springframework.core.SpringVersion)。

从本地项目目录中读取指定文件的源代码。支持两种输入格式:1) 完全限定的类名(如 com.example.service.UserService);2) 相对路径(如 src/main/java/com/example/MyClass.java 或 core/src/main/java/com/example/MyClass.java)。自动支持多模块 Maven/Gradle 项目,会递归搜索子模块中的文件。搜索策略:优先在项目根目录查找,如果未找到则自动在所有子模块(包含 pom.xml 或 build.gradle 的目录)中搜索。适用场景:阅读本地项目源码、分析项目结构、理解业务逻辑实现。推荐流程:先使用 list_all_project 确认项目存在 → 使用 list_project_files 查看文件列表 → 使用本工具读取具体文件。

列举项目目录下所有的项目文件夹名称。返回项目目录中所有子目录的名称列表(自动过滤隐藏目录如 .git)。适用场景:1) 探索未知的项目目录,了解有哪些项目可用;2) 验证项目名称是否正确,避免拼写错误;3) 当用户提供不完整的项目名时,帮助推断完整名称。推荐使用:这是探索本地项目的第一步,先用此工具获取所有项目列表,再使用 list_project_files 查看具体项目的文件结构。返回格式:包含项目目录路径、项目总数和项目名称列表的 JSON 对象。

列出 Java 项目中的源代码文件和配置文件路径。支持两种模式:1) 列出整个项目的所有文件;2) 指定子目录(如 'core' 或 'address/src/main/java')仅列出该目录下的文件。返回相对路径列表,已自动过滤测试目录(src/test)、编译产物(target/build)和 IDE 配置等无关文件。适合在阅读代码前先了解项目结构,或当项目文件过多时聚焦特定模块。

概要

What is Easy Code Reader?

Easy Code Reader is an MCP (Model Context Protocol) server for intelligently reading Java source code. It extracts source code from Maven dependencies and local projects, equips dual decompilers (CFR/Fernflower) with auto-selection, handles SNAPSHOT versions intelligently, and supports multi-module projects. It is designed for AI assistants to deeply understand Java codebases.

How to use Easy Code Reader?

Install uv and configure your MCP client with the command uvx easy-code-reader along with the --maven-repo (local Maven repository path) and --project-dir (projects root directory) arguments. Alternatively, install it locally with uv tool install easy-code-reader and point the MCP client to the installed binary.

Key features of Easy Code Reader

  • Reads Java source from Maven dependencies and local projects.
  • Dual decompiler support (CFR/Fernflower) with automatic selection.
  • Intelligent SNAPSHOT version handling with timestamp resolution.
  • Smart caching mechanism for decompiled class files.
  • Lists projects and project files with fuzzy matching.
  • Filters out test, build, and IDE files automatically.
  • Focuses on specific subdirectories for targeted code exploration.
  • Provides AI-friendly smart error hints to reduce hallucinations.

Use cases of Easy Code Reader

  • Cross-project call‑chain analysis of Java microservices.
  • Reading JAR library source code to complete current code writing.
  • Understanding third‑party dependency implementations for feature development.
  • Rapidly tracing exception origins in external JAR dependencies.
  • Onboarding new developers by exploring multi‑module project relationships.

FAQ from Easy Code Reader

What dependencies are required to run Easy Code Reader?

You need Python 3.10 or higher, the uv package manager, and a Java Development Kit (JDK) at least version 8 for running decompilers.

How does Easy Code Reader obtain Java source code from Maven dependencies?

It first tries to extract source from the ‑sources.jar file (preferred). If that isn't available, it automatically falls back to decompiling the main JAR using CFR or Fernflower, selecting the best decompiler based on the Java version.

Where does Easy Code Reader look for local Maven repositories?

By default it uses the MAVEN_HOME environment variable or ~/.m2/repository. You can override this with the --maven-repo argument when starting the server.

What should I do if I see “spawn uvx ENOENT”?

This error means uvx is not installed or not in your system PATH. Ensure uv is correctly installed and added to PATH, then restart your IDE before launching the MCP server.

What tools does Easy Code Reader provide?

It provides four main tools: read_jar_source (read source from a Maven dependency), list_all_project (list all projects in the project directory), list_project_files (list source and config files in a project), and read_project_code (read the content of a specific file).

コメント

「開発者ツール」の他のコンテンツ