How to use Agent Framework (Python) AG-UI Server with MCP Apps and render UI back to frontend #3937
Replies: 1 comment
|
I believe the missing piece is the MCP Apps → AG-UI event/resource bridge rather than the HostedMCPTool invocation itself. HostedMCPTool can successfully execute the MCP tool, but an MCP App is not just a normal tool result. The UI is exposed as an MCP App/resource, so the result needs to be propagated through the Agent Framework → AG-UI stream in a form that CopilotKit's MCP Apps integration can consume. Your current flow is essentially: The tool call succeeding only confirms the bottom half is working. The missing part appears to be propagating the MCP App UI/resource information back through the AG-UI stream. I would therefore check whether the Agent Framework AG-UI integration currently emits the MCP App resource/UI information, rather than only the normal tool-call/tool-result events. If it does not, wrapping the HostedMCPTool or adding the MCP Apps middleware on the frontend won't by itself solve it; the MCP App resource needs to be bridged into the AG-UI/CopilotKit MCP Apps protocol. So, unless there is already an Agent Framework MCP Apps integration that I'm missing, I don't think there is a configuration change to the HostedMCPTool in the code above that will make the UI render automatically. The integration point is the Agent Framework → AG-UI layer. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Is it possible to use MCP Apps with AG-UI Server?
I currently have an AG UI Server with MS Foundry Agent having MCP App tool
Agent Framework AG UI Server:
The MCP App is taken from this code https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-react.
The FrontEnd is using CopilotKit HttpAgent to call the AG UI Server
The tool call works fine, however the UI is not returned successfully to frontend.
Output from CopilotKit Frontend using AG UI MS Agent Framework Foundry Agent
When using CopilotKit Built-In Agent (https://docs.copilotkit.ai/generative-ui/specs/mcp-apps) together with the MCP App, the output renders the UI successfully
Output from CopilotKit Frontend using AG UI Built In Agent
How do I get MCP App to work with Agent Framework?
All reactions