"Configure your Plugged.in API key and MCP connection for Claude Code integration via browser-based device authorization"
Install
npx skillscat add veriteknik/pluggedin-plugin/setup Install via the SkillsCat registry.
Plugged.in Setup
Configure your Plugged.in connection for Claude Code using device authorization.
Instructions
Follow these steps exactly. Do NOT skip steps or ask the user questions — execute the flow automatically.
Step 1: Check if already configured
Check if PLUGGEDIN_API_KEY is already set in the environment. If it starts with pg_in_, tell the user they are already configured and suggest running /pluggedin:status to verify. Stop here if already configured.
Step 2: Determine the base URL
Use PLUGGEDIN_API_BASE_URL if set, otherwise default to https://plugged.in.
Step 3: Initiate device authorization
Run this command (replace $BASE_URL with the value from step 2):
curl -s -X POST "$BASE_URL/api/cli/auth/initiate"Parse the JSON response. You need: device_code, user_code, verification_url, expires_in, and interval.
If the request fails, fall back to the manual setup instructions at the bottom of this file.
Step 4: Open the browser
Open the verification_url in the user's browser:
open "$VERIFICATION_URL" # macOS
# xdg-open "$VERIFICATION_URL" # LinuxStep 5: Display the verification code
Tell the user:
Your browser has been opened. Please verify the code shown matches:
USER_CODEThen click "Authorize" in the browser. Waiting for approval...
Replace USER_CODE with the actual user_code from step 3.
Step 6: Poll for approval
IMPORTANT: Before running the poll command, tell the user:
Waiting for browser authorization... (this polls every 5 seconds until you approve)
Then poll the device code endpoint every interval seconds (default 5), up to expires_in / interval times:
curl -s "$BASE_URL/api/cli/auth/poll?device_code=$DEVICE_CODE"Check the status field in the response:
authorization_pending— keep polling (sleepintervalseconds between polls)approved— the response includesapi_key, proceed to step 7denied— tell the user authorization was denied, stopexpired— tell the user the code expired, suggest re-running/pluggedin:setup
Step 7: Save the API key
Save the API key to both locations so both Claude Code and the MCP proxy can find it:
- Project-level: Read
.claude/settings.local.json(create if missing), mergePLUGGEDIN_API_KEYinto theenvobject, write back. - User-level: Do the same for
~/.claude/settings.local.json(the MCP proxy needs this because its working directory is not the project root).
The resulting files should look like:
{
"env": {
"PLUGGEDIN_API_KEY": "pg_in_..."
}
}If PLUGGEDIN_API_BASE_URL or PLUGGEDIN_MCP_ENDPOINT are set in the environment, include them in both files as well.
Step 8: Done
Tell the user:
Setup complete! Your API key has been saved to both
.claude/settings.local.jsonand~/.claude/settings.local.json.The MCP proxy will detect the new key within a few seconds. Run
/pluggedin:statusto verify.
Manual Setup (Fallback)
If the device authorization flow fails, provide these manual instructions:
Get your API key from https://plugged.in/settings (API Keys section)
- Click "Generate API Key"
- Copy the key (starts with
pg_in_)
Configure the API key in both
.claude/settings.local.json(project) and~/.claude/settings.local.json(user):{ "env": { "PLUGGEDIN_API_KEY": "pg_in_your_key_here" } }Run
/pluggedin:statusto verify (the MCP proxy picks up the key automatically)