Skip to content

neutro74/snip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

snip

Terminal-first snippet manager with VS Code + MCP integration. Local-first — all data lives in a single SQLite file under $XDG_DATA_HOME/snip/snip.db.

Three surfaces, one library:

  • CLIsnip add, snip search, interactive TUI
  • MCP server — exposes snippets to Claude Code / any MCP client
  • VS Code extension — sidebar, insert, save-selection-as-snippet

Layout

packages/
  core/     shared DB + search + types
  cli/      terminal interface
  mcp/      MCP server (stdio)
  vscode/   VS Code extension

Install

pnpm install
pnpm build

The CLI binary is linked as snip inside packages/cli/dist/index.js. To use globally:

pnpm --filter @snip/cli link --global

CLI

snip                          # interactive TUI (fuzzy search + preview)
snip add                      # create a snippet in $EDITOR
snip add -t "my thing" -l bash --tag devops --file script.sh
snip search "ssh vps" --tag bash
snip get <id> --raw           # print raw content (pipeable)
snip copy <id>                # copy to clipboard
snip copy <id> --var NAME=bob # fill {{NAME}} before copying
snip edit <id>                # open in $EDITOR
snip list --tag react
snip tags                     # all tags with counts
snip export snippets.json
snip import snippets.json
snip delete <id>

Ids can be passed as a short prefix (first 4+ hex chars) as long as it's unambiguous.

Templating

Any {{VAR_NAME}} placeholder becomes a variable. snip get, snip copy, and the MCP get_snippet tool accept values to fill them.

Database location

Defaults to $XDG_DATA_HOME/snip/snip.db (usually ~/.local/share/snip/snip.db). Override with SNIP_DB=/custom/path/snip.db.

MCP server

node packages/mcp/dist/index.js

Register with Claude Code (~/.claude/mcp.json or similar):

{
  "mcpServers": {
    "snip": {
      "command": "node",
      "args": ["/absolute/path/to/snip/packages/mcp/dist/index.js"]
    }
  }
}

Exposed tools:

Tool Purpose
search_snippets Fuzzy search with optional tag/language filters
get_snippet Retrieve full content (supports template variables)
create_snippet Save a new snippet
update_snippet Modify any field
delete_snippet Remove a snippet
list_tags Browse tags with counts

VS Code extension

From packages/vscode/:

pnpm build
code --install-extension .   # or F5 from VS Code for dev

Features:

  • Activity-bar sidebar with tag filter
  • Snip: Insert Snippet — fuzzy picker, replaces selection
  • Snip: Save Selection as Snippet — right-click in editor
  • Snip: Edit Snippet — opens in a temporary buffer; save to persist
  • Variable substitution UI for {{VAR}} placeholders

Data model

interface Snippet {
  id: string;           // uuid
  title: string;
  content: string;
  language: string;     // for syntax highlighting
  tags: string[];       // lowercased
  description: string | null;
  source: string | null;
  variables: string[];  // extracted from content
  created_at: string;   // ISO
  updated_at: string;
}

Sync (manual)

Use snip export + snip import with any transport you like (git repo, Gist, Dropbox, rsync).

About

Terminal-first snippet manager with VS Code + MCP integration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors