Skip to content

Conversation

@ochafik
Copy link
Collaborator

@ochafik ochafik commented Dec 16, 2025

Summary

This PR syncs the branch with main after the significant restructuring in PR #182.

Original Goal (STRUCTURED_CONTENT_ONLY mode)

The original PR aimed to add structuredContent support to examples. However, PR #182 restructured the examples to be self-contained, which conflicts with the shared server-utils.ts approach.

Current State

Options

  1. Close this PR - The structured content feature can be revisited in a new PR that fits the new structure
  2. Re-implement - Add structured content support to each example's local server-utils.ts

The structuredContent feature (server returns structured data instead of JSON text, client handles both) is still valuable for demonstrating MCP capabilities but would need to be implemented differently given the new structure.

🤖 Generated with Claude Code

ochafik and others added 3 commits December 16, 2025 14:30
Add shared makeToolResult helper to server-utils.ts that supports both:
- Legacy format: JSON-stringified text in content[0].text
- New format: data in structuredContent field (when STRUCTURED_CONTENT_ONLY=true)

Updated all example servers to use makeToolResult for tool results.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Update all example app clients to handle STRUCTURED_CONTENT_ONLY mode.
When structuredContent is present in tool results, use it directly
instead of parsing JSON from content text.

Affected apps:
- basic-server-vanillajs
- budget-allocator-server
- customer-segmentation-server
- system-monitor-server
- wiki-explorer-server

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add try/catch around JSON.parse in all example apps
- Log parse errors with context for debugging
- Add debug logging to makeToolResult helper

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 16, 2025

Open in StackBlitz

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/ext-apps@162

commit: 375c858

ochafik and others added 2 commits December 16, 2025 22:18
Resolved conflicts in example server.ts files:
- Combined package imports (@modelcontextprotocol/ext-apps/server) with
  makeToolResult import from shared/server-utils.js

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
The learn_threejs tool doesn't have a UI component - it only returns
documentation text. Using registerAppTool without _meta causes a
runtime error when the function tries to access config._meta.ui.

Fixes crash: "Cannot read property 'ui' of undefined"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@ochafik ochafik changed the title feat: STRUCTURED_CONTENT_ONLY mode for examples chore: sync with main (post PR #182 cleanup) Dec 19, 2025
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