@picahq/cli 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -3
- package/package.json +2 -2
- package/{SKILL.md → skills/pica/SKILL.md} +94 -74
package/README.md
CHANGED
|
@@ -18,10 +18,54 @@ Requires Node.js 18+.
|
|
|
18
18
|
pica init
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
This
|
|
21
|
+
This walks you through:
|
|
22
|
+
1. Entering your Pica API key (validates it)
|
|
23
|
+
2. Choosing which AI agents to install the MCP server into
|
|
24
|
+
3. Choosing global vs project-level installation
|
|
22
25
|
|
|
23
26
|
Get your API key at [app.picaos.com/settings/api-keys](https://app.picaos.com/settings/api-keys).
|
|
24
27
|
|
|
28
|
+
Config is saved to `~/.pica/config.json`.
|
|
29
|
+
|
|
30
|
+
### Re-running init
|
|
31
|
+
|
|
32
|
+
If you already have a config, `pica init` shows your current setup instead of starting over:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
Pica
|
|
36
|
+
|
|
37
|
+
Current Setup
|
|
38
|
+
──────────────────────────────────────────
|
|
39
|
+
API Key: sk_test_...9j-Y
|
|
40
|
+
Config: ~/.pica/config.json
|
|
41
|
+
|
|
42
|
+
Agent Global Project
|
|
43
|
+
────────────── ────── ───────
|
|
44
|
+
Claude Code ● yes ● yes
|
|
45
|
+
Claude Desktop ● yes -
|
|
46
|
+
Cursor ○ no ○ no
|
|
47
|
+
Windsurf - -
|
|
48
|
+
|
|
49
|
+
- = not detected on this machine
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Then it offers targeted actions based on what's missing:
|
|
53
|
+
|
|
54
|
+
- **Update API key** -- validates the new key, then re-installs to every agent that currently has the MCP (preserving global/project scopes)
|
|
55
|
+
- **Install MCP to more agents** -- only shows detected agents missing the MCP
|
|
56
|
+
- **Install MCP for this project** -- creates `.mcp.json` / `.cursor/mcp.json` in cwd for agents that support project scope
|
|
57
|
+
- **Start fresh** -- full setup flow from scratch
|
|
58
|
+
|
|
59
|
+
Options that don't apply are hidden. If every detected agent already has the MCP globally, "Install MCP to more agents" won't appear.
|
|
60
|
+
|
|
61
|
+
### Init flags
|
|
62
|
+
|
|
63
|
+
| Flag | Effect |
|
|
64
|
+
|------|--------|
|
|
65
|
+
| `-y, --yes` | Skip confirmations |
|
|
66
|
+
| `-g, --global` | Install MCP globally (default, available in all projects) |
|
|
67
|
+
| `-p, --project` | Install MCP for this project only (creates config files in cwd) |
|
|
68
|
+
|
|
25
69
|
## Usage
|
|
26
70
|
|
|
27
71
|
### Connect a platform
|
|
@@ -119,6 +163,19 @@ Every command supports `--json` for machine-readable output.
|
|
|
119
163
|
|
|
120
164
|
All API calls route through Pica's passthrough proxy (`api.picaos.com/v1/passthrough`), which injects auth credentials, handles rate limiting, and normalizes responses. Your connection keys tell Pica which credentials to use. You never touch raw OAuth tokens.
|
|
121
165
|
|
|
166
|
+
## MCP installation
|
|
167
|
+
|
|
168
|
+
`pica init` writes MCP server configs into the following locations:
|
|
169
|
+
|
|
170
|
+
| Agent | Global config | Project config |
|
|
171
|
+
|-------|--------------|----------------|
|
|
172
|
+
| Claude Code | `~/.claude.json` | `.mcp.json` |
|
|
173
|
+
| Claude Desktop | `~/Library/Application Support/Claude/claude_desktop_config.json` | n/a |
|
|
174
|
+
| Cursor | `~/.cursor/mcp.json` | `.cursor/mcp.json` |
|
|
175
|
+
| Windsurf | `~/.codeium/windsurf/mcp_config.json` | n/a |
|
|
176
|
+
|
|
177
|
+
Global installs make the MCP available everywhere. Project installs create config files in your current directory that can be committed and shared with your team (each team member needs their own API key).
|
|
178
|
+
|
|
122
179
|
## Development
|
|
123
180
|
|
|
124
181
|
```bash
|
|
@@ -133,7 +190,7 @@ npm run typecheck # type check without emitting
|
|
|
133
190
|
src/
|
|
134
191
|
index.ts # Commander setup and command registration
|
|
135
192
|
commands/
|
|
136
|
-
init.ts # pica init (
|
|
193
|
+
init.ts # pica init (setup, status display, targeted actions)
|
|
137
194
|
connection.ts # pica add, pica list
|
|
138
195
|
platforms.ts # pica platforms
|
|
139
196
|
actions.ts # pica search, actions knowledge, exec
|
|
@@ -142,7 +199,8 @@ src/
|
|
|
142
199
|
types.ts # TypeScript interfaces
|
|
143
200
|
actions.ts # Action ID normalization, path variable helpers
|
|
144
201
|
config.ts # ~/.pica/config.json read/write
|
|
145
|
-
agents.ts # MCP config
|
|
202
|
+
agents.ts # Agent detection, MCP config, status reporting
|
|
146
203
|
platforms.ts # Platform search and fuzzy matching
|
|
147
204
|
browser.ts # Open browser for OAuth and API key pages
|
|
205
|
+
table.ts # Formatted table output
|
|
148
206
|
```
|
package/package.json
CHANGED
|
@@ -20,82 +20,42 @@ triggers:
|
|
|
20
20
|
|
|
21
21
|
Pica gives you access to 200+ third-party platforms (Gmail, Slack, HubSpot, Stripe, Shopify, etc.) through a single interface. It handles auth, rate limiting, and retries so you just call the action you need.
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## Two interfaces: MCP and CLI
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
| Interface | Best for |
|
|
26
|
+
|-----------|----------|
|
|
27
|
+
| **MCP tools** | AI agents doing work (search, inspect, execute actions) |
|
|
28
|
+
| **CLI** (`pica`) | Humans doing setup, OAuth, browsing |
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
**Rule of thumb:** If you're doing the work, use MCP. If a human needs to interact (OAuth, setup), use CLI.
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
## MCP tools
|
|
30
33
|
|
|
31
|
-
The MCP
|
|
34
|
+
The Pica MCP is your primary interface. It gives you structured JSON in/out with no parsing overhead.
|
|
32
35
|
|
|
33
|
-
| Tool |
|
|
34
|
-
|
|
35
|
-
| `mcp__pica__list_pica_integrations` | List all
|
|
36
|
+
| Tool | What it does |
|
|
37
|
+
|------|-------------|
|
|
38
|
+
| `mcp__pica__list_pica_integrations` | List all platforms and active connections |
|
|
36
39
|
| `mcp__pica__search_pica_platform_actions` | Search for actions on a platform |
|
|
37
|
-
| `mcp__pica__get_pica_action_knowledge` | Get full API docs for an action (
|
|
40
|
+
| `mcp__pica__get_pica_action_knowledge` | Get full API docs for an action (call before execute) |
|
|
38
41
|
| `mcp__pica__execute_pica_action` | Execute an action on a connected platform |
|
|
39
42
|
|
|
40
|
-
###
|
|
41
|
-
|
|
42
|
-
The `pica` CLI is better for tasks that require a browser (OAuth), interactive prompts, or human-readable output. Use it for:
|
|
43
|
-
|
|
44
|
-
- **Setup**: `pica init` (configures API key and installs MCP)
|
|
45
|
-
- **Adding connections**: `pica add gmail` (opens browser for OAuth)
|
|
46
|
-
- **Browsing platforms**: `pica platforms` (visual, categorized list)
|
|
47
|
-
- **Quick lookups by a human**: `pica list`, `pica search gmail "send"`
|
|
48
|
-
|
|
49
|
-
## When to use which
|
|
50
|
-
|
|
51
|
-
| Task | Use |
|
|
52
|
-
|------|-----|
|
|
53
|
-
| Execute an API action | MCP |
|
|
54
|
-
| Search for actions | MCP |
|
|
55
|
-
| Read action docs | MCP |
|
|
56
|
-
| List connections/platforms | MCP |
|
|
57
|
-
| Add a new connection (OAuth) | CLI |
|
|
58
|
-
| Initial setup | CLI |
|
|
59
|
-
| Show a user what's available (visual output) | CLI |
|
|
60
|
-
|
|
61
|
-
**Rule of thumb:** If you're doing the work, use MCP. If a human needs to interact (OAuth, setup), use CLI.
|
|
43
|
+
### Standard workflow
|
|
62
44
|
|
|
63
|
-
## Setup and prerequisites
|
|
64
|
-
|
|
65
|
-
The MCP server is installed via `pica init`. If the MCP tools are not available, the CLI needs to be installed and init needs to run:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
pica --version
|
|
69
45
|
```
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
cd /Users/moe/projects/one/connection-cli
|
|
75
|
-
npm install
|
|
76
|
-
npm run build
|
|
77
|
-
npm link
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Then run setup:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
pica init
|
|
46
|
+
1. list_pica_integrations -> get connection keys and platform names
|
|
47
|
+
2. search_pica_platform_actions -> find the right action
|
|
48
|
+
3. get_pica_action_knowledge -> read the docs (REQUIRED before execute)
|
|
49
|
+
4. execute_pica_action -> do the thing
|
|
84
50
|
```
|
|
85
51
|
|
|
86
|
-
This stores the API key in `~/.pica/config.json` and installs the MCP server into Claude Code, Claude Desktop, Cursor, and Windsurf. After init, the MCP tools will be available.
|
|
87
|
-
|
|
88
|
-
## MCP workflow
|
|
89
|
-
|
|
90
|
-
This is the standard workflow for any integration task.
|
|
91
|
-
|
|
92
52
|
### Step 1: List connections and platforms
|
|
93
53
|
|
|
94
54
|
```
|
|
95
55
|
mcp__pica__list_pica_integrations()
|
|
96
56
|
```
|
|
97
57
|
|
|
98
|
-
Returns all active connections (with connection keys) and available platforms.
|
|
58
|
+
Returns all active connections (with connection keys) and available platforms. Always check this first.
|
|
99
59
|
|
|
100
60
|
### Step 2: Search for the right action
|
|
101
61
|
|
|
@@ -107,9 +67,10 @@ mcp__pica__search_pica_platform_actions({
|
|
|
107
67
|
})
|
|
108
68
|
```
|
|
109
69
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
70
|
+
- `agentType: "execute"` when you intend to run the action
|
|
71
|
+
- `agentType: "knowledge"` when you want to understand the API or write code
|
|
72
|
+
- Platform names are kebab-case: `gmail`, `hubspot`, `google-calendar`, `ship-station`
|
|
73
|
+
- Get the exact platform name from `list_pica_integrations`
|
|
113
74
|
|
|
114
75
|
### Step 3: Get action knowledge (required before execute)
|
|
115
76
|
|
|
@@ -120,7 +81,7 @@ mcp__pica__get_pica_action_knowledge({
|
|
|
120
81
|
})
|
|
121
82
|
```
|
|
122
83
|
|
|
123
|
-
|
|
84
|
+
Returns parameters, request/response schemas, caveats, and examples. You MUST call this before executing.
|
|
124
85
|
|
|
125
86
|
### Step 4: Execute
|
|
126
87
|
|
|
@@ -134,23 +95,63 @@ mcp__pica__execute_pica_action({
|
|
|
134
95
|
})
|
|
135
96
|
```
|
|
136
97
|
|
|
137
|
-
Pass
|
|
98
|
+
Pass: `connectionKey` from step 1, `actionId` from step 2, parameters from step 3.
|
|
138
99
|
|
|
139
100
|
## CLI reference
|
|
140
101
|
|
|
141
|
-
For
|
|
102
|
+
For setup, OAuth, and human-facing tasks.
|
|
103
|
+
|
|
104
|
+
### Setup: `pica init`
|
|
105
|
+
|
|
106
|
+
First run prompts for API key, validates it, and installs the MCP into your AI agents.
|
|
107
|
+
|
|
108
|
+
Re-running `pica init` after setup shows a status dashboard:
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
Current Setup
|
|
112
|
+
──────────────────────────────────────────
|
|
113
|
+
API Key: sk_test_...9j-Y
|
|
114
|
+
Config: ~/.pica/config.json
|
|
115
|
+
|
|
116
|
+
Agent Global Project
|
|
117
|
+
────────────── ────── ───────
|
|
118
|
+
Claude Code ● yes ● yes
|
|
119
|
+
Claude Desktop ● yes -
|
|
120
|
+
Cursor ○ no ○ no
|
|
121
|
+
Windsurf - -
|
|
122
|
+
|
|
123
|
+
- = not detected on this machine
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Then offers targeted actions (only relevant options shown):
|
|
127
|
+
|
|
128
|
+
| Action | What it does |
|
|
129
|
+
|--------|-------------|
|
|
130
|
+
| Update API key | Validates new key, re-installs MCP to all agents that have it |
|
|
131
|
+
| Install MCP to more agents | Shows only detected agents missing the MCP |
|
|
132
|
+
| Install MCP for this project | Creates project-level configs in cwd |
|
|
133
|
+
| Start fresh | Full setup from scratch |
|
|
134
|
+
|
|
135
|
+
Flags: `-y` (skip confirmations), `-g` (global install), `-p` (project install).
|
|
136
|
+
|
|
137
|
+
### Other commands
|
|
142
138
|
|
|
143
139
|
| Command | Description |
|
|
144
140
|
|---------|-------------|
|
|
145
|
-
| `pica
|
|
141
|
+
| `pica add <platform>` | Connect a platform via OAuth (opens browser) |
|
|
146
142
|
| `pica list` | List connections with keys |
|
|
147
|
-
| `pica
|
|
148
|
-
| `pica platforms` | Browse all available platforms |
|
|
143
|
+
| `pica platforms` | Browse all 200+ platforms |
|
|
149
144
|
| `pica search <platform> [query]` | Search for actions |
|
|
150
145
|
| `pica actions knowledge <id>` | Get API docs for an action |
|
|
151
146
|
| `pica exec <id>` | Execute an action |
|
|
152
147
|
|
|
153
|
-
|
|
148
|
+
All commands support `--json` for machine-readable output.
|
|
149
|
+
|
|
150
|
+
### Aliases
|
|
151
|
+
|
|
152
|
+
`pica ls` = list, `pica p` = platforms, `pica a search` = actions search, `pica a k` = actions knowledge, `pica a x` = actions execute.
|
|
153
|
+
|
|
154
|
+
### Exec flags
|
|
154
155
|
|
|
155
156
|
```bash
|
|
156
157
|
pica exec <actionId> \
|
|
@@ -161,16 +162,35 @@ pica exec <actionId> \
|
|
|
161
162
|
--json
|
|
162
163
|
```
|
|
163
164
|
|
|
164
|
-
All commands support `--json` for machine-readable output.
|
|
165
|
-
|
|
166
165
|
## Key concepts
|
|
167
166
|
|
|
168
|
-
- **Connection key**: Identifies which authenticated connection to use. Format: `live::gmail::default::abc123
|
|
169
|
-
- **Action ID**: Identifies a specific API action.
|
|
170
|
-
- **Platform name**: Kebab-case identifier (
|
|
167
|
+
- **Connection key**: Identifies which authenticated connection to use. Format: `live::gmail::default::abc123`. Get from `list_pica_integrations` or `pica list`.
|
|
168
|
+
- **Action ID**: Identifies a specific API action. Starts with `conn_mod_def::`. Get from search results.
|
|
169
|
+
- **Platform name**: Kebab-case identifier (`gmail`, `hubspot`, `google-calendar`, `ship-station`). Get from `list_pica_integrations`.
|
|
171
170
|
- **Passthrough proxy**: All actions route through Pica's proxy which injects auth, handles rate limits, and normalizes responses. You never touch raw OAuth tokens.
|
|
172
171
|
- **Pagination**: Some actions return `nextPageToken` or similar. Pass it back in subsequent requests to page through results.
|
|
173
172
|
|
|
173
|
+
## MCP installation details
|
|
174
|
+
|
|
175
|
+
`pica init` writes MCP configs here:
|
|
176
|
+
|
|
177
|
+
| Agent | Global | Project |
|
|
178
|
+
|-------|--------|---------|
|
|
179
|
+
| Claude Code | `~/.claude.json` | `.mcp.json` |
|
|
180
|
+
| Claude Desktop | `~/Library/Application Support/Claude/claude_desktop_config.json` | n/a |
|
|
181
|
+
| Cursor | `~/.cursor/mcp.json` | `.cursor/mcp.json` |
|
|
182
|
+
| Windsurf | `~/.codeium/windsurf/mcp_config.json` | n/a |
|
|
183
|
+
|
|
184
|
+
Global = available everywhere. Project = committed to repo, shared with team (each person needs their own API key).
|
|
185
|
+
|
|
186
|
+
If MCP tools are not available, install and init:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
cd /Users/moe/projects/one/connection-cli
|
|
190
|
+
npm install && npm run build && npm link
|
|
191
|
+
pica init
|
|
192
|
+
```
|
|
193
|
+
|
|
174
194
|
## Common patterns
|
|
175
195
|
|
|
176
196
|
### Send an email
|
|
@@ -189,7 +209,7 @@ All commands support `--json` for machine-readable output.
|
|
|
189
209
|
3. Execute with `data: { channel, text }`
|
|
190
210
|
|
|
191
211
|
### CRM operations
|
|
192
|
-
1. Search: `platform: "hubspot"` or `"attio"`, query: `"create contact"` / `"list contacts"`
|
|
212
|
+
1. Search: `platform: "hubspot"` or `"attio"`, query: `"create contact"` / `"list contacts"`
|
|
193
213
|
2. Knowledge: understand required fields
|
|
194
214
|
3. Execute with the right data shape
|
|
195
215
|
|