Core library for creating MCP (Model Context Protocol) servers from OpenCLI tool definitions. Provides base classes and interfaces for CLI execution, process management, and response formatting.
$ dotnet add package OpenCliToMcp.CoreCore library for creating MCP (Model Context Protocol) servers from OpenCLI tool definitions.
OpenCliToMcp.Core provides the foundational components needed to execute CLI tools and convert their outputs into MCP-compatible responses. It includes:
dotnet add package OpenCliToMcp.Core
using OpenCliToMcp.Core;
// Create a simple CLI executor
var executor = new SimplifiedCliExecutor(new SimplifiedCliExecutorOptions
{
ExecutablePath = "git",
ResponseFormat = ResponseFormat.Json
});
// Execute a command
var response = await executor.ExecuteAsync(new[] { "status", "--porcelain" });
Console.WriteLine(response.Content);
The main interface for executing CLI commands:
public interface ICliExecutor
{
Task<CliResponse> ExecuteAsync(string[] arguments, CancellationToken cancellationToken = default);
}
Abstract base class providing common CLI execution functionality with built-in logging and error handling.
Advanced executor with configurable executable resolution, custom process options, and response formatting.
var executor = new ConfigurableCliExecutor(
executableResolver,
processExecutor,
responseFormatter,
logger);
Automatically find executables using glob patterns:
var resolver = new GlobbingExecutableResolver(new GlobbingExecutableResolverOptions
{
SearchPattern = "**/bin/my-tool.exe"
});
Licensed under the Apache License, Version 2.0. See LICENSE for details.