MCP Apps: Add [McpAppResource] attribute and resource-collection processing in WithMcpApps()
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- csharp
- Domain
- backend-api-design
Research direction
Start by comparing the existing McpAppUi attribute and WithMcpApps() processing with the resource-side SetResourceUi path. Add the resource attribute and resource-collection handling, or implement the minimum in Program.cs using SetResourceUi(). Update the sample so typed McpUiResourceMeta and McpUiResourceCsp types are exercised instead of raw JSON.
Written by the indexing model from the issue text.
Description
From PR #1484 review comment by @halter73:
The tool-side has three layers (attribute → builder → programmatic), but resource-side currently only has programmatic (SetResourceUi). There's no [McpAppResource] attribute and WithMcpApps() doesn't process the resource collection.
Server authors using attribute-based registration currently fall back to raw JSON strings in [McpMeta] to set UI metadata on resources, bypassing the typed McpUiResourceMeta / McpUiResourceCsp types.
Preferred approach:
Add [McpAppResource] mirroring [McpAppUi] and extend WithMcpApps() to iterate options.ResourceCollection. Then the sample can drop the raw JSON and use:
[McpServerResource(...)]
[McpAppResource(ConnectDomains = new[] { "https://api.weather.gov" }, PrefersBorder = true)]
public static string GetWeatherForecastUi() => ...;
Minimum:
Update the sample to call SetResourceUi() from a manual-registration code path in Program.cs so the typed types are exercised somewhere in user-facing docs.
Related to #1607.
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 814
- Avg merge
- 9d 19h
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/csharp-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelcontextprotocol/csharp-sdk#1867 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
modelcontextprotocol/csharp-sdk#1840 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
modelcontextprotocol/csharp-sdk#1836 ·
-
enhancement needs confirmation
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
modelcontextprotocol/csharp-sdk#678 · 1 comment ·
-
enhancement needs confirmation P3 ready for work
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/csharp-sdk#515 · 6 comments · 3 reactions ·
All issues in modelcontextprotocol/csharp-sdk
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·