-
Notifications
You must be signed in to change notification settings - Fork 640
[ISSUE #5208] develop mcp protocol #5203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
98ccd6e
basic arch
jerryyummy 69793a5
refine
3d216a9
basic arch
jerryyummy 996f1fc
build the basic mcp server without streamable http
jerryyummy 8d622c0
build the basic mcp server without streamable http
jerryyummy c6802b0
build the basic mcp server without streamable http
jerryyummy 684ccbd
build the basic mcp server with streamable http
jerryyummy 3692b6e
build the basic mcp server
jerryyummy 4c1d227
build the basic mcp server
jerryyummy 94d9196
build the basic mcp server
jerryyummy a5b44db
build the basic mcp server
jerryyummy 87ceb60
build the basic mcp server
jerryyummy ab5fd0a
build the basic mcp server
jerryyummy 64de0ea
build the basic mcp server
jerryyummy 3e5eb35
build the basic mcp server
jerryyummy b948d5c
build the basic mcp server
jerryyummy cdcef32
Update RemoteSubscribeInstance.java
wqliang e86af63
Update McpSinkHandlerRetryWrapper.java
wqliang 358f491
Update CommonMcpSinkHandler.java
wqliang 8cd5d08
Update McpSinkConnector.java
wqliang 180c39f
Update McpSinkHandler.java
wqliang bc7035b
Update McpExportRecord.java
wqliang f620f01
Update McpConnectRecord.java
wqliang 34956e0
Update McpExportRecordPage.java
wqliang 51825d0
Update McpExportMetadata.java
wqliang 9e76798
Update McpSourceConnector.java
wqliang 43c297f
Update McpToolRegistry.java
wqliang 28990a7
Update McpServerConfig.java
wqliang 4905170
Update Protocol.java
wqliang 3085322
Update McpSourceConnector.java
wqliang 6b50b2b
Update McpSourceConstants.java
wqliang 71e78be
Update McpStandardProtocol.java
wqliang 113997d
Update McpRequest.java
wqliang 99f9af2
Update McpResponse.java
wqliang 2554a2d
Update McpSinkHandlerRetryWrapper.java
wqliang 142224a
Update AbstractMcpSinkHandler.java
wqliang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...common/src/main/java/org/apache/eventmesh/common/config/connector/mcp/McpRetryConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.eventmesh.common.config.connector.mcp; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| @Data | ||
| public class McpRetryConfig { | ||
| // maximum number of retries, default 2, minimum 0 | ||
| private int maxRetries = 2; | ||
|
|
||
| // retry interval, default 1000ms | ||
| private int interval = 1000; | ||
|
|
||
| // Default value is false, indicating that only requests with network-level errors will be retried. | ||
| // If set to true, all failed requests will be retried, including network-level errors and non-2xx responses. | ||
| private boolean retryOnNonSuccess = false; | ||
| } |
31 changes: 31 additions & 0 deletions
31
...-common/src/main/java/org/apache/eventmesh/common/config/connector/mcp/McpSinkConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.eventmesh.common.config.connector.mcp; | ||
|
|
||
| import org.apache.eventmesh.common.config.connector.SinkConfig; | ||
|
|
||
| import lombok.Data; | ||
| import lombok.EqualsAndHashCode; | ||
|
|
||
|
|
||
| @Data | ||
| @EqualsAndHashCode(callSuper = true) | ||
| public class McpSinkConfig extends SinkConfig { | ||
|
|
||
| public SinkConnectorConfig connectorConfig; | ||
| } |
31 changes: 31 additions & 0 deletions
31
...ommon/src/main/java/org/apache/eventmesh/common/config/connector/mcp/McpSourceConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.eventmesh.common.config.connector.mcp; | ||
|
|
||
| import org.apache.eventmesh.common.config.connector.SourceConfig; | ||
|
|
||
| import lombok.Data; | ||
| import lombok.EqualsAndHashCode; | ||
|
|
||
|
|
||
| @Data | ||
| @EqualsAndHashCode(callSuper = true) | ||
| public class McpSourceConfig extends SourceConfig { | ||
|
|
||
| public SourceConnectorConfig connectorConfig; | ||
| } | ||
76 changes: 76 additions & 0 deletions
76
...n/src/main/java/org/apache/eventmesh/common/config/connector/mcp/SinkConnectorConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.eventmesh.common.config.connector.mcp; | ||
|
|
||
|
|
||
| import lombok.Data; | ||
|
|
||
| @Data | ||
| public class SinkConnectorConfig { | ||
|
|
||
| private String connectorName; | ||
|
|
||
| private String[] urls; | ||
|
|
||
| // keepAlive, default true | ||
| private boolean keepAlive = true; | ||
|
|
||
| // timeunit: ms, default 60000ms | ||
| private int keepAliveTimeout = 60 * 1000; // Keep units consistent | ||
|
|
||
| // timeunit: ms, default 5000ms, recommended scope: 5000ms - 10000ms | ||
| private int connectionTimeout = 5000; | ||
|
|
||
| // timeunit: ms, default 5000ms | ||
| private int idleTimeout = 5000; | ||
|
|
||
| // maximum number of HTTP/1 connections a client will pool, default 50 | ||
| private int maxConnectionPoolSize = 50; | ||
|
|
||
| // retry config | ||
| private McpRetryConfig retryConfig = new McpRetryConfig(); | ||
|
|
||
| private String deliveryStrategy = "ROUND_ROBIN"; | ||
|
|
||
| private boolean skipDeliverException = false; | ||
|
|
||
| // managed pipelining param, default true | ||
| private boolean isParallelized = true; | ||
|
|
||
| private int parallelism = 2; | ||
|
|
||
|
|
||
| /** | ||
| * Fill default values if absent (When there are multiple default values for a field) | ||
| * | ||
| * @param config SinkConnectorConfig | ||
| */ | ||
| public static void populateFieldsWithDefaults(SinkConnectorConfig config) { | ||
| /* | ||
| * set default values for idleTimeout | ||
| * recommended scope: common(5s - 10s), webhook(15s - 30s) | ||
| */ | ||
| final int commonHttpIdleTimeout = 5000; | ||
|
|
||
| // Set default values for idleTimeout | ||
| if (config.getIdleTimeout() == 0) { | ||
| config.setIdleTimeout(commonHttpIdleTimeout); | ||
| } | ||
|
|
||
| } | ||
| } |
63 changes: 63 additions & 0 deletions
63
...src/main/java/org/apache/eventmesh/common/config/connector/mcp/SourceConnectorConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.eventmesh.common.config.connector.mcp; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| @Data | ||
| public class SourceConnectorConfig { | ||
|
|
||
| private String connectorName; | ||
|
|
||
| private String path = "/"; | ||
|
|
||
| private int port; | ||
|
|
||
| // timeunit: ms, default 5000ms | ||
| private int idleTimeout = 5000; | ||
|
|
||
| /** | ||
| * <ul> | ||
| * <li>The maximum size allowed for form attributes when Content-Type is application/x-www-form-urlencoded or multipart/form-data </li> | ||
| * <li>Default is 1MB (1024 * 1024 bytes). </li> | ||
| * <li>If you receive a "size exceed allowed maximum capacity" error, you can increase this value. </li> | ||
| * <li>Note: This applies only when handling form data submissions.</li> | ||
| * </ul> | ||
| */ | ||
| private int maxFormAttributeSize = 1024 * 1024; | ||
|
|
||
| // max size of the queue, default 1000 | ||
| private int maxStorageSize = 1000; | ||
|
|
||
| // batch size, default 10 | ||
| private int batchSize = 10; | ||
|
|
||
| // protocol, default CloudEvent | ||
| private String protocol = "Mcp"; | ||
|
|
||
| // extra config, e.g. GitHub secret | ||
| private Map<String, String> extraConfig = new HashMap<>(); | ||
|
|
||
| // data consistency enabled, default true | ||
| private boolean dataConsistencyEnabled = false; | ||
|
|
||
| private String forwardPath; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,4 +16,4 @@ | |
| # | ||
|
|
||
| sourceEnable: true | ||
| sinkEnable: false | ||
| sinkEnable: true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| dependencies { | ||
| api project(":eventmesh-openconnect:eventmesh-openconnect-java") | ||
| implementation project(":eventmesh-common") | ||
| implementation project(":eventmesh-connectors:eventmesh-connector-http") | ||
| implementation project(":eventmesh-protocol-plugin:eventmesh-protocol-api") | ||
| implementation "io.cloudevents:cloudevents-core" | ||
| implementation "com.google.guava:guava" | ||
| implementation "io.cloudevents:cloudevents-json-jackson" | ||
| implementation ("io.grpc:grpc-protobuf:1.68.0") { | ||
| exclude group: "com.google.protobuf", module: "protobuf-java" | ||
| } | ||
| implementation 'io.cloudevents:cloudevents-http-vertx:3.0.0' | ||
| implementation 'io.vertx:vertx-web:4.5.8' | ||
| implementation 'io.vertx:vertx-web-client:4.5.9' | ||
| implementation 'dev.failsafe:failsafe:3.3.2' | ||
|
|
||
|
|
||
| testImplementation 'org.apache.httpcomponents.client5:httpclient5:5.4' | ||
| testImplementation 'org.apache.httpcomponents.client5:httpclient5-fluent:5.4' | ||
| testImplementation 'org.mock-server:mockserver-netty:5.15.0' | ||
| implementation 'io.netty:netty-codec-http:4.1.114.Final' | ||
| compileOnly 'org.projectlombok:lombok' | ||
| annotationProcessor 'org.projectlombok:lombok' | ||
| } |
18 changes: 18 additions & 0 deletions
18
eventmesh-connectors/eventmesh-connector-mcp/gradle.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| pluginType=connector | ||
| pluginName=mcp |
34 changes: 34 additions & 0 deletions
34
...onnector-mcp/src/main/java/org/apache/eventmesh/connector/mcp/config/McpServerConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
|
|
||
| package org.apache.eventmesh.connector.mcp.config; | ||
|
|
||
| import org.apache.eventmesh.common.config.connector.Config; | ||
|
|
||
| import lombok.Data; | ||
| import lombok.EqualsAndHashCode; | ||
|
|
||
|
|
||
| @Data | ||
| @EqualsAndHashCode(callSuper = true) | ||
| public class McpServerConfig extends Config { | ||
|
|
||
| private boolean sourceEnable; | ||
|
|
||
| private boolean sinkEnable; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
can merge
SourceConnectorConfigwithMcpSourceConfig?