Class McpSkillsOptions
- Namespace
- ModelContextProtocol.Extensions.Skills
- Assembly
- ModelContextProtocol.Extensions.Skills.dll
Configures the behavior of the MCP Skills extension on a server.
[Experimental("MCPEXP005", UrlFormat = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp005")]
public sealed class McpSkillsOptions
- Inheritance
-
McpSkillsOptions
- Inherited Members
Properties
GetSkillFilters
Gets or sets the filters for the complete Skills get pipeline.
public IList<McpRequestFilter<GetSkillRequestParams, GetSkillResult>> GetSkillFilters { get; set; }
Property Value
Remarks
Filters run in registration order after URI matching, before either the registered get or custom fallback. MatchedPrimitive contains the matched McpServerSkill, or is null for an unregistered URI. Filters can authorize the request, short-circuit dispatch, and modify the result and cache hints. The final entry is validated and bound to the original request URI. Configure filters before server initialization, and resolve scoped dependencies inside the returned handler using Services. These filters do not protect file-resource requests.
GetSkillHandler
Gets or sets the fallback handler for skills not found in SkillCollection.
public McpRequestHandler<GetSkillRequestParams, GetSkillResult>? GetSkillHandler { get; set; }
Property Value
Remarks
Matched registrations invoke GetAsync(RequestContext<GetSkillRequestParams>, CancellationToken) before this fallback, even when their ProtocolSkill is null. This handler cannot intercept or authorize registrations; use GetSkillFilters to wrap both dispatch paths. Registered implementations and filters may supply per-result cache hints; omitted hints default to zero/private on modern protocols. Older protocols omit them. Throw McpProtocolException with InvalidParams when the caller cannot retrieve the requested skill.
Authorize application-owned entries before pagination and protect the corresponding file resources separately. Local metadata does not grant authorization automatically. Skills participation in resource authorization filters is not implemented. Services, serialization, validation, caching, and authorization follow ListSkillsHandler.
ListSkillsFilters
Gets or sets the filters for the complete Skills listing pipeline.
public IList<McpRequestFilter<ListSkillsRequestParams, ListSkillsResult>> ListSkillsFilters { get; set; }
Property Value
Remarks
Filters run in registration order and wrap the custom handler and registered-entry augmentation. They can inspect the caller, short-circuit the request, and modify the complete page and its cache hints. Authorize paginated application sources before taking a page; filtering a finished page does not make its cursor safe. Results returned by filters are validated before serialization. Configure filters before server initialization, and resolve scoped dependencies inside the returned handler using Services.
ListSkillsHandler
Gets or sets a handler for listing application-supplied skills.
public McpRequestHandler<ListSkillsRequestParams, ListSkillsResult>? ListSkillsHandler { get; set; }
Property Value
Remarks
The handler owns its page and cursor. Non-null registered ProtocolSkill entries are appended only when the request cursor is null, without invoking GetAsync(RequestContext<GetSkillRequestParams>, CancellationToken). The handler may list get-only registrations, but must not duplicate non-null registered listing entries. Omitting a skill from application listings does not prevent direct retrieval.
Resolve application dependencies from the supplied context's Services. The SDK owns serialization, entry validation, and protocol-version gating of cache hints. A handler's cache hints apply to the complete augmented page, including registered entries. An otherwise empty result can supply hints for a static listing. Public caching must be valid for every returned entry. When hints are omitted, conservative wire defaults apply. Enforce per-caller visibility; the built-in resource authorization filters do not run for Skills requests. ListSkillsFilters wrap the complete listing, including registered entries. Composition appends to the returned list directly, as Core does. Return a fresh mutable page when registrations are included.
SkillCollection
Gets or sets the registered server-side skills.
public McpServerSkillCollection SkillCollection { get; set; }
Property Value
Remarks
DI contributions use TryAdd during configuration, before the callback supplied to WithSkills.
Later configuration can inspect, remove, or replace them; the first accepted identity wins when adding.
Non-null listing manifests are checked once during server initialization, not on
runtime mutations. File resources are registered independently through WithResources or
WithSkillPackages(IMcpServerBuilder, IEnumerable<McpServerSkillPackage>), even when configuration removes a skill.
Collection changes affect Skills listing/get only. Manage resource availability separately;
removing an entry does not revoke access to its resources.