Skip to content
hs-sql-agent

ASP.NET Core · NuGet

Choose a complete host or compose only the capabilities you need.

Use HsSqlAgent.Hosting for the same batteries-included composition as the official Docker image, or HsSqlAgent.Server when an existing ASP.NET Core application needs to own authentication, middleware, UI, telemetry, or approval composition.

01

Complete embedded product

HsSqlAgent.Hosting embeds the same standard first-party composition and configuration contract as Docker.

02

Custom integration

HsSqlAgent.Server lets the host select runtime, persistence, MCP, Admin API, identity, telemetry, and approvals explicitly.

03

Host-owned boundaries

Existing applications can keep their authentication, authorization, frontend, exception handling, telemetry, and middleware ordering.

Three ways to consume hs-sql-agent

Deploy the official Docker image for a standalone service. Use HsSqlAgent.Hosting when a .NET application should embed that same complete product composition. Use HsSqlAgent.Server when the host needs to replace or omit individual capabilities.

  • Standalone service: official Docker image
  • Complete embedded product: HsSqlAgent.Hosting
  • Custom ASP.NET Core integration: HsSqlAgent.Server
csharp
using HsSqlAgent.Hosting;

var builder = WebApplication.CreateBuilder(args);
builder.AddHsSqlAgentStandardHost();

var app = builder.Build();
app.UseHsSqlAgentStandardHost();
await app.RunAsync();
using HsSqlAgent.Hosting;

var builder = WebApplication.CreateBuilder(args);
builder.AddHsSqlAgentStandardHost();

var app = builder.Build();
app.UseHsSqlAgentStandardHost();
await app.RunAsync();

Keep application ownership with HsSqlAgent.Server

For an existing API, start with AddHsSqlAgentCore() and select only the capabilities the host needs. Host authorization can replace the built-in member/role identity stack, and approval providers can be supplied independently.

csharp
var hs = builder.Services.AddHsSqlAgentCore();

hs.AddHsSqlAgentRuntime();
hs.AddHsSqlAgentAdminStore(options =>
{
    options.Provider = "Postgres";
    options.ConnectionString =
        builder.Configuration.GetConnectionString("HsSqlAgent")!;
});
hs.AddHsSqlAgentHostAuthorization("SqlAgentAdmin");
hs.AddHsSqlAgentAdminApi();
var hs = builder.Services.AddHsSqlAgentCore();

hs.AddHsSqlAgentRuntime();
hs.AddHsSqlAgentAdminStore(options =>
{
    options.Provider = "Postgres";
    options.ConnectionString =
        builder.Configuration.GetConnectionString("HsSqlAgent")!;
});
hs.AddHsSqlAgentHostAuthorization("SqlAgentAdmin");
hs.AddHsSqlAgentAdminApi();

Approval integration stays outside the SQL execution primitive

MCP Elicitation remains the default first-party approval path. Standard hosting can select the official Webhook adapter through configuration, while modular hosts can register HsSqlAgent.Approvals.Webhook or their own IDmlApprovalProvider. HsSqlAgent still owns validation, approval evidence binding, commit-time revalidation, and atomic execution.