What It Does — One Definition, Two Surfaces
Manifold is a .NET foundation that solves a specific problem: when you build a tool that needs both a CLI interface and an MCP server, you typically write the same logic twice—once for command-line parsing, once for MCP tool definitions. With Manifold, you define an operation once using C# attributes, and the source generator emits both CLI bindings and MCP tool metadata.
This means your Add operation that takes two integers can be exposed as both claude code MCP tool and a standalone dotnet run -- math add 5 3 command from the same source code.
Setup — Add Three NuGet Packages
Start with the core packages in your .csproj:
<ItemGroup>
<PackageReference Include="Manifold" Version="1.0.0" />
<PackageReference Include="Manifold.Generators" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="Manifold.Mcp" Version="1.0.0" />
</ItemGroup>
For CLI-only tools, use Manifold.Cli instead of Manifold.Mcp. For both surfaces, include both packages.
How To Apply It — Define Once, Generate Everywhere
Here's the simplest approach using static methods:
using Manifold;
public static class MathOperations
{
[Operation("math.add", Summary = "Adds two integers.")]
[CliCommand("math", "add")]
[McpTool("math_add")]
public static int Add(
[Argument(0, Name = "x")] int x,
[Argument(1, Name = "y")] int y)
{
return x + y;
}
}
The source generator creates:
GeneratedMcpCatalogwith MCP tool definitionsGeneratedMcpInvokerto handle MCP requestsGeneratedCliInvokerfor CLI parsingGeneratedOperationRegistryas the central dispatch
For more complex operations with dependency injection, use class-based operations:
[Operation("math.add", Summary = "Adds two integers.")]
[CliCommand("math", "add")]
[McpTool("math_add")]
public sealed class AddOperation : IOperation<AddOperation.Request, int>
{
public ValueTask<int> ExecuteAsync(Request request, OperationContext context)
=> ValueTask.FromResult(request.X + request.Y);
public sealed class Request
{
[Argument(0, Name = "x")]
[McpName("x")]
public int X { get; init; }
[Argument(1, Name = "y")]
[McpName("y")]
public int Y { get; init; }
}
}
Register class-based operations in your DI container:
services.AddTransient<AddOperation>();
When To Use It — .NET Teams Building Internal Tools
Manifold shines when:
- You're building internal developer tools in .NET that should be accessible both via CLI and through Claude Code
- You want to avoid maintaining separate argument parsing logic for CLI vs MCP
- Your team already uses .NET and wants to contribute to the MCP ecosystem without learning new toolchains
The repository includes sample hosts for both stdio and HTTP MCP servers, making it easy to integrate with Claude Code's MCP configuration.
Limitations To Know
Manifold doesn't handle transport or hosting—you still need to wire up the MCP server yourself using the generated artifacts. It's a foundation, not a full-stack solution. The current release (v1.0.0) is new, so expect some rough edges in complex scenarios.
For .NET shops, this dramatically lowers the barrier to creating MCP servers. Instead of manually writing JSON schemas and tool definitions, you get them generated from your existing C# code.






