Skip to content

seconv: add seconv mcp, a Model Context Protocol server over stdio - #14129

Open
ivandrofly wants to merge 1 commit into
SubtitleEdit:mainfrom
ivandrofly:seconv-mcp-server
Open

seconv: add seconv mcp, a Model Context Protocol server over stdio#14129
ivandrofly wants to merge 1 commit into
SubtitleEdit:mainfrom
ivandrofly:seconv-mcp-server

Conversation

@ivandrofly

Copy link
Copy Markdown
Member

Summary

  • New subcommand seconv mcp runs 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"]}}}.
  • Seven tools, each a thin adapter over the Core helpers the CLI subcommands already use (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_subtitle
    • convert_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, resolution
    • list_fix_common_errors_rules, list_remove_formatting_rules
  • Stdout is reserved for JSON-RPC: Console.Out is redirected to stderr and the converter runs quiet; logs go to stderr (--verbose for debug level).
  • Tool failures return isError with 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.
  • Result JSON uses the same field names as the corresponding subcommand's --json output.
  • mcp is listed in --help, --help-json, the seconv README and docs/reference/command-line.md.
  • Dependencies: ModelContextProtocol 2.2.0, Microsoft.Extensions.Hosting 10.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 warnings
  • dotnet test tests/seconv/SeConvTests.csproj — 393/393 pass, including 10 new McpToolsTest cases (one spawns dotnet seconv.dll mcp, lists tools via the MCP client SDK, calls subtitle_info on a fixture and on a missing file)
  • Register in Claude Code with claude mcp add seconv -- <path-to>/seconv mcp, then ask it to describe an .srt and convert it to WebVTT with a 1 s offset — the output file appears and its time codes are shifted
  • seconv --help and seconv --help-json list mcp
  • Existing conversions and subcommands behave exactly as before (no change to any non-mcp code path)

🤖 Generated with Claude Code

https://claude.ai/code/session_01V1UEPy85BqcK2D9dHgfymB

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant