id = "ctx7" name = "Context7 CLI" homepage = "https://context7.com/docs/clients/cli" description = "A CLI for fetching current library documentation" executables = ["ctx7"] [dotfiles] # Context7's official CLI changelog documents the XDG credentials directory; # its authentication source stores credentials.json there and migrates the # legacy ~/.context7/credentials.json file. # https://github.com/upstash/context7/blob/master/packages/cli/CHANGELOG.md # https://github.com/upstash/context7/blob/master/packages/cli/src/utils/auth.ts paths = [ "[configHome]/context7/credentials.json", "~/.context7/credentials.json", ] secret = [] [[dotfiles.secret_paths]] file = [ "[configHome]/context7/credentials.json", "~/.context7/credentials.json", ] format = "json" match = { key_path = ["access_token", "refresh_token"] } [commands] format = 1 label = "Search library documentation" description = "Search Context7 documentation, resolve a library ID, or fetch docs by ID. Setup, remove and login commands are left out." quality = "ai-draft" parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = false, short_bundles = false } [[commands.subcommand]] path = ["search"] label = "Search documentation" [[commands.subcommand.source]] id = "readme" kind = "manual" url = "https://github.com/upstash/context7/blob/master/packages/cli/README.md" revision = "2026-10-27" evidence = """ ctx7 search "how do I validate a request body with a schema?" ctx7 search "how do I stream a response?" --library Next.js --library /openai/openai-node ctx7 search "how do I cache a server function?" --library Next.js --library-version 15.4.0 ctx7 search "how do I send an SMS?" --library Twilio --language Ruby ctx7 search "how do I use hooks?" --library React --json """ [[commands.subcommand.field]] id = "query" label = "Question" type = "string" position = 0 min = 1 sources = ["readme"] [[commands.subcommand.field]] id = "library" label = "Library" description = "A name or library ID; repeat for up to four." type = "string" option = ["--library"] multiple = true sources = ["readme"] [[commands.subcommand.field]] id = "library_version" label = "Library version" type = "string" option = ["--library-version"] sources = ["readme"] [[commands.subcommand.field]] id = "language" label = "Preferred language" type = "string" option = ["--language"] sources = ["readme"] [[commands.subcommand.field]] id = "json" label = "JSON output" type = "boolean" option = ["--json"] sources = ["readme"] [[commands.subcommand.task]] id = "search" label = "Search docs" fields = ["query", "library", "library_version", "language", "json"] required = ["query"] [[commands.subcommand.group]] id = "basic" label = "Basic" fields = ["query", "library", "library_version"] [[commands.subcommand.group]] id = "advanced" label = "Advanced" fields = ["language", "json"] [[commands.subcommand]] path = ["docs"] label = "Fetch documentation by library ID" [[commands.subcommand.source]] id = "readme" kind = "manual" url = "https://github.com/upstash/context7/blob/master/packages/cli/README.md" revision = "2026-10-27" evidence = """ ctx7 docs /facebook/react "useEffect cleanup" ctx7 docs /facebook/react "hooks" --json """ [[commands.subcommand.field]] id = "library_id" label = "Library ID" description = "For example /facebook/react." type = "string" position = 0 min = 1 sources = ["readme"] [[commands.subcommand.field]] id = "query" label = "Question" type = "string" position = 1 min = 1 sources = ["readme"] [[commands.subcommand.field]] id = "json" label = "JSON output" type = "boolean" option = ["--json"] sources = ["readme"] [[commands.subcommand.task]] id = "docs" label = "Fetch docs" fields = ["library_id", "query", "json"] required = ["library_id", "query"] [[commands.subcommand.group]] id = "basic" label = "Basic" fields = ["library_id", "query", "json"]