Skip to content

Conversation

@ThalesMMS
Copy link

Adds a new example simple MCP App for viewing DICOM medical images, with server-side parsing/conversion and a React-based interactive viewer.

Motivation and Context

Medical imaging (DICOM) is a common use case that demonstrates the MCP Apps SDK's ability to provide complex real-time UI interactions. This example shows how to build a prototype MCP App with image processing capabilities.

How Has This Been Tested?

  • Tested locally with Claude Desktop using sample DICOM files (single X-Ray series, located in ./dicom folder. Also tested single CT series.
  • E2E test with golden screenshot comparison.
  • npm test, npm run test:e2e -- --grep "DICOM"

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

  • Server-side DICOM parsing with dicom-parser and PNG conversion with sharp
  • React client with slice navigation, zoom/pan, and window/level adjustment
  • Supports multi-slice series with automatic sorting by instance number
  • Includes setup instructions for Claude Desktop

Introduces a new example app 'dicom-viewer-mcp-app' for viewing DICOM medical images in Claude Desktop using the MCP Apps SDK. Includes server-side DICOM parsing and PNG conversion, a React-based client with navigation and zoom controls, project configuration, and end-to-end test integration.
Reformatted the font-family property in global.css and mcp-app.module.css for improved readability by placing each font on a separate line.
Added two sample DICOM files and a .gitkeep file to the dicom directory. Updated .gitignore to allow tracking of the gitkeep file while still ignoring other DICOM files.
Reworked the DICOM viewer MCP app to fetch and render DICOM slice images on demand via a new 'get-dicom-slice' server tool, instead of embedding all images in the initial HTML. Updated the server, client logic, and UI to support this, improved error handling and fallback UI, and removed sample DICOM files from the repo. Also updated documentation and package metadata.
Refactored several long lines in server.ts, mcp-app.tsx, and servers.spec.ts to improve readability and maintain consistent code style. No functional changes were made.
Eliminated extensive debug and console logging from both the server and client code in the DICOM viewer MCP app for cleaner output and improved performance. Also updated the DICOM viewer E2E test snapshot.
Copilot AI review requested due to automatic review settings January 30, 2026 00:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new DICOM Viewer MCP App example that demonstrates server-side medical image processing with interactive client-side viewing capabilities. The implementation includes DICOM file parsing, windowing/leveling, and on-demand slice loading via MCP tools.

Changes:

  • Adds complete DICOM Viewer MCP App with React-based client and Node.js server
  • Integrates with e2e test suite with golden screenshot comparison
  • Implements on-demand slice loading to handle large medical imaging series efficiently

Reviewed changes

Copilot reviewed 14 out of 19 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
tests/e2e/servers.spec.ts Adds DICOM viewer to the test server list for e2e testing
examples/dicom-viewer-mcp-app/vite.config.ts Standard Vite configuration for React app bundling
examples/dicom-viewer-mcp-app/tsconfig.server.json TypeScript configuration for server-side code compilation
examples/dicom-viewer-mcp-app/tsconfig.json TypeScript configuration for client-side React code
examples/dicom-viewer-mcp-app/src/vite-env.d.ts Vite type definitions reference
examples/dicom-viewer-mcp-app/src/mcp-app.tsx React client implementing DICOM viewer UI with zoom, pan, and slice navigation
examples/dicom-viewer-mcp-app/src/mcp-app.module.css Styles for the DICOM viewer interface
examples/dicom-viewer-mcp-app/src/global.css Global CSS reset and base styles
examples/dicom-viewer-mcp-app/server.ts MCP server with DICOM parsing and JPEG conversion using dicom-parser and sharp
examples/dicom-viewer-mcp-app/package.json Dependencies and build scripts for the DICOM viewer server
examples/dicom-viewer-mcp-app/mcp-app.html HTML template for the viewer app
examples/dicom-viewer-mcp-app/main.ts Entry point supporting stdio and HTTP transports
examples/dicom-viewer-mcp-app/README.md Documentation with features, installation, and usage instructions
examples/dicom-viewer-mcp-app/LICENSE MIT license for the DICOM viewer example
examples/dicom-viewer-mcp-app/.gitignore Ignores build artifacts and local files
.gitignore Excludes the dicom folder containing test images from version control

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ThalesMMS and others added 7 commits January 30, 2026 10:07
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Update README to include MCP client stdio configuration and a local development example, clarify server-side rendering wording, and simplify the Claude Desktop setup instructions. Tidy up package.json: bump zod to ^4.1.13, remove the author field, and relocate types/exports/bin blocks; no functional script or dependency changes aside from the zod version.
@localden
Copy link

Thank you for your contribution @ThalesMMS. You're using a medical image example in one of your screenshots. Can you please provide some context on the source of the image and any permission you've obtained to redistribute it? Given the sensitive nature of medical content, I want to make sure that we're only merging examples that have gone through proper vetting.

@ThalesMMS
Copy link
Author

ThalesMMS commented Jan 31, 2026

Thank you for your contribution @ThalesMMS. You're using a medical image example in one of your screenshots. Can you please provide some context on the source of the image and any permission you've obtained to redistribute it? Given the sensitive nature of medical content, I want to make sure that we're only merging examples that have gone through proper vetting.

You're welcome!!

About the two X-Ray dcm files (included in commits), which are properly anonymized (through both RSNA anonymizer https://github.com/RSNA/Anonymizer + manual anonymization of additional metadata I did myself): I have authorization of redistribution which I can provide privately over NDA to any reviewer or comitee.

About the CT screenshot, it's better to change it to a screenshot of the X-Ray, because although it is properly anonymized and from a public library, I have just checked that in theory I do not have authorization of redistribution. Wait for a commit...

Replace examples/dicom-viewer-mcp-app/screenshot.png with an updated image. This updates the example app's visual asset to reflect recent UI or demo changes.
@ThalesMMS
Copy link
Author

ThalesMMS commented Jan 31, 2026

I just changed the screenshot. If you prefer, I can also squash the commits in this PR to remove the previous screenshot from the git history, and/or remove the screenshot and the two sample DICOM files altogether (and squash) if you want.

I've also shared additional context about the X-Ray images privately via LinkedIn.

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.

2 participants