{
  "markdown": "# claudecode-rexd-target\n\nClaude Code plugin for using configured [REXD](https://github.com/samiralibabic/rexd) targets over SSH stdio.\n\nThe plugin provides:\n\n- A bundled MCP server named `rexd-target`\n- Remote filesystem, search, shell, and PTY tools backed by `rexd --stdio`\n- A namespaced Claude Code command for target switching\n- A `PreToolUse` hook that blocks local tools while a target is active\n\n## Requirements\n\n- Claude Code 2.1.139 or newer (required for exec-form plugin hooks)\n- Node.js available in `PATH` for the installed MCP server and hook scripts\n- Bun for local development, tests, and building from source\n- SSH access to the remote target\n- `rexd` installed on the remote host\n- Remote `rexd` configured with `security.allowed_roots`\n\nRecommended backend: `rexd` v0.1.5+ with `fs.edit`, `fs.patch`, PTY support, and correct `/` allowed-root behavior.\n\n## Install\n\nInstall the plugin normally through Claude Code's plugin marketplace system:\n\n```bash\nclaude plugin marketplace add samiralibabic/claudecode-rexd-target\nclaude plugin install claudecode-rexd-target@rexd-ecosystem --scope user\n```\n\nAfter that, start Claude Code normally from any project:\n\n```bash\nclaude\n```\n\nInside Claude Code, verify the plugin MCP server is connected:\n\n```text\n/mcp\n```\n\nThe plugin MCP server is configured by the `.mcp.json` committed in this repository. That file is part of the plugin package and should stay in git. When installed through Claude Code, it starts the bundled server with:\n\n```bash\nnode ${CLAUDE_PLUGIN_ROOT}/dist/server.js\n```\n\n### Development Install\n\nFor local development without installing the marketplace:\n\n```bash\nbun install\nclaude --plugin-dir /path/to/claudecode-rexd-target --debug\n```\n\nRun this command from the project you want Claude to work in, not from inside this plugin repo. If you run Claude from inside this plugin repo, Claude may read this repo's `.mcp.json` as project MCP config and warn that plugin-only variables are missing.\n\n### Optional Global /target Alias\n\nClaude Code namespaces plugin commands, so the bundled target command is `/claudecode-rexd-target:target`.\n\nFor better day-to-day UX, install `/target` as a personal skill available in every project. In a Claude Code session with this plugin enabled, run this before activating a target:\n\n```text\n! rexd-target-install-alias --user\n```\n\nThis writes:\n\n```text\n~/.claude/skills/target/SKILL.md\n```\n\nIf the helper is not on PATH, run it from a local checkout instead:\n\n```bash\nbun run install:target-alias --user\n```\n\nYou can still install a project-local alias instead:\n\n```bash\nrexd-target-install-alias /path/to/your/project\n```\n\nProject-local aliases write:\n\n```text\n<project>/.claude/commands/target.md\n```\n\nRestart Claude Code if `/target` is not visible immediately.\n\n### Updates\n\nUpdate the marketplace and installed plugin with:\n\n```bash\nclaude plugin marketplace update rexd-ecosystem\nclaude plugin update claudecode-rexd-target@rexd-ecosystem\n```\n\n## Target Registry\n\nTargets are read from the shared REXD registry:\n\n```text\n~/.config/rexd/targets.json\n```\n\nThis is intentionally the same registry used by other REXD integrations such as `opencode-rexd-target`, so one target config can be reused across tools.\n\nExample:\n\n```json\n{\n  \"version\": 1,\n  \"targets\": {\n    \"prod\": {\n      \"transport\": \"ssh\",\n      \"host\": \"example.com\",\n      \"user\": \"deploy\",\n      \"port\": 22,\n      \"identityFile\": \"~/.ssh/id_ed25519\",\n      \"sshOptions\": [\"-o\", \"StrictHostKeyChecking=yes\"],\n      \"command\": \"/usr/local/bin/rexd --stdio\",\n      \"workspaceRoots\": [\"/srv/app\"],\n      \"defaultCwd\": \"/srv/app\",\n      \"loginShell\": false,\n      \"capabilities\": {\n        \"shell\": true,\n        \"fs\": true,\n        \"pty\": true\n      },\n      \"rootPolicy\": {\n        \"mode\": \"strict\",\n        \"extraRoots\": []\n      }\n    }\n  }\n}\n```\n\n`capabilities.shell` controls whether the plugin exposes remote shell execution. Remote shell commands run with the privileges of the remote `rexd` process user and are not constrained by filesystem RPC root guards. Set `capabilities.shell: false` and `security.allow_shell = false` on the target host when filesystem roots must be the hard security boundary.\n\nOnly `transport: \"ssh\"` is supported in v0.1.\n\n## Usage\n\nRecommended short command after installing the optional alias:\n\n```text\n/target list\n/target use prod\n/target status\n/target clear\n```\n\nThe built-in plugin command remains available under Claude Code's required namespace:\n\n```text\n/claudecode-rexd-target:target list\n/claudecode-rexd-target:target use prod\n/claudecode-rexd-target:target status\n/claudecode-rexd-target:target clear\n```\n\nAfter `target_use` succeeds, Claude should use only the `rexd-target` MCP tools for remote filesystem, search, shell, and PTY work.\n\nAvailable MCP tools:\n\n- Target: `target_list`, `target_use`, `target_status`, `target_clear`\n- Filesystem: `read_file`, `write_file`, `list_dir`, `glob`, `grep`, `stat`, `edit_file`, `apply_patch`\n- Exec: `exec`, `exec_start`, `exec_wait`, `exec_input`, `exec_kill`\n- PTY: `pty_open`, `pty_input`, `pty_read`, `pty_resize`, `pty_close`, `pty_list`\n\n## Remote-Only Enforcement\n\nWhen a target is active, the hook in `hooks/hooks.json` denies these local Claude Code tools:\n\n```text\nBash, PowerShell, Read, Write, Edit, MultiEdit, NotebookEdit, Glob, Grep, LSP, Monitor\n```\n\nExample denial:\n\n```text\nLocal Read blocked because REXD target \"prod\" is active. Use mcp__plugin_claudecode-rexd-target_rexd-target__read_file instead.\n```\n\nRun `target_clear` to disable the target and allow local built-ins again.\nThis applies regardless of the target root-policy mode, including non-strict modes.\n\n## State\n\nState is project-specific.\n\nIf the Claude project has a `.claude/` directory, state is stored at:\n\n```text\n<projectRoot>/.claude/rexd-state.json\n```\n\nOtherwise, state is stored in a global cache keyed by the real project path:\n\n```text\n~/.cache/claudecode-rexd-target/state/<sha256(realpath(projectRootOrCwd))>.json\n```\n\n`target_status` reports the state path for debugging.\n\n## Security\n\nSecurity is layered:\n\n- SSH handles authentication, host keys, and encryption.\n- `rexd` enforces remote allowed roots and execution limits.\n- The MCP adapter pre-checks remote paths against configured roots in strict mode.\n- The Claude Code hook blocks accidental local operations while a remote target is active.\n\nThe plugin does not store SSH keys, passwords, or tokens.\n\n## Development\n\n```bash\nbun install\nbun run typecheck\nbun test\nbun run build\n```\n\n## Troubleshooting\n\nIf `/mcp` does not show `rexd-target`, run Claude Code with `--debug` and confirm Node.js is available.\n\nIf `target_use` fails, check SSH access and that the remote command works manually:\n\n```bash\nssh deploy@example.com /usr/local/bin/rexd --stdio\n```\n\nIf remote file operations fail with a path error, check both the target `workspaceRoots` and the remote `rexd` `security.allowed_roots`.\n\nIf local tools are blocked unexpectedly, run:\n\n```text\n/claudecode-rexd-target:target status\n/claudecode-rexd-target:target clear\n```\n",
  "bytes": 7063,
  "sha": "85248579591549f70949c4c4652e6732bc932d650e07509f939c3d126d355607",
  "repo_slug": "samiralibabic/claudecode-rexd-target",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_samiralibabic_claudecode_rexd_target_cla_0a5d5bb9/readme"
}