$npx -y skills add pinecone-io/gemini-cli-extension --skill cliGuide for using the Pinecone CLI (pc) to manage Pinecone resources from the terminal. The CLI supports ALL index types (standard, integrated, sparse) and all vector operations — unlike the MCP which only supports integrated indexes. Use for batch operations, vector management, ba
| 1 | # Pinecone CLI (`pc`) |
| 2 | |
| 3 | Manage Pinecone from the terminal. The CLI is especially valuable for vector operations across **all index types** — something the MCP currently can't do. |
| 4 | |
| 5 | ## CLI vs MCP |
| 6 | |
| 7 | | | CLI | MCP | |
| 8 | |---|---|---| |
| 9 | | Index types | All (standard, integrated, sparse) | Integrated only | |
| 10 | | Vector ops (upsert, query, fetch, update, delete) | ✅ | ❌ | |
| 11 | | Text search on integrated indexes | ✅ | ✅ | |
| 12 | | Backups, namespaces, org/project mgmt | ✅ | ❌ | |
| 13 | | CI/CD / scripting | ✅ | ❌ | |
| 14 | |
| 15 | --- |
| 16 | |
| 17 | ## Setup |
| 18 | |
| 19 | ### Install (macOS) |
| 20 | ```bash |
| 21 | brew tap pinecone-io/tap |
| 22 | brew install pinecone-io/tap/pinecone |
| 23 | ``` |
| 24 | |
| 25 | Other platforms (Linux, Windows) — download from [GitHub Releases](https://github.com/pinecone-io/cli/releases). |
| 26 | |
| 27 | ### Authenticate |
| 28 | |
| 29 | ```bash |
| 30 | # Interactive (recommended for local dev) |
| 31 | pc login |
| 32 | pc target -o "my-org" -p "my-project" |
| 33 | |
| 34 | # Service account (recommended for CI/CD) |
| 35 | pc auth configure --client-id "$PINECONE_CLIENT_ID" --client-secret "$PINECONE_CLIENT_SECRET" |
| 36 | |
| 37 | # API key (quick testing) |
| 38 | pc config set-api-key $PINECONE_API_KEY |
| 39 | ``` |
| 40 | |
| 41 | Check status: `pc auth status` · `pc target --show` |
| 42 | |
| 43 | > **Note for agent sessions**: If you need to run `pc login` inside an agent loop, the browser auth link may not surface correctly. It's best to authenticate **before** starting an agent session. Run `pc login` in your terminal directly, then invoke the agent once you're authenticated. |
| 44 | |
| 45 | ### Authenticating the CLI does not set `PINECONE_API_KEY` |
| 46 | |
| 47 | `pc login` authenticates the CLI tool itself — it does **not** set `PINECONE_API_KEY` in your environment. Python scripts, Node.js SDKs, and other tools that use the Pinecone SDK need `PINECONE_API_KEY` set separately. |
| 48 | |
| 49 | Use the CLI to create a key and export it in one step: |
| 50 | |
| 51 | ```bash |
| 52 | KEY=$(pc api-key create --name agent-sdk-key --json | jq -r '.value') |
| 53 | export PINECONE_API_KEY="$KEY" |
| 54 | ``` |
| 55 | |
| 56 | Without `jq`: run `pc api-key create --name agent-sdk-key --json` and copy the `"value"` field manually. |
| 57 | |
| 58 | --- |
| 59 | |
| 60 | ## Common Commands |
| 61 | |
| 62 | | Task | Command | |
| 63 | |---|---| |
| 64 | | List indexes | `pc index list` | |
| 65 | | Create serverless index | `pc index create -n my-index -d 1536 -m cosine -c aws -r us-east-1` | |
| 66 | | Index stats | `pc index stats -n my-index` | |
| 67 | | Upload vectors from file | `pc index vector upsert -n my-index --file ./vectors.json` | |
| 68 | | Query by vector | `pc index vector query -n my-index --vector '[0.1, ...]' -k 10 --include-metadata` | |
| 69 | | Query by vector ID | `pc index vector query -n my-index --id "doc-123" -k 10` | |
| 70 | | Fetch vectors by ID | `pc index vector fetch -n my-index --ids '["vec1","vec2"]'` | |
| 71 | | List vector IDs | `pc index vector list -n my-index` | |
| 72 | | Delete vectors by filter | `pc index vector delete -n my-index --filter '{"genre":"classical"}'` | |
| 73 | | List namespaces | `pc index namespace list -n my-index` | |
| 74 | | Create backup | `pc backup create -i my-index -n "my-backup"` | |
| 75 | | JSON output (for scripting) | Add `-j` to any command | |
| 76 | |
| 77 | --- |
| 78 | |
| 79 | ## Interesting Things You Can Do |
| 80 | |
| 81 | ### Query with custom vectors (not just text) |
| 82 | Unlike the MCP, the CLI lets you query any index with raw vector values — useful when you generate embeddings externally (OpenAI, HuggingFace, etc.): |
| 83 | ```bash |
| 84 | pc index vector query -n my-index \ |
| 85 | --vector '[0.1, 0.2, ..., 0.9]' \ |
| 86 | --filter '{"source":{"$eq":"docs"}}' \ |
| 87 | -k 20 --include-metadata |
| 88 | ``` |
| 89 | |
| 90 | ### Pipe embeddings directly into queries |
| 91 | ```bash |
| 92 | jq -c '.embedding' doc.json | pc index vector query -n my-index --vector - -k 10 |
| 93 | ``` |
| 94 | |
| 95 | ### Bulk metadata update with preview |
| 96 | ```bash |
| 97 | # Preview first |
| 98 | pc index vector update -n my-index \ |
| 99 | --filter '{"env":{"$eq":"staging"}}' \ |
| 100 | --metadata '{"env":"production"}' \ |
| 101 | --dry-run |
| 102 | |
| 103 | # Apply |
| 104 | pc index vector update -n my-index \ |
| 105 | --filter '{"env":{"$eq":"staging"}}' \ |
| 106 | --metadata '{"env":"production"}' |
| 107 | ``` |
| 108 | |
| 109 | ### Backup and restore |
| 110 | ```bash |
| 111 | # Snapshot before a migration |
| 112 | pc backup create -i my-index -n "pre-migration" |
| 113 | |
| 114 | # Restore to a new index if something goes wrong |
| 115 | pc backup restore -i <backup-uuid> -n my-index-restored |
| 116 | ``` |
| 117 | |
| 118 | ### Automate in CI/CD |
| 119 | ```bash |
| 120 | export PINECONE_CLIENT_ID="..." |
| 121 | export PINECONE_CLIENT_SECRET="..." |
| 122 | pc auth configure --client-id "$PINECONE_CLIENT_ID" --client-secret "$PINECONE_CLIENT_SECRET" |
| 123 | pc index vector upsert -n my-index --file ./vectors.jsonl --batch-size 1000 |
| 124 | ``` |
| 125 | |
| 126 | ### Script against JSON output |
| 127 | ```bash |
| 128 | # Get all index names as a list |
| 129 | pc index list -j | jq -r '.[] | .name' |
| 130 | |
| 131 | # Check if an index exists before creating |
| 132 | if ! pc index describe -n my-index -j 2>/dev/null | jq -e '.name' > /dev/null; then |
| 133 | pc index create -n my-index -d 1536 -m cosine -c aws -r us-east-1 |
| 134 | fi |
| 135 | ``` |
| 136 | |
| 137 | --- |
| 138 | |
| 139 | ## Reference Files |
| 140 | |
| 141 | - [Full command reference](references/command-reference.md) — all |