MCP HubMCP Hub
JetBrains

mcp-server-plugin

by: JetBrains

JetBrains MCP Server Plugin

70created 09/12/2024
Visit
Plugin
JetBrains

📌Overview

Purpose: The JetBrains MCP Server Plugin aims to facilitate seamless integration between Large Language Models (LLMs) and JetBrains IDEs through a robust server-side solution.

Overview: This plugin enables the handling of Model Context Protocol (MCP) requests in JetBrains IDEs, allowing developers to implement custom tools via an extension point system. The plugin is designed to enhance the IDE's capabilities by leveraging powerful language models.

Key Features:

  • Custom Tool Implementation: Provides an extension point for developers to create and register their own MCP tools using a defined class structure, enabling customization to meet specific project needs.

  • Integration with JetBrains IDEs: Supports popular JetBrains IDEs like IntelliJ IDEA and WebStorm, ensuring a broad application scope within the development environment.


JetBrains MCP Server Plugin

JetBrains MCP (Model Context Protocol) Server Plugin enables seamless integration between Large Language Models (LLMs) and JetBrains IDEs. This plugin provides the server-side implementation for handling MCP requests and exposes extension points for implementing custom tools.

Prerequisites

Custom Tools Implementation

The plugin provides an extension point system that allows third-party plugins to implement their own MCP tools.

1. Creating a Custom Tool

Create a class that extends AbstractMcpTool:

class MyCustomTool : AbstractMcpTool<MyArgs>() {
    override val name: String = "myCustomTool"
    override val description: String = "Description of what your tool does"

    override fun handle(project: Project, args: MyArgs): Response {
        // Implement your tool's logic here
        return Response.ok("Result")
    }
}

// Define your arguments data class
@Serializable
data class MyArgs(
    val param1: String,
    val param2: Int
)

2. Registering Your Tool

Add your tool as an extension in your plugin.xml:

<idea-plugin>
    <depends>com.intellij.mcpServer</depends>

    <extensions defaultExtensionNs="com.intellij.mcpServer">
        <mcpTool implementation="com.example.MyCustomTool"/>
    </extensions>
</idea-plugin>

3. Tool Implementation Guidelines

  • Tool names should be descriptive and use lowercase with optional underscores.
  • Create a data class for your tool's arguments that matches the expected JSON input.
  • Use the Response class appropriately:
    • Response(result) for successful operations.
    • Response(error = message) for error cases.
  • Use the provided Project instance for accessing IDE services.

How to Publish Update

  1. Update settings.gradle.kts to provide a new version.
  2. Create a release on Github; the publishing task will be automatically triggered.

Contributing

We welcome contributions! Please feel free to submit a Pull Request.