Skip to content

feat(mcp): MCP server + Skills for Claude/Codex/Gemini - #7

Merged
dantte-lp merged 10 commits into
masterfrom
feat/mcp-server
Jul 15, 2026
Merged

feat(mcp): MCP server + Skills for Claude/Codex/Gemini#7
dantte-lp merged 10 commits into
masterfrom
feat/mcp-server

Conversation

@dantte-lp

Copy link
Copy Markdown
Owner

Summary

Adds an MCP server (ypcli mcp) exposing ypcli's send/receive to AI agents, plus Skills/config for Claude, Codex, and Gemini, and a server-install path — implemented per the agreed plan (stdio + HTTP; full send+receive tool set; skills for all three).

What's included

  • internal/share — the send/receive core extracted from the CLI (DRY), reused by both the CLI and MCP. CLI behavior unchanged (unit + e2e green).
  • internal/mcpserver — MCP server on the official Go SDK (modelcontextprotocol/go-sdk v1.6.1). Tools: send_secret, send_file, receive_secret (omitted by --read-only), list_profiles, server_version. Typed IO with JSON Schema; config/profile resolved per call.
  • ypcli mcp — serves over stdio (default) or HTTP (--http, mandatory constant-time bearer token, graceful shutdown).
  • skills/ypcli/SKILL.md (Claude Agent Skill), integrations/ (ready-to-copy Claude/Codex/Gemini configs, stdio + HTTP), deploy/ (hardened systemd unit + guide).
  • Docs: bilingual docs/{en,ru}/09-mcp.md, CLI reference, indexes, CHANGELOG.

Independent review

An independent review agent audited the branch; findings were integrated: $YPCLI_TOKEN now honored in MCP mode, send_file requires an absolute path and its risk is documented prominently, list_profiles sorted, added error-path/binary/profile/CLI tests, HTTP handler hardening comments.

Verification

  • go build, golangci-lint, go vet, goreleaser check — clean.
  • go test -race ./... — all pass; total coverage 73.3% (mcpserver 83.6%).
  • CLI Python e2e — 60/60 pass (refactor behavior-preserving).
  • Real end-to-end: ypcli mcp over stdio against a live yopass container returns a genuine share URL; HTTP mode verified (401 without token, MCP handshake with token).

🤖 Generated with Claude Code

The key/argon2/encrypt/create/URL and fetch/decrypt glue moves from the cobra
commands into a transport-agnostic internal/share service (with its own
httptest round-trip tests) so the upcoming MCP server reuses identical logic.
CLI behavior is unchanged; all unit and e2e tests pass.
internal/mcpserver builds an mcp.Server (official Go SDK) exposing send_secret,
send_file, receive_secret (omitted with --read-only), list_profiles and
server_version, reusing internal/share. Config/profile resolved per call from the
host ypcli config. ypcli mcp serves it over stdio. In-memory client round-trip
tests cover every tool.
ypcli mcp --http serves the MCP server over Streamable HTTP; a constant-time
bearer-token middleware gates it (required, from --http-token/$YPCLI_MCP_TOKEN).
Graceful shutdown on signal. Adds a hardened systemd unit (DynamicUser,
ProtectSystem=strict, no caps, syscall filter) and deploy/README.
skills/ypcli/SKILL.md (Agent Skill), integrations/ with ready-to-copy MCP config
for Claude (.mcp.json), Codex (config.toml + prompt) and Gemini (settings.json +
extension), each with stdio and HTTP variants.
- clientFor now honors $YPCLI_TOKEN for upstream yopass auth (was hardcoded '')
- send_file requires an absolute path and its description/docs warn that it reads
  arbitrary local files (prompt-injection exfiltration risk)
- list_profiles output is sorted (deterministic)
- add MCP error-path, binary/base64, profile-honored, and CLI --http-token
  usage tests; drive real requests through the HTTP auth handler
- doc-comment the no-token Handler; minor bytes.NewReader micro-opt
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

@dantte-lp
dantte-lp merged commit 34967cf into master Jul 15, 2026
14 checks passed
@dantte-lp
dantte-lp deleted the feat/mcp-server branch July 15, 2026 22:58
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