Skip to content

[FLINK-AGENTS] Fix Java agents failing to connect to MCP servers without prompt support (#538)#539

Open
avichaym wants to merge 1 commit intoapache:mainfrom
avichaym:fix/mcp-optional-prompts
Open

[FLINK-AGENTS] Fix Java agents failing to connect to MCP servers without prompt support (#538)#539
avichaym wants to merge 1 commit intoapache:mainfrom
avichaym:fix/mcp-optional-prompts

Conversation

@avichaym
Copy link

Linked issue: #538

What is the purpose of the change

Fix Java agents failing with McpError: Method not found when connecting to MCP servers that don't support prompts (e.g., AgentCore Gateway). PR #447 fixed the Python path (#412) but the Java path in AgentPlan.extractJavaMCPServer was not addressed.

Brief change log

  • Add MCPServer.supportsPrompts() — checks McpSyncClient.getServerCapabilities().prompts() != null
  • Guard listPrompts call in AgentPlan.extractJavaMCPServer with supportsPrompts() via reflection
  • Add unit test verifying supportsPrompts method exists and is reflection-callable

Does this pull request potentially affect one of the following parts

  • Runtime / Operators: no
  • Plan: yes (AgentPlan.extractJavaMCPServer)
  • Integrations / MCP: yes (MCPServer.supportsPrompts)

How was this patch tested?

  • Unit test: MCPServerTest.testSupportsPromptsMethodExists
  • End-to-end: Tested with Amazon Bedrock AgentCore Gateway (tools-only MCP server, capabilities.prompts=null). Agent plan creation succeeds, tools are discovered, Flink job completes successfully.

Documentation

  • doc-not-needed

…upport

PR apache#447 fixed the Python MCP path but not the Java path.
AgentPlan.extractJavaMCPServer calls listPrompts() unconditionally,
which fails with 'Method not found' for MCP servers that only support
tools (e.g. AgentCore Gateway).

- Add MCPServer.supportsPrompts() checking ServerCapabilities.prompts()
- Guard listPrompts call in extractJavaMCPServer with supportsPrompts check
@github-actions github-actions bot added priority/major Default priority of the PR or issue. fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. doc-not-needed Your PR changes do not impact docs labels Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments