Skip to content

Options Reference

HangfireMcpOptions is configured via the delegate passed to AddHangfireMcp:

csharp
builder.Services.AddHangfireMcp(o =>
{
    o.Sources = JobDiscoverySources.All;
    o.Filter  = rj => !rj.Id.StartsWith("internal.");
});
PropertyTypeDefaultPurpose
SourcesJobDiscoverySources (flags)RecurringStorageWhich discovery source(s) to use. Combine with | or use All.
FilterFunc<RecurringJobDto, bool>?null (no filter)Predicate applied to recurring entries before scanning. Returning false excludes the job from the catalog.

JobDiscoverySources

csharp
[Flags]
public enum JobDiscoverySources
{
    RecurringStorage = 1,
    StaticManifest   = 2,
    All              = RecurringStorage | StaticManifest,
}

Parameter binding rules

These rules apply to every tool the catalog produces:

  • C# default is used when the argument is omitted from the tool call.
  • Nullable type (T? value or annotated reference) without a default → bound to null when omitted.
  • Otherwise required — a missing argument returns an MCP error.

Schema mapping

C# signatureJSON Schema
string namerequired string
string format = "pdf"optional string (default applied server-side)
string? tagoptional string (nullable reference)
int? priorityoptional integer (nullable value type)
ExportFormat formatrequired string enum
IReadOnlyList<string> tablesrequired array of strings
Message messagerequired object with inferred JSON Schema
DateTimeOffset? sinceoptional string (ISO 8601)

Endpoint mapping

MapHangfireMcp(path) returns an IEndpointConventionBuilder so you can chain ASP.NET Core conventions — most importantly RequireAuthorization. See Authentication.