Skip to content

Setting up MCP Problem Type Skeleton#1569

Open
guidorc wants to merge 7 commits into
WebFuzzing:masterfrom
guidorc:feature/mcp-skeleton
Open

Setting up MCP Problem Type Skeleton#1569
guidorc wants to merge 7 commits into
WebFuzzing:masterfrom
guidorc:feature/mcp-skeleton

Conversation

@guidorc

@guidorc guidorc commented Jun 5, 2026

Copy link
Copy Markdown

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 the streamableHTTP transport mechanism. At this point we'll only be considering the tools and resources capabilities of the MCP server under analysis.

Main Changes

  • EMConfig: adds MCP as an experimental ProblemType with a required bbTargetUrl validation guard
  • Main: minimal setup for MCP problem type (throws not yer supported error)
  • 14 new classes/interfaces under core/.../problem/mcp/

Class hierarchy

  • McpClient (interface)

    • HttpMcpClient — HTTP/JSON-RPC 2.0 transport (stubbed)
  • ApiWsSampler

    • McpSampler — discovers capabilities, builds individuals (stubbed)
  • MainAction

    • McpAction (abstract)
      • McpToolCallAction — calls a named tool with an ObjectGene payload
      • McpResourceReadAction — reads a resource/template by URI
  • Param

    • McpInputParam — wraps the tool input ObjectGene
    • McpUriParam — wraps the resource URI StringGene
  • ActionResult

    • McpCallResult — carries the isError flag for one action execution
  • ApiWsIndividual

    • McpIndividual — ordered sequence of McpActions; unit of search
  • FitnessFunction

    • McpFitness (abstract)
      • McpBlackBoxFitness — blackbox coverage scoring (stubbed)

@Pgarrett Pgarrett requested a review from jgaleotti June 5, 2026 13:00
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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not INITIALIZATION_DNS?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 enforces bbTargetUrl in 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.

Comment thread core/src/main/kotlin/org/evomaster/core/Main.kt
Comment thread core/src/main/kotlin/org/evomaster/core/problem/mcp/McpAction.kt

@arcuri82 arcuri82 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @guidorc thx for your first PR!


@PostConstruct
fun initialize() {
mcpClient = HttpMcpClient(config.bbTargetUrl)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use base, as bbTargetUrl is deprecated

}

fun removeMcpActionAt(relativePosition: Int) {
killChildByIndex(relativePosition)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might be wrong. might need to use removeMainActionGroupAt here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you're right since we're using EnterpriseActionGroup

import org.evomaster.core.search.gene.string.StringGene

class McpResourceReadAction(
val uri: StringGene,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the uri here? and does it need to be mutable in a gene?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use base

guidorc and others added 4 commits June 9, 2026 21:24
@guidorc guidorc requested a review from arcuri82 June 13, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants