Server startup always loads all tool assemblies
- Dominant language
- C#
- Stars
- 3.7k
- Forks
- 624
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 220
Description
Our server startup currently has Program.cs statically loading the setup classes from every tool assembly:
```cs
internal class Program
{
private static IAreaSetup[] Areas = RegisterAreas();
private static IAreaSetup[] RegisterAreas()
{
return [
// Register core areas
new Azure.Mcp.Tools.AzureBestPractices.AzureBestPracticesSetup(),
new Azure.Mcp.Tools.Extension.ExtensionSetup(),
// Register Azure service areas
new Azure.Mcp.Tools.Aks.AksSetup(),
new Azure.Mcp.Tools.AppConfig.AppConfigSetup(),
new Azure.Mcp.Tools.AppLens.AppLensSetup(),
...
```
This means that every process start, even for calls like `azmcp --help` or `azmcp --version` load at least 53 assemblies.
This causes time to first message to be ~15 seconds on a single run and >60 seconds when processes are started concurrently.
Refactoring app startup to delay tool assembly loading until that tool is being invoked would greatly improve single command calls and metadata calls like `--help` and `--version`.
This requires making command metadata available to the server without having the tool assembly loaded. That would require either moving the command definition out of the tool assembly or source generating enough command definition to support server startup, mcp tool listing and `--help` calls from the server assembly without pre-loading the tool assemblies.
Contributor guide
Assessment
This issue has not been assessed yet.