WIP Servlet 4 MCP
Showing
11 changed files
with
8 additions
and
134 deletions
AGENTS.md
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
README-SDK-Services.md
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
README-SDK-Servlet.md
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
README-SSE-Servlet.md
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
| ... | @@ -11,52 +11,13 @@ | ... | @@ -11,52 +11,13 @@ |
| 11 | <https://creativecommons.org/publicdomain/zero/1.0/>. --> | 11 | <https://creativecommons.org/publicdomain/zero/1.0/>. --> |
| 12 | 12 | ||
| 13 | <component xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 13 | <component xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 14 | xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/component-definition-3.xsd" | 14 | xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/moqui-conf-3.xsd" |
| 15 | name="moqui-mcp-2"> | 15 | name="moqui-mcp-2" version="1.0.0"> |
| 16 | |||
| 17 | |||
| 18 | |||
| 19 | <!-- MCP SDK dependencies --> | ||
| 20 | <dependency> | ||
| 21 | <groupId>io.modelcontextprotocol.sdk</groupId> | ||
| 22 | <artifactId>mcp</artifactId> | ||
| 23 | <version>0.16.0</version> | ||
| 24 | </dependency> | ||
| 25 | <dependency> | ||
| 26 | <groupId>io.modelcontextprotocol.sdk</groupId> | ||
| 27 | <artifactId>mcp-core</artifactId> | ||
| 28 | <version>0.16.0</version> | ||
| 29 | </dependency> | ||
| 30 | <dependency> | ||
| 31 | <groupId>com.fasterxml.jackson.core</groupId> | ||
| 32 | <artifactId>jackson-databind</artifactId> | ||
| 33 | <version>2.15.2</version> | ||
| 34 | </dependency> | ||
| 35 | <dependency> | ||
| 36 | <groupId>com.fasterxml.jackson.core</groupId> | ||
| 37 | <artifactId>jackson-core</artifactId> | ||
| 38 | <version>2.15.2</version> | ||
| 39 | </dependency> | ||
| 40 | <dependency> | ||
| 41 | <groupId>io.projectreactor</groupId> | ||
| 42 | <artifactId>reactor-core</artifactId> | ||
| 43 | <version>3.5.10</version> | ||
| 44 | </dependency> | ||
| 45 | 16 | ||
| 46 | <entity-factory load-path="entity/" /> | 17 | <entity-factory load-path="entity/" /> |
| 47 | <service-factory load-path="service/" /> | 18 | <service-factory load-path="service/" /> |
| 48 | <!-- <screen-factory load-path="screen/" /> --> | ||
| 49 | 19 | ||
| 50 | <!-- Load seed data --> | 20 | <!-- Load seed data --> |
| 51 | <entity-factory load-data="data/McpSecuritySeedData.xml" /> | 21 | <entity-factory load-data="data/McpSecuritySeedData.xml" /> |
| 52 | 22 | ||
| 53 | <!-- Register MCP filter | ||
| 54 | <webapp-list> | ||
| 55 | <webapp name="webroot"> | ||
| 56 | <filter name="McpFilter" class="org.moqui.mcp.McpFilter"> | ||
| 57 | <url-pattern>/mcpservlet/*</url-pattern> | ||
| 58 | </filter> | ||
| 59 | </webapp> | ||
| 60 | </webapp-list> --> | ||
| 61 | |||
| 62 | </component> | 23 | </component> | ... | ... |
| ... | @@ -22,7 +22,6 @@ | ... | @@ -22,7 +22,6 @@ |
| 22 | <moqui.security.ArtifactGroup artifactGroupId="McpScreenTransitions" description="MCP Screen Transitions"/> | 22 | <moqui.security.ArtifactGroup artifactGroupId="McpScreenTransitions" description="MCP Screen Transitions"/> |
| 23 | 23 | ||
| 24 | <!-- MCP Artifact Group Members --> | 24 | <!-- MCP Artifact Group Members --> |
| 25 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="mo-mcp.mo-mcp.*" artifactTypeEnumId="AT_SERVICE"/> | ||
| 26 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="McpServices.*" artifactTypeEnumId="AT_SERVICE"/> | 25 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="McpServices.*" artifactTypeEnumId="AT_SERVICE"/> |
| 27 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="McpServices.mcp#Ping" artifactTypeEnumId="AT_SERVICE"/> | 26 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="McpServices.mcp#Ping" artifactTypeEnumId="AT_SERVICE"/> |
| 28 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="McpServices.handle#McpRequest" artifactTypeEnumId="AT_SERVICE"/> | 27 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="McpServices.handle#McpRequest" artifactTypeEnumId="AT_SERVICE"/> |
| ... | @@ -31,10 +30,8 @@ | ... | @@ -31,10 +30,8 @@ |
| 31 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="McpServices.mcp#ToolsCall" artifactTypeEnumId="AT_SERVICE"/> | 30 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="McpServices.mcp#ToolsCall" artifactTypeEnumId="AT_SERVICE"/> |
| 32 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="McpServices.mcp#ResourcesList" artifactTypeEnumId="AT_SERVICE"/> | 31 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="McpServices.mcp#ResourcesList" artifactTypeEnumId="AT_SERVICE"/> |
| 33 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="McpServices.mcp#ResourcesRead" artifactTypeEnumId="AT_SERVICE"/> | 32 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="McpServices.mcp#ResourcesRead" artifactTypeEnumId="AT_SERVICE"/> |
| 34 | <moqui.security.ArtifactGroupMember artifactGroupId="McpRestPaths" artifactName="/mcp/rpc" artifactTypeEnumId="AT_REST_PATH"/> | 33 | <moqui.security.ArtifactGroupMember artifactGroupId="McpRestPaths" artifactName="/mcp" artifactTypeEnumId="AT_REST_PATH"/> |
| 35 | <moqui.security.ArtifactGroupMember artifactGroupId="McpRestPaths" artifactName="/mcp/rpc/*" artifactTypeEnumId="AT_REST_PATH"/> | 34 | <moqui.security.ArtifactGroupMember artifactGroupId="McpRestPaths" artifactName="/mcp/*" artifactTypeEnumId="AT_REST_PATH"/> |
| 36 | <moqui.security.ArtifactGroupMember artifactGroupId="McpScreenTransitions" artifactName="component://moqui-mcp-2/screen/webroot/mcp.xml/rpc" artifactTypeEnumId="AT_XML_SCREEN_TRANS"/> | ||
| 37 | <moqui.security.ArtifactGroupMember artifactGroupId="McpScreenTransitions" artifactName="component://moqui-mcp-2/screen/webroot/mcp.xml" artifactTypeEnumId="AT_XML_SCREEN"/> | ||
| 38 | 35 | ||
| 39 | <!-- MCP Artifact Authz --> | 36 | <!-- MCP Artifact Authz --> |
| 40 | <moqui.security.ArtifactAuthz userGroupId="McpUser" artifactGroupId="McpServices" authzTypeEnumId="AUTHZT_ALLOW" authzActionEnumId="AUTHZA_ALL"/> | 37 | <moqui.security.ArtifactAuthz userGroupId="McpUser" artifactGroupId="McpServices" authzTypeEnumId="AUTHZT_ALLOW" authzActionEnumId="AUTHZA_ALL"/> | ... | ... |
| ... | @@ -258,8 +258,8 @@ | ... | @@ -258,8 +258,8 @@ |
| 258 | def userAccountId = userId ? userId : null | 258 | def userAccountId = userId ? userId : null |
| 259 | 259 | ||
| 260 | // Get user-specific tools and resources | 260 | // Get user-specific tools and resources |
| 261 | def toolsResult = ec.service.sync().name("org.moqui.mcp.McpServices.mcp#ToolsList").parameters([:]).call() | 261 | def toolsResult = ec.service.sync().name("McpServices.mcp#ToolsList").parameters([:]).call() |
| 262 | def resourcesResult = ec.service.sync().name("org.moqui.mcp.McpServices.mcp#ResourcesList").parameters([:]).call() | 262 | def resourcesResult = ec.service.sync().name("McpServices.mcp#ResourcesList").parameters([:]).call() |
| 263 | 263 | ||
| 264 | // Build server capabilities based on what user can access | 264 | // Build server capabilities based on what user can access |
| 265 | def serverCapabilities = [ | 265 | def serverCapabilities = [ | ... | ... |
This diff is collapsed.
Click to expand it.
| ... | @@ -22,7 +22,7 @@ import org.slf4j.Logger | ... | @@ -22,7 +22,7 @@ import org.slf4j.Logger |
| 22 | import org.slf4j.LoggerFactory | 22 | import org.slf4j.LoggerFactory |
| 23 | 23 | ||
| 24 | import javax.servlet.AsyncContext | 24 | import javax.servlet.AsyncContext |
| 25 | import javax.servlet.AsyncContextListener | 25 | import javax.servlet.AsyncListener |
| 26 | import javax.servlet.AsyncEvent | 26 | import javax.servlet.AsyncEvent |
| 27 | import javax.servlet.ServletConfig | 27 | import javax.servlet.ServletConfig |
| 28 | import javax.servlet.ServletException | 28 | import javax.servlet.ServletException |
| ... | @@ -205,7 +205,7 @@ class ServiceBasedMcpServlet extends HttpServlet { | ... | @@ -205,7 +205,7 @@ class ServiceBasedMcpServlet extends HttpServlet { |
| 205 | ]) | 205 | ]) |
| 206 | 206 | ||
| 207 | // Set up connection close handling | 207 | // Set up connection close handling |
| 208 | asyncContext.addListener(new AsyncContextListener() { | 208 | asyncContext.addListener(new AsyncListener() { |
| 209 | @Override | 209 | @Override |
| 210 | void onComplete(AsyncEvent event) throws IOException { | 210 | void onComplete(AsyncEvent event) throws IOException { |
| 211 | sseConnections.remove(sessionId) | 211 | sseConnections.remove(sessionId) | ... | ... |
web-sdk-services.xml
deleted
100644 → 0
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 4 | xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee | ||
| 5 | http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" | ||
| 6 | version="4.0"> | ||
| 7 | |||
| 8 | <!-- MCP SDK Services Servlet Configuration --> | ||
| 9 | <servlet> | ||
| 10 | <servlet-name>McpSdkServicesServlet</servlet-name> | ||
| 11 | <servlet-class>org.moqui.mcp.McpSdkServicesServlet</servlet-class> | ||
| 12 | |||
| 13 | <!-- Configuration parameters --> | ||
| 14 | <init-param> | ||
| 15 | <param-name>moqui-name</param-name> | ||
| 16 | <param-value>moqui-mcp-2</param-value> | ||
| 17 | </init-param> | ||
| 18 | |||
| 19 | <!-- Enable async support (required for SSE) --> | ||
| 20 | <async-supported>true</async-supported> | ||
| 21 | |||
| 22 | <!-- Load on startup to initialize MCP server --> | ||
| 23 | <load-on-startup>1</load-on-startup> | ||
| 24 | </servlet> | ||
| 25 | |||
| 26 | <!-- Servlet mappings for MCP SDK Services endpoints --> | ||
| 27 | <!-- The MCP SDK will handle both SSE and message endpoints through this servlet --> | ||
| 28 | <servlet-mapping> | ||
| 29 | <servlet-name>McpSdkServicesServlet</servlet-name> | ||
| 30 | <url-pattern>/mcp/*</url-pattern> | ||
| 31 | </servlet-mapping> | ||
| 32 | |||
| 33 | <!-- Session configuration --> | ||
| 34 | <session-config> | ||
| 35 | <session-timeout>30</session-timeout> | ||
| 36 | <cookie-config> | ||
| 37 | <http-only>true</http-only> | ||
| 38 | <secure>false</secure> | ||
| 39 | </cookie-config> | ||
| 40 | </session-config> | ||
| 41 | |||
| 42 | </web-app> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
web-sdk-sse.xml
deleted
100644 → 0
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" | ||
| 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 4 | xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee | ||
| 5 | http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" | ||
| 6 | version="4.0"> | ||
| 7 | |||
| 8 | <!-- MCP SDK SSE Servlet Configuration --> | ||
| 9 | <servlet> | ||
| 10 | <servlet-name>McpSdkSseServlet</servlet-name> | ||
| 11 | <servlet-class>org.moqui.mcp.McpSdkSseServlet</servlet-class> | ||
| 12 | |||
| 13 | <!-- Configuration parameters --> | ||
| 14 | <init-param> | ||
| 15 | <param-name>moqui-name</param-name> | ||
| 16 | <param-value>moqui-mcp-2</param-value> | ||
| 17 | </init-param> | ||
| 18 | |||
| 19 | <!-- Enable async support (required for SSE) --> | ||
| 20 | <async-supported>true</async-supported> | ||
| 21 | |||
| 22 | <!-- Load on startup to initialize MCP server --> | ||
| 23 | <load-on-startup>1</load-on-startup> | ||
| 24 | </servlet> | ||
| 25 | |||
| 26 | <!-- Servlet mappings for MCP SDK SSE endpoints --> | ||
| 27 | <!-- The MCP SDK will handle both SSE and message endpoints through this servlet --> | ||
| 28 | <servlet-mapping> | ||
| 29 | <servlet-name>McpSdkSseServlet</servlet-name> | ||
| 30 | <url-pattern>/mcp/*</url-pattern> | ||
| 31 | </servlet-mapping> | ||
| 32 | |||
| 33 | <!-- Session configuration --> | ||
| 34 | <session-config> | ||
| 35 | <session-timeout>30</session-timeout> | ||
| 36 | <cookie-config> | ||
| 37 | <http-only>true</http-only> | ||
| 38 | <secure>false</secure> | ||
| 39 | </cookie-config> | ||
| 40 | </session-config> | ||
| 41 | |||
| 42 | </web-app> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment