feat: add MCP Apps (SEP-1865) support to platform and functions SDK#1788
Draft
simplesagar wants to merge 3 commits intomainfrom
Draft
feat: add MCP Apps (SEP-1865) support to platform and functions SDK#1788simplesagar wants to merge 3 commits intomainfrom
simplesagar wants to merge 3 commits intomainfrom
Conversation
Add resource declaration capabilities to the Gram Functions SDK, enabling function authors to declare UI resources and link tools to them following the MCP Apps specification. - Add resource(), uiResource(), and handleResourceRead() to Gram class - Add meta field to ToolDefinition for tool-to-UI linking - Update manifest() to include resources and tool meta - Update extend() to merge resources across Gram instances - Add resources capability to fromGram() MCP server conversion - Align ManifestToolV0.Meta type with ManifestResourceV0.Meta (map[string]any) Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Without this, tools/list from fromGram()-created MCP servers would not include _meta (e.g. ui/resourceUri), making it impossible for MCP Apps hosts to discover tool-to-UI resource links. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ata() helper
uiResource() now provides genuine convenience beyond setting the MIME type:
- Auto-generates `ui://{name}` URI when `uri` is omitted
- Accepts `body` + `styles` to wrap in HTML scaffold with Gram.onData() helper
- Falls back to raw `content` mode for full control
Co-Authored-By: Claude Opus 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds MCP Apps (SEP-1865) support to the Gram platform and Functions SDK, enabling function authors to declare interactive UI resources that MCP-compatible hosts can render in sandboxed iframes.
Key insight: Gram's existing resource pipeline is URI-scheme and MIME-type agnostic —
ui://resources withtext/html+mcpflow through the entire stack (manifest → DB → MCP endpoints → runner) with zero infrastructure changes.Changes
resource()+uiResource()on theGramclass for declaring resources directly in the SDKuiResource()convenience features:ui://{name}URI whenuriis omittedbody+stylesmode wraps content in an HTML scaffold withGram.onData()communication helpercontentmode still available for full controlmetaon tools — optionalmeta?: Record<string, unknown>onToolDefinitionfor linking tools to UI resources via"ui/resourceUri"fromGram()resource capability — conditionally registersresources/list+resources/readMCP handlers when resources exist_metapassthrough fix —fromGram()now correctly passes toolmetaas_metaintools/listresponseshandleResourceRead()— serves resource content (static or lazy/dynamic)extend()merges resources from other Gram instancesWhat it looks like
Test plan
pnpm test— 59 tests pass (31 source + 28 dist)uiResource()auto-URI, scaffold withGram.onData(), body-only moderesource(),handleResourceRead(),metaflow,extend()mergesfromGram()+ stdio transportmise build:server— confirm Go type change compilesRFC: https://www.notion.so/31b726c497cc8106878cfa296200188f
🤖 Generated with Claude Code