apache / apache/dubbo

[Feature] Dubbo MCP Integration Proposal

Open
#15,332 7 comments 2 reactions 2 assignees Claimed by @heliang666s View on GitHub
type/enhancement type/proposal
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

### Pre-check

- [x] I am sure that all the content I provide is in English.

### Search before asking

- [x] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar feature requirement.

### Apache Dubbo Component

Java SDK (apache/dubbo)

### Descriptions

## Background
To better help developers expose Dubbo services as AI capabilities and enhance the integration with AI systems, we propose integrating the MCP (Model Control Protocol) with Dubbo. This integration will:
- Support automatic service export as MCP tools
- Enable client-side invocation based on MCP SSE mode

## Overview
This proposal outlines the integration of Apache Dubbo with MCP, enabling Dubbo services to be exposed as MCP tools. This integration facilitates seamless communication between Dubbo services and MCP-compatible systems.

## Features

### 1. Configuration Options
- `dubbo.mcp.enabled`: Enable/disable MCP integration (default: false)
- `dubbo.mcp.sse.endpoint`: Server-Sent Events (SSE) endpoint path (default: `/dubbo/mcp/sse`)

> **Note**: These configuration options are only available when using the Triple protocol. Non-Triple protocols will result in an error. This version only supports the Triple-REST protocol.

### 2. Core Functionality
- Automatic SSE connection establishment through the configured endpoint
- Support for `@DubboService` annotation to register Dubbo interface methods as MCP tools
- Annotation attributes:
- `mcp`: Enable/disable MCP server (default: false)
- Automatic data retrieval from Triple OpenAPI when annotation attributes are empty

## Implementation Details

### Service Initialization
1. During application startup, verify `mcp.server.enabled=true`
2. If enabled, automatically register a Triple protocol server
3. Expose the configured SSE endpoint

### Service Registration
1. Scan services for `@DubboService` annotations
2. Validate methods to ensure Triple protocol compatibility
3. For annotated services:
- Register name and description with MCP
- Convert method parameters to JSON Schema
- Register with McpServer using mcp-java-sdk

## Impact
- New feature addition
- No breaking changes to existing functionality
- Requires Triple protocol support

## Alternatives Considered
- Direct integration without MCP protocol
- Custom protocol implementation

## References
- MCP Protocol Specification
- Triple Protocol Documentation

### Related issues

_No response_

### Are you willing to submit a pull request to fix on your own?

- [ ] Yes I am willing to submit a pull request on my own!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.