McpUserType Enumeration

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

Summary

Specifies who an MCP caller is: a person, an AI agent acting on its own, or a service.

Syntax

public enum McpUserType
{
	// A person, signed in through your identity provider. An AI agent may act for them. The default
	User = 1,

	// An AI agent acting on its own, with no person behind the call
	Agent = 2,

	// A service: your own automation, with a key or client credentials
	Service = 3
}

Remarks

Set the type through the UserType property of McpCaller. The Rule Repository stores it with the user, so that what a person, an agent and a service did can be told apart. The numeric values are permanent.

An AI client that a person signed in through is not an Agent caller: the person is the User, and the client is named in the AgentId property of the same caller. Use Agent for an AI agent that has no person behind it, and Service for automation such as a pipeline or a scheduled job.

Example

using System.Security.Claims;
using CodeEffects.Rule.Mcp;

// A client-credentials token: no person signed in, so the caller is the service itself
McpCaller? MapService(ClaimsPrincipal principal) => new McpCaller
{
	UserId = principal.FindFirst("client_id")?.Value ?? string.Empty,
	UserType = McpUserType.Service
};

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

p102

l097 --

l102

p101

×