Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 15, 2025

Long-running MCP tools can now send viewable updates to the frontend during execution via structured progress messages. Enables real-time visual feedback, status messages in chat history, and progressive artifact display.

Implementation

Backend (notification_utils.py)

  • Parse MCP_UPDATE:{json} prefix in progress messages
  • Route three update types: canvas_update, system_message, artifacts
  • Existing progress notifications unchanged

Frontend (websocketHandlers.js)

  • Handle system_message intermediate updates (adds to chat history)
  • Handle progress_artifacts (displays files with display hints)

Protocol

# In MCP tool
update_payload = {
    "type": "canvas_update",  # or system_message, artifacts
    "content": "<html>...</html>",
    "progress_message": "Processing..."
}
await ctx.report_progress(
    progress=step,
    total=total,
    message=f"MCP_UPDATE:{json.dumps(update_payload)}"
)

Artifacts

  • Demo server: backend/mcp/progress_updates_demo/ with 3 working examples
  • Developer guide: comprehensive section in docs/03_developer_guide.md
  • Unit tests: full coverage in backend/tests/test_mcp_progress_updates.py

Update Types

Type Effect
canvas_update Displays HTML in canvas panel during execution
system_message Adds formatted message to chat (info/success/warning/error)
artifacts Sends files with display config as they're generated

Backward compatible - existing tools unaffected. CodeQL clean.

Original prompt

This section details on the original issue you should resolve

<issue_title>allow mcp servers to send viewable updates to the frontend</issue_title>
<issue_description>as part of a status update, the mcp could trigger the canvas to show something (like a plot in html or an image)
this allows longer running mcp servers to better show progress than just updating a single "system" message.
Also, support sending richer system messages where it displaces as anew item on the chat history.
Follow a similar setup for the final return type from a mcp function where there are fields that indicate how the frontend should respond. (ie. files, canvas display). </issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits November 15, 2025 18:54
- Enhanced notify_tool_progress to parse structured updates via MCP_UPDATE: prefix
- Added _handle_structured_progress_update for canvas, system messages, and artifacts
- Updated frontend to handle system_message and progress_artifacts update types
- Created progress_updates_demo MCP server with three demo tools
- Supports canvas updates, rich system messages, and progressive artifacts

Co-authored-by: garland3 <1162675+garland3@users.noreply.github.com>
- Added comprehensive section in Developer Guide
- Includes examples for canvas updates, system messages, and artifacts
- Documents the MCP_UPDATE: protocol
- References the demo server

Co-authored-by: garland3 <1162675+garland3@users.noreply.github.com>
- Tests regular progress notifications
- Tests canvas update, system message, and artifact updates
- Tests error handling for invalid JSON
- Tests percentage calculations

Co-authored-by: garland3 <1162675+garland3@users.noreply.github.com>
- Comprehensive examples for all three update types
- Setup instructions
- Troubleshooting section
- Reference documentation

Co-authored-by: garland3 <1162675+garland3@users.noreply.github.com>
Copilot AI changed the title [WIP] Allow MCP servers to send viewable updates to the frontend Enable MCP servers to send intermediate canvas updates, system messages, and artifacts during execution Nov 15, 2025
Copilot AI requested a review from garland3 November 15, 2025 19:03
Copilot finished work on behalf of garland3 November 15, 2025 19:03
@github-actions
Copy link

🔒 Security Scan Results

Security Scan Summary

Scan Results

Python SAST (Bandit)

⚠️ Security issues found in Python code

Recommendations

  • Review all SARIF files uploaded to GitHub Security tab
  • Address high and critical severity vulnerabilities immediately
  • Run npm audit fix and pip-audit locally to fix dependencies
  • Consider implementing additional security controls

Updated the progress updates demo to send HTML progress pages as base64-encoded artifacts instead of canvas updates, allowing them to be rendered in the HTML viewer with proper visualization. Also removed unused Mock import in tests and significantly simplified MCP config by removing multiple tool definitions. This improves progress reporting granularity and cleans up the codebase.
@github-actions
Copy link

🔒 Security Scan Results

Security Scan Summary

Scan Results

Python SAST (Bandit)

⚠️ Security issues found in Python code

Recommendations

  • Review all SARIF files uploaded to GitHub Security tab
  • Address high and critical severity vulnerabilities immediately
  • Run npm audit fix and pip-audit locally to fix dependencies
  • Consider implementing additional security controls

@github-actions
Copy link

🔒 Security Scan Results

Security Scan Summary

Scan Results

Python SAST (Bandit)

⚠️ Security issues found in Python code

Recommendations

  • Review all SARIF files uploaded to GitHub Security tab
  • Address high and critical severity vulnerabilities immediately
  • Run npm audit fix and pip-audit locally to fix dependencies
  • Consider implementing additional security controls

@garland3 garland3 marked this pull request as ready for review November 17, 2025 21:52
@garland3 garland3 merged commit 0137d83 into main Nov 17, 2025
9 checks passed
@garland3 garland3 deleted the copilot/allow-mcp-servers-to-send-updates branch November 17, 2025 21:52
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.

allow mcp servers to send viewable updates to the frontend

2 participants