Skip to content

Make it possible to supply meta data for discovery and resources#20

Merged
thekid merged 3 commits intomainfrom
feature/meta
Feb 3, 2026
Merged

Make it possible to supply meta data for discovery and resources#20
thekid merged 3 commits intomainfrom
feature/meta

Conversation

@thekid
Copy link
Copy Markdown
Member

@thekid thekid commented Feb 2, 2026

This PR adds low-level support for adding _meta to discovery and to resource contents, enabling us support MCP Apps, the first step for implementing #19

Example

use io\modelcontextprotocol\server\{Implementation, Tool};

#[Implementation]
class Greeting {

  /** Greeting card */
  #[Tool(meta: ['ui' => ['resourceUri' => 'ui://greeting/app']])]
  public function card() {
    return 'App launching...';
  }

  /** Greeting app */
  #[Resource('ui://greeting/app', 'text/html;profile=mcp-app')]
  public function app() {
    return [
      '_meta' => ['ui' => ['csp' => ['resourceDomains' => ['http://localhost:8080']]]],
      'text'  => <<<'HTML'
         ...
      HTML,
    ];
  }
}

@thekid thekid added the enhancement New feature or request label Feb 2, 2026
@thekid
Copy link
Copy Markdown
Member Author

thekid commented Feb 3, 2026

FastMCP uses a meta field inside the decorator, e.g.:

@mcp.tool(meta={
    "ui":{"resourceUri": VIEW_URI},
    "ui/resourceUri": VIEW_URI, # legacy support
})

This would save us extra checks for a Meta annotation during discovery, and would change the code as follows:

- #[Tool, Meta(['ui' => ['resourceUri' => 'ui://greeting/app']])]
+ #[Tool(meta: ['ui' => ['resourceUri' => 'ui://greeting/app']])]

@thekid thekid merged commit 182e2aa into main Feb 3, 2026
16 checks passed
@thekid thekid deleted the feature/meta branch February 3, 2026 19:21
@thekid
Copy link
Copy Markdown
Member Author

thekid commented Feb 3, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant