[功能] 将 DevToys CLI 工具暴露为模型上下文协议 (MCP) 服务器
作者: pierre3创建于 2026年8月28日更新于 2026年9月1日
标签featureuntriaged
- Reuses the CLI tool model — tools are discovered through MEF exactly like
DevToys.CLI(from aPluginsfolder next to the executable, or via theEXTRAPLUGINenv var). No changes to the tool model itself. - Schema generation — each
ICommandLineToolbecomes one MCP tool nameddevtoys_<command-name>(e.g.devtoys_base64), with a JSON input schema generated from its[CommandLineOption]properties.OneOf<...>options (e.g. "text or file path") are exposed as a string and parsed at invocation time. - Invocation —
tools/callbinds arguments (mirroring the CLI binding, including OneOf), runs the tool, and returns its captured console output plus a structured{ stdout, stderr, exitCode }payload. Non-zero exit codes mark the result as an error. Invocations are serialized because the tools write to the process-wide console. - Build —
DevToys.MCPis published per-RID by the Nuke build alongside the CLI, and registered in the Windows/macOS/Linux solutions. - Tests — xUnit tests added to
DevToys.UnitTests(schema generation, argument conversion, OneOf parsing, result formatting). - Purely additive — no existing runtime code is modified (27 files, +2242 lines). It builds in Release with no warnings and all unit tests pass.
ModelContextProtocol(Apache-2.0) is added toTHIRD-PARTY-NOTICES.md.
Example MCP client configuration:
内容来源: DevToys-app/DevToys