Skip to content

feat(dir): add mcp-claudecode export format - #1766

Merged
lgecse merged 1 commit into
agntcy:mainfrom
conorbronsdon:feat/mcp-export-claude-code
Jul 9, 2026
Merged

lgecse merged 1 commit into
agntcy:mainfrom
conorbronsdon:feat/mcp-export-claude-code

Conversation

@conorbronsdon

Copy link
Copy Markdown
Member

Adds --format mcp-claudecode to dirctl export, closing #1386.

Pulls an OASF record's integration/mcp module (1.0.0 connections format) and emits Claude Code's project-scoped .mcp.json shape. Batch export (--output-dir) merges all matched servers into one mcp.json, mirroring the existing mcp-ghcopilot behavior.

Judgment calls where the issue was silent, called out for review:

  • stdio entries omit type, matching what claude mcp add actually emits (the issue's stdio example also omits it).
  • OASF's streamable-http transport maps to Claude Code's "type": "http"; sse passes through.
  • Env vars without a default_value emit "NAME": "${NAME}", Claude Code's documented shell-environment expansion. There's no Claude Code equivalent of VS Code's ${input:NAME} prompt that the ghcopilot exporter uses.

Scope notes:

  • Issue Step 1 targets oasf-sdk's translator package. This PR keeps the translator dir-local (api/exportfmt/mcp_claudecode.go, exported as exportfmt.RecordToClaudeCode) so the feature doesn't block on an oasf-sdk release and dependency bump. Happy to upstream it as a follow-up if you'd rather have the two-repo split.
  • Step 2.4 references mcp/tools/export_record.go, which doesn't exist on current main; skipped.
  • OASF 1.0.0 connections only; legacy 0.7.0/0.8.0 servers format isn't handled.

Verified: go build ./... and the exportfmt + cmd/export test suites pass on both the api and cli modules. Tests mirror the ghcopilot formatter's coverage (stdio, remote with headers, nil data, missing module, batch merge, empty batch, registration). Commits are DCO signed.

Adds a new --format mcp-claudecode option to dirctl export that emits
Claude Code's project-scoped .mcp.json configuration shape
({"mcpServers": {name: {command/args/env or type/url/headers}}}),
mirroring the existing mcp-ghcopilot formatter end to end:

- api/exportfmt/mcp_claudecode.go: formatter + RecordToClaudeCode
  translator for the OASF 1.0.0 integration/mcp connections format
  (stdio, streamable-http -> http, sse)
- cli/cmd/export: batch exporter merging matched servers into one
  mcp.json, format registration, help text
- tests mirroring the mcp-ghcopilot formatter and batch tests
- docs: CLI reference + import/export component page

Refs agntcy#1386

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Conor Bronsdon <[email protected]>
@github-actions github-actions Bot added the size/M Denotes a PR that changes 200-999 lines label Jul 8, 2026
@conorbronsdon conorbronsdon changed the title feat: add mcp-claudecode export format feat(dir): add mcp-claudecode export format Jul 8, 2026
@conorbronsdon conorbronsdon reopened this Jul 8, 2026
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.17293% with 41 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
api/exportfmt/mcp_claudecode.go 68.6% 18 Missing and 15 partials ⚠️
cli/cmd/export/batch_mcp_claudecode.go 66.7% 4 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

@ramizpolic ramizpolic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@conorbronsdon
conorbronsdon marked this pull request as ready for review July 8, 2026 18:13
@conorbronsdon
conorbronsdon requested a review from a team as a code owner July 8, 2026 18:13
@lgecse
lgecse merged commit 6660249 into agntcy:main Jul 9, 2026
65 of 67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 200-999 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants