[backend/frontend] feat(mcp): add embed native MCP server with Streamable HTTP transport (#5219)#5220
Open
SamuelHassine wants to merge 11 commits intomasterfrom
Open
[backend/frontend] feat(mcp): add embed native MCP server with Streamable HTTP transport (#5219)#5220SamuelHassine wants to merge 11 commits intomasterfrom
SamuelHassine wants to merge 11 commits intomasterfrom
Conversation
…port (#5219) Adds a native Model Context Protocol (MCP) server to OpenAEV, exposing 29 tools for adversarial exposure validation via the Streamable HTTP transport. Any MCP-compatible AI client (Claude Desktop, Cursor, Filigran Copilot, etc.) can now connect directly to OpenAEV and interact with scenarios, assets, payloads, and findings. Backend: - New POST /api/mcp endpoint using io.modelcontextprotocol.sdk:mcp Java SDK - HttpServletStreamableServerTransportProvider registered as Servlet bean - Auth via existing TokenAuthenticationFilter (Bearer token) - 29 tools calling internal REST API with user context - Configurable via openaev.mcp.enabled (default: true) Frontend: - New MCP access section on user profile page - Shows endpoint URL and ready-to-copy client configuration - Translation keys for en/fr locales Made-with: Cursor
openaev-api/src/main/java/io/openaev/rest/mcp/McpToolProvider.java
Outdated
Show resolved
Hide resolved
openaev-api/src/main/java/io/openaev/rest/mcp/McpToolProvider.java
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull request overview
Embeds an MCP (Model Context Protocol) server into OpenAEV (backend) and exposes connection details in the user profile (frontend), enabling MCP-compatible clients to call OpenAEV tools over Streamable HTTP.
Changes:
- Add embedded MCP server configuration and register a servlet at
/api/mcp/*. - Implement 29 MCP tools that proxy to existing internal REST APIs for parity and permission enforcement.
- Add “MCP access” section in the profile page and introduce related EN/FR translations.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| openaev-api/src/main/java/io/openaev/config/McpServerConfig.java | Registers MCP transport servlet and builds the MCP sync server (feature-flagged). |
| openaev-api/src/main/java/io/openaev/rest/mcp/McpToolProvider.java | Defines 29 MCP tools and internal HTTP proxy helpers. |
| openaev-api/pom.xml | Adds MCP SDK BOM + core/Jackson2 modules. |
| openaev-front/src/admin/components/profile/Index.jsx | Adds UI section to display MCP endpoint + copyable client config. |
| openaev-front/src/utils/lang/en.json | Adds MCP-related translation keys (EN). |
| openaev-front/src/utils/lang/fr.json | Adds MCP-related translation keys (FR). |
openaev-api/src/main/java/io/openaev/rest/mcp/McpToolProvider.java
Outdated
Show resolved
Hide resolved
openaev-api/src/main/java/io/openaev/rest/mcp/McpToolProvider.java
Outdated
Show resolved
Hide resolved
openaev-api/src/main/java/io/openaev/rest/mcp/McpToolProvider.java
Outdated
Show resolved
Hide resolved
openaev-api/src/main/java/io/openaev/rest/mcp/McpToolProvider.java
Outdated
Show resolved
Hide resolved
openaev-api/src/main/java/io/openaev/rest/mcp/McpToolProvider.java
Outdated
Show resolved
Hide resolved
…ttings toggle - Add path traversal protection with validatePathSegment() and UriComponentsBuilder - Use shared Spring RestTemplate bean instead of creating a new instance - Fix Bearer token case-insensitive check - Throw exception on missing authentication instead of silent failure - Use constants for hardcoded payload source strings - Fix empty string validation for Command payload fields - Fix clipboard API error handling in frontend - Add platform_mcp_enabled DB-backed setting (SettingKeys + PlatformSettings) - Add PUT /api/settings/platform_mcp endpoint - Add MCP toggle in admin Parameters page - Check MCP enabled at runtime in tool handlers - Add rate limiting TODO note Made-with: Cursor
… signature Made-with: Cursor
Made-with: Cursor
…arer case, settings) Made-with: Cursor
…, ru, zh) Made-with: Cursor
…ckServer conflict Made-with: Cursor
…1.x, MCP SDK pulls 2.x) Made-with: Cursor
Member
|
@SamuelHassine Impossible to run the back-end on my side Do we need this lib or I am missing something ? |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Embeds a native Model Context Protocol (MCP) server directly into OpenAEV, exposing 29 adversarial exposure validation tools via the Streamable HTTP transport (MCP spec 2025-03-26).
Any MCP-compatible AI client (Claude Desktop, Cursor, Filigran Copilot, etc.) can now connect directly to OpenAEV at
POST /api/mcpand interact with scenarios, assets, payloads, and findings -- no intermediary platform required.Closes #5219
Changes
Backend (
openaev-api)config/McpServerConfig.java: Spring@Configurationthat registersHttpServletStreamableServerTransportProvideras a Servlet bean mapped to/api/mcp/*. Creates aMcpSyncServerwith all 29 tools.rest/mcp/McpToolProvider.java: All 29SyncToolSpecificationdefinitions. Each tool handler extracts the Bearer token from the request and calls the internal REST API via shared SpringRestTemplate. Includes path traversal protection (validatePathSegment+UriComponentsBuilder), case-insensitive Bearer handling, auth exception on missing token, and runtime MCP enabled check via DB setting.rest/settings/form/SettingsMcpUpdateInput.java: Settings update DTO.pom.xml: Addedio.modelcontextprotocol.sdk:mcp-coreandmcp-json-jackson2(Jackson 2.x compatible with Spring Boot 3.5).PlatformSettingsApi.java: AddedPUT /api/settings/platform_mcpendpoint.PlatformSettings.java: AddedplatformMcpEnabledfield.PlatformSettingsService.java: Read/write MCP setting from DB.SettingKeys.java: AddedPLATFORM_MCP_ENABLEDenum constant.Frontend (
openaev-front)profile/Index.jsx: New "MCP access" section on the user profile page showing the endpoint URL and a ready-to-copy JSON configuration snippet for MCP clients.settings/Parameters.tsx: Admin toggle for MCP server enable/disable.actions/Application.ts: MCP settings update action.utils/api-types.d.ts: TypeScript types for MCP settings.utils/lang/en.jsonandfr.json: Added MCP-related translation keys.Tools exposed (29)
search_openaev_assets,get_openaev_asset,search_openaev_asset_groups,get_openaev_asset_groupsearch_openaev_teams,get_openaev_team,search_openaev_playerssearch_openaev_attack_patterns,get_openaev_attack_patternsearch_openaev_scenarios,get_openaev_scenario,create_openaev_scenario,update_openaev_scenario,delete_openaev_scenariocreate_openaev_payload,get_openaev_payload,search_openaev_payloadsadd_openaev_inject_to_scenario,search_openaev_injector_contracts,get_openaev_injector_contractcreate_openaev_atomic_testingsearch_openaev_findings,get_openaev_vulnerabilityfull_text_search_openaevlist_openaev_kill_chain_phases,list_openaev_tags,list_openaev_domainssearch_openaev_exercises,get_openaev_exerciseTest plan
POST /api/mcpreturns proper JSON-RPC responsestools/listreturns all 29 tools with correct schemastools/callfor search, CRUD, and scenario operations