feat(mcp): platform-mcp —— EIP4 MCP server 标准接入 Claude Code/Codex/OpenCode (G2)

- 新增 platform-mcp 模块(stdio MCP server,MCP Java SDK 1.1.0 / jackson2 路线)
- 注册 7 个 MCP 工具:eip4_auto_develop / list_page_recipes / validate_page_schema
  / list_components / access_check / list_entities / entity_attributes
  忠实转发 EIP4 REST,复用人审红线(产物恒 READY_FOR_HUMAN_REVIEW),不另开权限面
- 工具逻辑 TDD(Eip4McpTools 9 单测,注入 mock REST client)
- 真实 stdio JSON-RPC e2e:initialize 协商 + tools/list 返回 7 工具(schema 正确)
  + tools/call 链路(死端口优雅 isError)
- 坑:父 pom 为 amis 校验钉死 networknt 1.5.2,与 MCP 需要的 2.0.0(含 dialect.Dialects)
  冲突 → platform-mcp 显式覆盖 2.0.0(仅本模块)
- 文档:GAP 标记 G2 完成、平台 README + skills/README 加 MCP 接入说明

接入:claude mcp add eip4 -- java -jar platform-mcp/target/platform-mcp-0.1.0-SNAPSHOT.jar --base-url <env>

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-22 14:37:02 +08:00
parent 5b06aeceff
commit 4a2080a4f6
10 changed files with 580 additions and 1 deletions

71
platform-mcp/pom.xml Normal file
View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.eip4</groupId>
<artifactId>eip4-platform</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>platform-mcp</artifactId>
<name>platform-mcp</name>
<description>EIP4 MCP server:把 AI/元数据 REST 端点包成 MCP 工具,供 Claude Code/Codex/OpenCode 经 stdio 接入;复用 env/baseUrl 与人审红线</description>
<dependencies>
<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp-core</artifactId>
</dependency>
<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp-json-jackson2</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- MCP 1.1.0 的 schema validator 需 networknt 2.0.0(含 dialect.Dialects);
父 pom 为 amis 校验钉死 1.5.2,这里显式覆盖,仅作用于本模块。 -->
<dependency>
<groupId>com.networknt</groupId>
<artifactId>json-schema-validator</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<archive>
<manifest>
<mainClass>com.eip4.platform.mcp.Eip4McpServer</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>