Cursor Mcp For Java

by saikaNya

292 downloads Not rated yet
GitHub

About

一个Cursor或VSCode插件,可将您的VSCode或Cursor作为MCP服务器,为MCP客户端(如Cursor、VSCode copilot、Claude Desktop、Cherry studio)提供高级编码辅助功能。如获取项目中的类,与通过全限定名获取类的源代码等(包含项目源代码,以及项目中所有可访问依赖中的类

Explore

- Integrates with VSCode, Cursor, and other MCP clients.
- Requires the Extension Pack for Java to be installed.
- Launched via npx with the vscode-as-mcp-server command.
- Status indicator in the editor’s bottom-right bar.
- Works only when a Java project is fully loaded.
- Supports clients like Claude Desktop, Windsurf, and Cherry Studio.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Cursor Mcp For Java
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

1. Confirm that the Extension Pack for Java plugin is installed and can run Java projects normally

2. Download and install this extension MCP Server for Java.

3. Configure your MCP client:

- For clients like Claude Desktop, Cursor, Winsurf, VSCode, Cherry studio: Add the following to your configuration file (claude_desktop_config.json):

    {
      "mcpServers": {
        "vscode-java": {
          "command": "npx",
          "args": ["vscode-as-mcp-server"]
        }
      }
    }
    

4. Check the MCP server status in the bottom-right VSCode or Cursor status bar:

- ✅: Server is running
- ∅: Click to start the server

Server status indicator

5. Open a Java project and make sure the project is fully loaded
Project fully loaded

execute_command

Execute a command in a VSCode integrated terminal with proper shell integration. This tool provides detailed output and exit status information, and supports: - Custom working directory - Shell integration for reliable output capture - Output compression for large outputs - Detailed exit status reporting - Flag for potentially destructive commands (potentiallyDestructive: false to skip confirmation for read-only commands)

code_checker

Retrieve diagnostics from VSCode's language services for the active workspace. Use this tool after making changes to any code in the filesystem to ensure no new errors were introduced, or when requested by the user.

focus_editor

Open the specified file in the VSCode editor and navigate to a specific line and column. Use this tool to bring a file into focus and position the editor's cursor where desired. Note: This tool operates on the editor visual environment so that the user can see the file. It does not return the file contents in the tool call result.

list_debug_sessions

List all active debug sessions in the workspace.

start_debug_session

Start a new debug session with the provided configuration.

restart_debug_session

Restart a debug session by stopping it and then starting it with the provided configuration.

stop_debug_session

Stop all debug sessions that match the provided session name.

text_editor

A text editor tool that provides file manipulation capabilities using VSCode's native APIs: - view: Read file contents with optional line range - str_replace: Replace text in file - create: Create new file - insert: Insert text at specific line - undo_edit: Restore from backup Code Editing Tips: - VSCode may automatically prune unused imports when saving. To prevent this, make sure the imported type is actually used in your code before adding the import.

list_directory

List directory contents in a tree format, respecting .gitignore patterns. Shows files and directories with proper indentation and icons. Useful for exploring workspace structure while excluding ignored files.

get_terminal_output

Retrieve the output from a specific terminal by its ID. This tool allows you to check the current or historical output of a terminal, which is particularly useful when working with long-running commands or commands started in background mode with the execute_command tool.

- execute_command: Execute a command in a VSCode integrated terminal with proper shell integration.
This tool provides detailed output and exit status information, and supports:
- Custom working directory
- Shell integration for reliable output capture
- Output compression for large outputs
- Detailed exit status reporting
- Flag for potentially destructive commands (potentiallyDestructive: false to skip confirmation for read-only commands)
- code_checker: Retrieve diagnostics from VSCode's language services for the active workspace.
Use this tool after making changes to any code in the filesystem to ensure no new
errors were introduced, or when requested by the user.
- focus_editor: Open the specified file in the VSCode editor and navigate to a specific line and column.
Use this tool to bring a file into focus and position the editor's cursor where desired.
Note: This tool operates on the editor visual environment so that the user can see the file. It does not return the file contents in the tool call result.
- list_debug_sessions: List all active debug sessions in the workspace.
- start_debug_session: Start a new debug session with the provided configuration.
- restart_debug_session: Restart a debug session by stopping it and then starting it with the provided configuration.
- stop_debug_session: Stop all debug sessions that match the provided session name.
- text_editor: A text editor tool that provides file manipulation capabilities using VSCode's native APIs:
- view: Read file contents with optional line range
- str_replace: Replace text in file
- create: Create new file
- insert: Insert text at specific line
- undo_edit: Restore from backup

Code Editing Tips:
- VSCode may automatically prune unused imports when saving. To prevent this, make sure the imported type is
actually used in your code before adding the import.
- list_directory: List directory contents in a tree format, respecting .gitignore patterns.
Shows files and directories with proper indentation and icons.
Useful for exploring workspace structure while excluding ignored files.
- get_terminal_output: Retrieve the output from a specific terminal by its ID.
This tool allows you to check the current or historical output of a terminal,
which is particularly useful when working with long-running commands or
commands started in background mode with the execute_command tool.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "cursor mcp for java": {
            "vscode-java": {
                "command": "npx",
                "args": [
                    "vscode-as-mcp-server"
                ]
            }
        }
    }
}

McpServers

{
    "vscode-java": {
        "command": "npx",
        "args": [
            "vscode-as-mcp-server"
        ]
    }
}

MCP Server For Java

首次安装与设置

1. 确认已经安装插件Extension Pack for Java 且可正常运行java项目

2. 下载安装本插件MCP Server for Java。

3. 配置您的MCP客户端:

- 如Claude Desktop,Curosr,Winsurf,Vsocde,Cherry studio等客户端:添加以下内容到您的配置文件(claude_desktop_config.json)中:

    {
      "mcpServers": {
        "vscode-java": {
          "command": "npx",
          "args": ["vscode-as-mcp-server"]
        }
      }
    }
    
4. 在VSCode或Cursor状态栏右下角查看MCP服务器状态:

- ✅: 服务器正在运行
- ∅: 点击启动服务器

服务器状态指示器

5. 打开一个java项目,并确保项目完全加载完毕
项目完全加载完毕

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.