AI

Query Any .NET Codebase from Your AI Agent with the Metalama MCP Server

Metalama / PostSharp Blog Gaël Fraiteur
AI

Metalama MCP is a free, open-source server that loads a .NET solution once and lets an AI coding agent query the compiler's semantic model for types, members, references and aspect instances, with an interactive HTML view for you.

Key points

  • Five tools are exposed: load_workspace, reload_workspace, unload_workspace, query and open.
  • It loads .csproj, .sln, .slnx and .slnf files with MSBuild and Roslyn; projects need no Metalama reference.
  • AllImplementedInterfaces includes interfaces inherited from base types, which no text search can produce.
  • GetInboundReferences(), GetOutboundReferences() and GetDerivedTypes() return references with their kind, such as implementation or DI registration.
  • Multi-targeted projects load once per target framework, so the agent can report what differs between them.
  • Install with dotnet tool install -g Metalama.Mcp; it needs the .NET 10 SDK, plus dotnet dev-certs https --trust for the browser view.

Real-world use

  • An unfamiliar third-party codebase such as MediatR, where you need every type implementing IPipelineBehavior.
  • Auditing a solution that uses Metalama aspects to see where [Cache] applies and which methods are cached.
  • Finding complexity hotspots by ranking types on method and property counts.
  • Comparing a multi-targeted project between net6.0 and netstandard2.0 without opening the files.

This summary was generated by the agent from the original post on Metalama / PostSharp Blog. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message