Repository navigation
Add Agent Tools: application services as governed AI tools, with an MCP endpoint and OpenIddict helpers - #26564
Merged
Merged
Conversation
- New docs/en/modules/agent-tools: overview, installation, exposing tools, policy and management page, chat clients, MCP endpoint, OpenIddict setup, AI Management integration, security notes - docs-nav.json entry next to AI Management; Agent Tools integration section in the AI Management docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent Tools exposes the application services and controllers of an application as AI tools. Each tool is an HTTP API action, called in-process through its service interface with ABP's authorization, tenant, unit of work and audit logging. Nothing is exposed unless the application opts in. - Volo.Abp.AgentTools.Abstractions: attributes, error codes, feature name and localization. - Volo.Abp.AgentTools: options, abstractions, input schemas, argument redaction and the tool policy in appsettings.json or code. - Volo.Abp.AgentTools.AspNetCore: tool discovery, invocation and the tool provider for IChatClient. - Volo.Abp.AgentTools.Mcp: a stateless MCP endpoint. - Volo.Abp.OpenIddict.AgentTools: scope, resource and client seed, resource permissions and token confinement for the MCP endpoint. ModelContextProtocol moves to 1.1.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The open source pages (overview, exposing tools, chat clients, policy, MCP endpoint, OpenIddict setup, security notes) are under the artificial intelligence section. The Agent Tools module pages cover the per-tenant management. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 of 2 tasks
MansurBesleney
marked this pull request as ready for review
November 27, 2026 08:30
enisn
approved these changes
Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
No linked issue. This PR adds Agent Tools to the open source framework, with tests and documentation. It replaces the documentation-only draft #26532.
1. Summary
Agent Tools turns the application services and controllers of an ABP application into AI tools that the application governs. Each tool is one HTTP API action, discovered from ABP's API description model and called in-process through its service interface. Every call is permission-checked and tenant-scoped, runs in its own unit of work, and is audit-logged when an audit scope is active (as in HTTP requests). A per-tool policy in
appsettings.jsonor code decides whether a tool is enabled and whether it requires human approval. AnyIChatClientcan use the tools, and external agents such as Claude Code can use them over an MCP endpoint that needs a bearer token. Nothing is exposed unless the application opts in.Why in the framework: the value of a tool call is that it runs through ABP's own permissions, tenant, unit of work and audit. Every ABP application has these, so the runtime belongs next to them. Management on top of it (a policy stored per tenant, management pages) is not part of this PR: the commercial module builds on these packages.
2. Packages
Volo.Abp.AgentTools.Abstractionsframework/src[AgentTool],[DisableAgentTool],AgentToolKind, error codes, feature name, localization (en, tr)Volo.Abp.LocalizationVolo.Abp.AgentToolsframework/srcVolo.Abp.Features,Microsoft.Extensions.AI.AbstractionsVolo.Abp.AgentTools.AspNetCoreframework/srcVolo.Abp.AgentTools,Volo.Abp.AspNetCore.MvcVolo.Abp.AgentTools.Mcpframework/srcModelContextProtocol.AspNetCoreVolo.Abp.OpenIddict.AgentToolsmodules/openiddict/srcVolo.Abp.OpenIddict.AspNetCoreModule classes:
AbpAgentToolsAbstractionsModule,AbpAgentToolsModule,AbpAgentToolsAspNetCoreModule,AbpAgentToolsMcpModule,AbpOpenIddictAgentToolsModule.Volo.Abp.AgentToolsdoes not depend onVolo.Abp.Ddd.Domainor MVC.Existing files changed:
framework/Volo.Abp.slnx,modules/openiddict/Volo.Abp.OpenIddict.slnxand.abpmdl,nupkg/common.ps1,Directory.Packages.props(section 5).3. How it works
AbpAgentToolOptions: remote service name, root path or type predicate), with aMaxToolsguard (default 150) that fails at startup. Never tools: anonymous actions, integration services, non-JSON inputs, parameters bound from services or headers,[DisableAgentTool],[RemoteService(false)].[AgentTool]overrides this in code.IAgentToolProvidergives the current user's tools asAIFunctions. A tool that requires approval is wrapped inApprovalRequiredAIFunction, and is left out for a client without approval support.AgentTools.Enable(defaulttrue): when it is off for a tenant, the tool list is empty and every call is refused.IAgentToolCallObservergets one record per call, with redacted arguments.Policy in
appsettings.json{ "AgentTools": { "Tools": { "Product_Delete": { "Enabled": false }, "Product_Create": { "RequiresApproval": false } } } }Configure<AbpAgentToolPolicyOptions>, else the code default. It is the same for the host and every tenant, and is read once at startup. The configuration beatsConfigureon purpose, so aConfigurecall cannot re-enable whatappsettings.jsondisables. A laterPostConfigureor a replaced policy store still can.true/falsestops startup, and the message names the key, not the value. The configuration binder is not used here: even withErrorOnUnknownConfigurationit takes""and[]as "not set", which would leave a tool enabled.Tools, a tool directly underAgentTools), are logged as errors at startup. Startup continues, because a configuration may serve several applications.IAgentToolPolicyStorecan be replaced. The startup checks run whatever store is registered.MCP endpoint
/mcp(AbpAgentToolsMcpOptions.Path), mapped by the module throughUseConfiguredEndpoints, with an RFC 9728 metadata document at the path-specific well-known URL (/.well-known/oauth-protected-resource/mcp), which the 401 names. The bare well-known path is left to the application.AgentTools), a user, and must not name a tenant other than the token's (active) tenant. The application does not start when the endpoint's scheme is not registered or is a cookie or policy scheme.MapMcpendpoint. With a shared registration, two modules that each map an MCP endpoint would serve each other's tools, each without the other's checks, and would share the session mode. So this endpoint has a small service container of its own.McpServerOptions, tools and filters of the application or of another module do not reach it, and no other endpoint serves the agent tools. Other MCP endpoints keep their ownAddMcpServer, tools, authorization and metadata.OpenIddict helpers
AgentTools(standard scopes such asopenidandoffline_accessdo not count) is accepted at the endpoint only, whatever its audiences; so is a token that has the MCP URL as audience and no other audience that the host accepts. The server refuses withinvalid_scopea token request of a grant whose only API scope isAgentToolswhen its scope parameter leaves that scope out. In a host that restricts the audiences it accepts, as the templates do, this keeps a client that is granted only this scope away from the REST API behind the tools it is not offered (the docs tell to restrict them).ConfineScopeToMcpEndpoint = falseleaves the decision to the audiences, for an application that gives the scope an API resource on purpose. This applies to hosts that load the package and validate with OpenIddict (not to the endpoints of the OpenIddict server itself); a JwtBearer host uses a scheme of its own for the endpoint (documented).AgentTools:Mcp:Clients, resource permission sync (every application with the scope getsrsrc:<MCP URL>, which clients that send RFC 8707resourceneed), optional S256-only PKCE, token entry validation on by default, and a startup validator (it logs an error when the stored scope does not have the MCP URL as a resource).4. Security notes
RequireAuthorizationare not applied in-process. Attributes are.5. Compatibility
Volo.Abp.OpenIddict.AgentToolsturns on token entry validation application-wide (one read of the token entry per bearer request;EnableTokenEntryValidation = falseopts out), replaces the OpenIddict application store with a subclass, and needs the MCP URL (App:SelfUrlorMcpResource) at startup while the resource permission sync is on. Tool schemas list non-nullable value-type DTO properties without a default as required (RequireNonNullableValueTypes); ABP paging and sorting members are exempt.ModelContextProtocolmoves from 0.5.0-preview.1 to 1.1.0 (used byVolo.Abp.Cli.Core), so that a stable package does not depend on a preview.ModelContextProtocol.AspNetCore1.1.0 andMicrosoft.Extensions.AI.Abstractions10.3.0 are new pins. Later SDK versions need a newerMicrosoft.Extensions.AI, which has to move together with Semantic Kernel; that is left to a separate change.Volo.Abp.AIstill resolves the versions it did.6. Documentation
Open source pages under
docs/en/framework/infrastructure/artificial-intelligence/agent-tools/(overview, exposing tools, chat clients, policy, MCP endpoint, OpenIddict setup, security notes), and the pages of the commercial module underdocs/en/modules/agent-tools/.docs-nav.json, the AI overview page, the module lists, the AI Management page, the React Admin Console page and the licence comparison follow. All relative links and anchors resolve. The C# samples were compiled against the packages, and the startup and precedence rules of the policy page were run in a throwaway application.7. Testing
framework/test/Volo.Abp.AgentTools.Testsframework/test/Volo.Abp.AgentTools.AspNetCore.Testsframework/test/Volo.Abp.AgentTools.Mcp.Testsmodules/openiddict/test/Volo.Abp.OpenIddict.AgentTools.TestsAll pass, none skipped, after a merge of dev and from clean builds. Also run:
Volo.Abp.AI.Tests13,Volo.Abp.Cli.Core.Tests246, and the existing OpenIddict tests (AspNetCore 40, Domain 94, EntityFrameworkCore 37, MongoDB 35).framework/Volo.Abp.slnxandmodules/openiddict/Volo.Abp.OpenIddict.slnxbuild with 0 errors. The only new warnings areNU1902(SourceLink), which every project has; one existingNU1903ofVolo.Abp.Cli.Corenames another version.dotnet packof the five packages and ofVolo.Abp.Cli.Coresucceeds. The four test projects also pass in Release.tools/listandtools/call, refused the bad tokens, and followed the policy from files and environment variables, in Debug and in a published Release build. A second one, built from the packed packages before the last small fixes of this branch, had OpenIddict as the issuer in the application (scope and client seed, code + PKCE, consent, refresh, revocation, two tenants) and clients of the MCP SDK (1.1.0 and 2.4.0) in a separate process.Not checked: Linux; calls of a model through an MCP client application (Claude Code was connected with
claude mcp loginandclaude mcp listin the demo host of the commercial module, without a model); a running tiered solution (the JwtBearer setup of the docs is compiled, not run); MCP SDK 2.x on the server beyond a probe; framework tests outside the projects above;nupkg/pack.ps1as a whole; the rendered documentation site.8. Known limits and follow-ups
Volo.Abp.OpenIddict.AgentTools, and when data is seeded. With a separate auth server, an application saved through another host gets it with the next seed.AgentTool:Tools),AgentTools:Enableddirectly and scalar values in a misspelled section are not noticed.null(or{}) for a field in a later configuration source undoes an earlier value.AgentToolsstay confined to the endpoint meanwhile.[BindNever]members of a query DTO); the docs list these cases.9. Related PRs and merge order
Merge this PR first. The commercial module builds on these packages and follows.
Checklist
How to test it?
Volo.Abp.AgentTools.McpandVolo.Abp.OpenIddict.AgentTools, include the service withAbpAgentToolOptions, and seed a client fromAgentTools:Mcp:Clients(see the "OpenIddict Setup" page).claude mcp add --transport http --client-id claude-code --callback-port 33418 my-app https://<app>/mcp. The list has the read tools that the signed-in user may call.AgentTools:Tools:<tool>:Enabledtofalseand restart: the tool is gone. SetRequiresApprovaltofalseon a write tool: it is listed.🤖 Generated with Claude Code