seconv: add seconv mcp, a Model Context Protocol server over stdio - #14129
ivandrofly wants to merge 1 commit into
Conversation
Exposes the conversion engine to MCP clients (Claude Desktop/Code, Cursor, ...) as seven tools - list_formats, subtitle_info, read_subtitle, lint_subtitle, convert_subtitle, list_fix_common_errors_rules, list_remove_formatting_rules - each a thin adapter over the Core helpers the CLI subcommands already use, so behaviour cannot drift between the two entry points. Stdout is reserved for JSON-RPC: Console.Out is redirected to stderr and the converter runs quiet. Tool failures return isError with the real message (unknown operation, missing file, ...) instead of the SDK's generic placeholder; unknown operations are hard errors rather than silent no-ops, like the CLI. Listed in --help, --help-json, the README and the command-line reference. Covered by unit tests per tool plus a stdio round-trip through the MCP client SDK against a spawned `seconv mcp` process. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1UEPy85BqcK2D9dHgfymB
|
Thanks for the careful work here — it merges cleanly onto today's main, builds with zero warnings, the stdio test passes, and the stdout/stderr handling and error reporting are done right. I'm going to close it anyway, because the intended AI surface for seconv is the CLI itself plus That subset has already drifted. The dependency cost also matters for a single-file tool: ModelContextProtocol + Microsoft.Extensions.Hosting add 31 DLLs (~3 MB) and the whole config/DI/logging stack to run one stdio loop. If MCP support for shell-less clients (Claude Desktop etc.) turns out to be wanted, I'd rather see it as a small separate project that generates its tool schema from |
Summary
seconv mcpruns seconv as an MCP server over stdio, so AI clients (Claude Desktop/Code, Cursor, ...) can inspect and convert subtitles without a shell:{"mcpServers":{"seconv":{"command":"seconv","args":["mcp"]}}}.SubtitleInfoGatherer,SubtitleLinter,SubtitleConverter,FixCommonErrorsRunner, ...), so behaviour cannot drift between the two entry points:list_formats(optional substring filter),subtitle_info,read_subtitle(paged paragraphs of any supported format),lint_subtitleconvert_subtitle— format, output folder/name, encoding, overwrite, offset, fps/targetFps, renumber, duration/gap adjustments, delete first/last/contains,operations, FixCommonErrors / RemoveFormatting rule specs, container track numbers, OCR engine/language,timeCodesOnly, resolutionlist_fix_common_errors_rules,list_remove_formatting_rulesConsole.Outis redirected to stderr and the converter runs quiet; logs go to stderr (--verbosefor debug level).isErrorwith the real message (unknown operation, missing file, ...) rather than the SDK's generic placeholder; unknown operations are hard errors, not silent no-ops, matching the CLI's strict parsing.--jsonoutput.mcpis listed in--help,--help-json, the seconv README anddocs/reference/command-line.md.ModelContextProtocol2.2.0,Microsoft.Extensions.Hosting10.0.11 (no trimming/AOT, so reflection-based tool discovery is unaffected by the single-file publish).Test plan
dotnet build src/seconv/SeConv.csproj— clean, no warningsdotnet test tests/seconv/SeConvTests.csproj— 393/393 pass, including 10 newMcpToolsTestcases (one spawnsdotnet seconv.dll mcp, lists tools via the MCP client SDK, callssubtitle_infoon a fixture and on a missing file)claude mcp add seconv -- <path-to>/seconv mcp, then ask it to describe an.srtand convert it to WebVTT with a 1 s offset — the output file appears and its time codes are shiftedseconv --helpandseconv --help-jsonlistmcpmcpcode path)🤖 Generated with Claude Code
https://claude.ai/code/session_01V1UEPy85BqcK2D9dHgfymB