Plugin-Based Request Handler Assemblies
In small applications, request handlers may live directly inside the main server project. In larger systems, a plugin-based architecture is often more scalable. Groups of related request handlers can be implemented in separate assemblies that are built independently and copied into a known plugin folder at deployment time.
The "Automatic Discovery and Registration" page described the process of scanning assemblies and loading only those decorated with the RpcAssembly attribute. In practice, such assemblies are usually deployed into a predefined plugin folder configured in the application's appsettings.json file, similar to:
{
"McpTools": {
"PluginFolder": "Modules"
}
}
At startup, the host scans this folder, loads matching assemblies, discovers request handlers, and registers them automatically.
Projects that produce plugin assemblies can use an MSBuild Target to automatically copy their output into the configured Modules folder after the build completes. For example:
<Target Name="CopyOutputToMcpModules" AfterTargets="Build">
<MakeDir Directories="Modules" />
<ItemGroup>
<McpPluginFiles Include="$(TargetDir)*.dll" />
<McpPluginFiles Include="$(TargetDir)*.pdb" />
<McpPluginFiles Include="$(TargetDir)*.json" />
</ItemGroup>
<Copy SourceFiles="@(McpPluginFiles)" DestinationFolder="Modules" SkipUnchangedFiles="true" />
</Target>
The exact destination path depends on the solution structure and deployment model. The example above uses a simplified folder layout for clarity.
The host does not need to know about every module at compile time. New handler assemblies can be added by deployment, discovered at startup, and exposed through /rpc/tools and MCP tools/list.
Table of Content Operation-Oriented APIs and AI Tools Previous: MCP Concepts Without the Mystery Next: Production Hardening Checklist
Business Process Programming in .Net
© 2004–2026 Laskarzhevsky Software Inc.
Unless otherwise noted, the content of this website is licensed under the
Creative Commons Attribution 4.0 International License (CC BY 4.0).
Code examples are provided under the MIT License.
You are free to share and adapt the material provided that appropriate
credit is given and any modifications are clearly indicated.
The information provided on this website is for educational purposes only.
The author and publisher make no warranties regarding the completeness
or suitability of the information and are not responsible for any damages
resulting from its use.