Setting up MCP Problem Type Skeleton#1569
Conversation
| children.map { it.copy() }.toMutableList() as MutableList<ActionComponent>, | ||
| mainSize = groupsView()!!.sizeOfGroup(GroupsOfChildren.MAIN), | ||
| sqlSize = groupsView()!!.sizeOfGroup(GroupsOfChildren.INITIALIZATION_SQL), | ||
| mongoSize = groupsView()!!.sizeOfGroup(GroupsOfChildren.INITIALIZATION_MONGO) |
There was a problem hiding this comment.
why not INITIALIZATION_DNS?
There was a problem hiding this comment.
That would eventually be required for white-box testing when mocking the inner requests of a tool. But that is also the case for sqlSize and mongoSize, for now I believe we should remove those as well.
There was a problem hiding this comment.
Pull request overview
Introduces an initial Kotlin skeleton for supporting Model Context Protocol (MCP) servers as a new (experimental) EvoMaster ProblemType, adding placeholder client/action/individual/fitness/module types with stubbed behavior.
Changes:
- Adds
EMConfig.ProblemType.MCP(experimental) and enforcesbbTargetUrlin black-box mode for MCP. - Adds minimal MCP domain model (actions, params, individuals, results) plus stubbed MCP client DTOs/client interface.
- Adds a Guice module/sampler/fitness placeholders for a future MCP black-box workflow (currently stubbed/unsupported).
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| core/src/main/kotlin/org/evomaster/core/problem/mcp/service/McpSampler.kt | Adds MCP sampler skeleton (stubbed, initializes an HTTP MCP client). |
| core/src/main/kotlin/org/evomaster/core/problem/mcp/service/McpFitness.kt | Introduces MCP fitness base type for MCP individuals. |
| core/src/main/kotlin/org/evomaster/core/problem/mcp/service/McpBlackBoxModule.kt | Adds Guice bindings for MCP black-box components (sampler/fitness/etc). |
| core/src/main/kotlin/org/evomaster/core/problem/mcp/service/McpBlackBoxFitness.kt | Adds stubbed black-box fitness implementation for MCP. |
| core/src/main/kotlin/org/evomaster/core/problem/mcp/McpUriParam.kt | Adds Param wrapper for resource URI genes. |
| core/src/main/kotlin/org/evomaster/core/problem/mcp/McpToolCallAction.kt | Adds action representing an MCP tool call with object-gene payload. |
| core/src/main/kotlin/org/evomaster/core/problem/mcp/McpResourceReadAction.kt | Adds action representing an MCP resource read by URI. |
| core/src/main/kotlin/org/evomaster/core/problem/mcp/McpInputParam.kt | Adds Param wrapper for tool input genes. |
| core/src/main/kotlin/org/evomaster/core/problem/mcp/McpIndividual.kt | Adds MCP individual type (ordered sequence of MCP actions). |
| core/src/main/kotlin/org/evomaster/core/problem/mcp/McpCallResult.kt | Adds MCP action result type with isError flag. |
| core/src/main/kotlin/org/evomaster/core/problem/mcp/McpAction.kt | Adds base MCP action type extending MainAction. |
| core/src/main/kotlin/org/evomaster/core/problem/mcp/client/McpDTOs.kt | Adds minimal DTOs for MCP tools/resources/results. |
| core/src/main/kotlin/org/evomaster/core/problem/mcp/client/McpClient.kt | Adds MCP client interface (tools/resources + call/read). |
| core/src/main/kotlin/org/evomaster/core/problem/mcp/client/HttpMcpClient.kt | Adds stubbed HTTP MCP client implementation placeholder. |
| core/src/main/kotlin/org/evomaster/core/Main.kt | Adds ProblemType.MCP dispatch branch (currently throws unsupported). |
| core/src/main/kotlin/org/evomaster/core/EMConfig.kt | Adds MCP enum value and black-box bbTargetUrl validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| @PostConstruct | ||
| fun initialize() { | ||
| mcpClient = HttpMcpClient(config.bbTargetUrl) |
There was a problem hiding this comment.
use base, as bbTargetUrl is deprecated
| } | ||
|
|
||
| fun removeMcpActionAt(relativePosition: Int) { | ||
| killChildByIndex(relativePosition) |
There was a problem hiding this comment.
this might be wrong. might need to use removeMainActionGroupAt here
There was a problem hiding this comment.
I believe you're right since we're using EnterpriseActionGroup
| import org.evomaster.core.search.gene.string.StringGene | ||
|
|
||
| class McpResourceReadAction( | ||
| val uri: StringGene, |
There was a problem hiding this comment.
what is the uri here? and does it need to be mutable in a gene?
There was a problem hiding this comment.
Resources in MCP may be fixed or parametrized using URI templates, for example weather:///{city}/current where {city} is a variable. So we may want mutate the parameters. I'll research if stringGene is the appropiate type though.
| import org.evomaster.core.search.gene.ObjectGene | ||
|
|
||
| class McpToolCallAction( | ||
| val toolName: String, |
There was a problem hiding this comment.
recall that, once implementation is more stable, you will need to add JavaDcos for all those classes
| if (problemType == ProblemType.GRAPHQL && bbTargetUrl.isBlank()) { | ||
| throw ConfigProblemException("In black-box mode for GraphQL APIs, you must set the bbTargetUrl option") | ||
| } | ||
| if (problemType == ProblemType.MCP && bbTargetUrl.isBlank()) { |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Summary
Introducing a minimal class and interface structure to support Model Context Protocol (MCP) servers as a new ProblemType. No functionality is implemented yet, all methods related to MCP servers will throw an exception.
The changes are conformant to the latest MCP protocol specification
2025-11-25, and targetting servers that use thestreamableHTTPtransport mechanism. At this point we'll only be considering the tools and resources capabilities of the MCP server under analysis.Main Changes
Class hierarchy
McpClient (interface)
ApiWsSampler
MainAction
Param
ActionResult
ApiWsIndividual
FitnessFunction