Skip to content

Claude Code - User Guide

CodeFetch runs a remote MCP server, letting Claude Code publish, update, delete, and find scripts in your CodeFetch library directly from a chat session — no local install, no CLI, nothing to configure beyond a connection string. Claude Code becomes a third way to manage your library, alongside the VS Code extension and the CLI.

This requires a git repository. CodeFetch tracks which files in your repo are published (and under which ID) using the same .codefetch/ids/ sidecar files the VS Code extension uses — so a script published from Claude Code shows up as already-published if you later open the same repo in VS Code, and vice versa. Without a repo there's nowhere to keep track of what's published, so Claude Code won't use these tools outside one.


Setup

You'll need your tenant URL and secret — the same two values used to configure the CLI or VS Code extension.

Add the server with the Claude Code CLI:

claude mcp add --transport http codefetch \
  https://app.codefetch.io/<tenantId>/mcp \
  --header "Authorization: Bearer <secret>"

Or add it directly to your .mcp.json (project-scoped, shared via version control) or ~/.claude.json (personal, every project):

{
  "mcpServers": {
    "codefetch": {
      "type": "http",
      "url": "https://app.codefetch.io/<tenantId>/mcp",
      "headers": { "Authorization": "Bearer <secret>" }
    }
  }
}

Your secret is only as safe as wherever you store this config. If you use .mcp.json in a shared repo, use ~/.claude.json instead so the secret isn't committed — or keep .mcp.json committed with a placeholder and have each teammate fill in their own secret locally.

Restart Claude Code (or start a new session) and it will pick up the server automatically.


Publishing a Script

Just ask, from inside a git repository:

"Publish deploy.sh to CodeFetch, tag it deploy and linux"

Claude Code reads the file, calls the codefetch_publish tool, and writes a .codefetch/ids/deploy.sh.cfid sidecar recording the new ID and a checksum of the published content — the same bookkeeping the VS Code extension does on every publish.

Updating a Script

"I changed deploy.sh, push the update to CodeFetch"

Claude Code finds the existing .cfid sidecar for that file, calls codefetch_update with its tracked ID, and refreshes the sidecar's checksum once the update succeeds.

Finding Scripts

"Find my docker scripts in CodeFetch" "What's published to CodeFetch?"

Searches by filename, description, or tag and returns a list of matches — metadata only, not file content.

Deleting a Script

"Delete the old-backup.sh script from CodeFetch"

Removes it from your library and deletes the local .cfid sidecar.


How This Differs from VS Code / CLI

VS Code Extension CLI Claude Code
Publish / update / delete ✅ ❌ (read-only) ✅
Search / list ✅ ✅ ✅
Run a script ❌ ✅ ❌
Needs install Extension Binary Nothing — just a config entry
Tracks published state .codefetch/ids/*.cfid — .codefetch/ids/*.cfid (same files)

Claude Code can't run or decrypt scripts back out of your library (codefetch get's job) — only the CLI does that today. Think of Claude Code as a conversational front end for publishing and managing scripts while you're already working in a repo, not a replacement for the CLI's retrieval/execution workflow.


Troubleshooting

"This requires a git repository" — Claude Code refuses to publish outside a git repo on purpose; there's nowhere to write the .cfid sidecar that tracks the published ID. Run git init (or open a cloned repo) first.

Nothing happens when I ask Claude to publish — Check the server is actually connected: ask Claude Code to list its available MCP tools, or run claude mcp list. If it's missing, re-check the URL and secret in your config.

Published from Claude Code, but VS Code doesn't show it as published — Confirm you're working in the same repo checkout both tools see, and that the .codefetch/ids/ sidecar actually exists at the expected path (it's created next to the published file, mirroring its path from the repo root).