CodeEffectsMcpOptions Class

Assembly: CodeEffects.Rule.Mcp.dll
Namespace: CodeEffects.Rule.Mcp

Summary

Holds the settings that every MCP request needs, whichever libraries you add: how your application identifies the caller, the name the server shows, and the extra instructions and skills it offers.

Syntax

public sealed class CodeEffectsMcpOptions

Remarks

You never create this class. AddCodeEffectsMcp(..) creates it and passes it to your configure delegate. The options are read once, when that method runs.

The only required property is MapCaller. The server does not sign anyone in: your application authenticates the request with its own scheme (for example JWT bearer against your identity provider), and MapCaller then describes the authenticated caller to the server. Build the McpCaller from your authentication, never from what an MCP client says about itself.

Properties

  • MapCaller

    Type: System.Func<System.Security.Claims.ClaimsPrincipal, Microsoft.AspNetCore.Http.HttpContext, McpCaller>

    Gets or sets the delegate that turns the caller your authentication verified into an McpCaller: the user, the AI agent acting for them, and their permission set. The default is null, and AddCodeEffectsMcp(..) throws when it is not set.

    The server calls the delegate on every request with the request's ClaimsPrincipal and HttpContext. Return null for a caller your application does not recognize; the request is then refused. A request is also refused when the delegate returns a caller whose UserId is empty, when the request is not authenticated, and when the delegate throws; the exception is written to your application's log and the client receives a general message.

  • ServerName

    Type: System.String

    Gets or sets the name of the server, as an AI client shows it. The default is "codeeffects".

  • Instructions

    Type: System.String

    Gets or sets additional instructions for the AI agent. They are appended to the instructions the server already gives. The default is null.

  • SkillsFolder

    Type: System.String

    Gets or sets the full path of a folder of your own skills. The server serves them to every caller beside the skills of Code Effects. The default is null: no skills of yours.

    Every folder inside it is one skill, named by the folder, and holds a SKILL.md file in the Agent Skills format. The folder is read at start-up. The application does not start, and AddCodeEffectsMcp(..) throws an InvalidOperationException, when the path is relative or does not exist, when a skill breaks the format, when a skill's name begins with codeeffects- or is already taken, when a folder or file is a symbolic link, or when a file name uses a character other than letters, digits, ., _ and -.

Example

using System;
using System.IO;
using CodeEffects.Rule.Mcp;

builder.Services.AddCodeEffectsMcp(o =>
{
	o.MapCaller = mapCaller;
	o.ServerName = "contoso-rules";
	o.Instructions = "The rules in this repository govern Contoso order approval.";
	o.SkillsFolder = Path.Combine(AppContext.BaseDirectory, "ai-skills");
});

Ask on Stack Overflow - Yes, it's still active
Ask in GitHub Discussions

p102

l097 --

l102

p101

×