# Socket Connect > Conecta tu agente a Socket iniciando sesión por el navegador, sin copiar ni pegar una API key. Incluye el servidor Socket MCP alojado (OAuth), lista tus organizaciones y enlaza el Socket CLI para escaneos. Fuente: https://skillsagentes.com/skills/socketdev/sauce/socket-connect Markdown: https://skillsagentes.com/skills/socketdev/sauce/socket-connect.md Repositorio: https://github.com/SocketDev/sauce Autor: SocketDev Licencia: MIT Actualizado: hace 25 días Coste de contexto: 54 tok instalada, 1.7k tok al activarse, 1.7k tok con todos los archivos del bundle Bundle: 1 archivo, 7 KB Permisos que pide: ninguno declarado ## Instalación Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina. ```bash # Claude Code npx -y skills add SocketDev/sauce --skill socket-connect --agent claude-code # Cursor npx -y skills add SocketDev/sauce --skill socket-connect --agent cursor # Codex npx -y skills add SocketDev/sauce --skill socket-connect --agent codex # Gemini CLI npx -y skills add SocketDev/sauce --skill socket-connect --agent gemini # Windsurf npx -y skills add SocketDev/sauce --skill socket-connect --agent windsurf # Cline npx -y skills add SocketDev/sauce --skill socket-connect --agent cline ``` ## Qué hace - Conecta el agente a Socket mediante OAuth en el navegador, sin copiar ni pegar una API key - Añade el servidor Socket MCP alojado y detecta si ya está conectado - Lista las organizaciones de Socket a las que el usuario pertenece y permite elegir cuáles usar - Guía la conexión por separado del Socket CLI para escaneos y fixes ## Cuándo usarla - El usuario quiere conectarse, iniciar sesión o hacer login en Socket desde el agente - Otra skill de Socket necesita acceso a la cuenta y ninguna está configurada - Una herramienta de Socket devuelve 401, "needs authentication" o "not connected" - El usuario pertenece a varias organizaciones de Socket y quiere elegir una ## Qué la activa - "Conéctame a Socket desde el agente" - "Inicia sesión en Socket sin pedirme una API key" - "¿Por qué me da 401 la herramienta de Socket?" - "Quiero elegir en qué organización de Socket trabajar" ## Antes de instalar - Necesitas un navegador para aprobar el acceso OAuth; en entornos no interactivos (CI, claude -p) hace falta iniciar sesión antes o usar un token API. - Necesita en el PATH: pnpm - makes network requests ## Archivos - SKILL.md — 7 KB ## SKILL.md Reproducido tal cual desde SocketDev/sauce bajo MIT. Esta sección es el documento original y está en inglés. # Connect to Socket Sign in to Socket from the agent with OAuth. The user approves access in the browser, and the agent gets a token for their own account. That token covers every organization the user belongs to, so nobody copies an organization API token out of the dashboard. This plugin ships the hosted Socket MCP server (`https://mcp.socket.dev/`). Other Socket skills install it as a dependency, so most users already have it. ## When to Use - The user wants to connect, sign in, or log in to Socket from the agent - Another Socket skill needs account access and none is configured - A Socket tool returns 401, "needs authentication", or "not connected" - The user belongs to several Socket organizations and wants to pick one - The user asks how to use Socket without pasting an API key ## Step 1: Check Whether Socket Is Connected Look for a Socket MCP tool named `organizations` among your available tools. The full tool name depends on how the server was added. For example, it can be `mcp__plugin_socket-connect_socket__organizations`, `mcp__socket__organizations`, or `mcp__socket-mcp__organizations`. Match on the server URL or the `organizations` suffix, never on one hard-coded prefix. - If the tool exists, call it. A list of organizations means the user is connected. Go to Step 3. - If the call fails with an authentication error, or the tool is missing, go to Step 2. ## Step 2: Sign In With the Browser Tell the user how to sign in for their agent. Nobody needs an API key. | Agent | How to sign in | | ------------------- | ----------------------------------------------------------------------------------------------- | | Claude Code | Run `/mcp`, pick the Socket server, then choose **Authenticate**. A browser window opens. | | Claude Code (shell) | `claude mcp login `, using the name shown by `/mcp`. Add `--no-browser` over SSH. | | Cursor | Open **Customize** in the sidebar, select the Socket server, and sign in to it. | | Gemini CLI | Run `/mcp auth socket`. | | Codex | Run `/mcp login socket`, or `codex mcp login socket` from a shell. Add `--no-browser` over SSH. | If the Socket server is not listed at all, add it by URL. In Claude Code: ```shell claude mcp add --transport http socket https://mcp.socket.dev/ ``` The browser shows Socket's sign-in and consent pages. If the user has no account, they can create a free one there. After they approve, call `organizations` again to confirm. Non-interactive runs (`claude -p`, Agent SDK, CI) cannot open a browser. Sign in once interactively, or use an API token as described in Step 5. ## Step 3: Choose Which Organizations to Use The `organizations` tool returns the organizations this sign-in can reach. Which ones that is depends on what the user granted on Socket's consent page. - **One organization:** use it. If the user wants a different organization, clear the Socket server's sign-in (in Claude Code, `/mcp` or `claude mcp logout `) and sign in again, choosing that organization on the consent page. - **Several organizations:** use all of them by default, or the ones the user selects. Remember the selection for the rest of the session, and never narrow it silently. Org-scoped tools such as `alerts` and `threat_feed` take one `org_slug` per call. To cover several organizations, call the tool once per organization and label each result with its organization. ## Step 4: Use Socket Through MCP Once connected, prefer the MCP tools over pasted tokens: - `depscore` - scores for one or more packages (used by `/socket-inspect`) - `alerts` - open alerts across the organization's monitored packages - `threat_feed` - recent malware and threat reports - `package_files`, `package_file_contents`, `package_file_grep` - read a published package's files ## Step 5: Connect the Socket CLI (Scans and Fixes) The MCP server does not create scans. `/socket-scan` and `/socket-fix` use the Socket CLI, which signs in separately. `socket login` needs an interactive terminal, so the agent cannot run it through its shell tool. Ask the user to run it themselves (in Claude Code, type `! pnpm dlx socket login`): ```shell pnpm dlx socket login ``` - If the CLI opens a browser and shows a device code, the user approves it the same way as Step 2. No token is pasted. - If the CLI instead prompts for an API token, that CLI release predates browser login. The current npm release still prompts for a token. Ask the user whether they want to create an API token in the dashboard and paste it into the masked prompt (never into the chat), or skip CLI-only features for now. The CLI sets its default organization to the first one it finds. If that differs from the organization chosen in Step 3, pass `--org ` to CLI commands, or ask before changing the default with `pnpm dlx socket config set defaultOrg `. Verify the CLI without printing a credential: ```shell pnpm dlx socket organization list --json --no-banner --no-spinner ``` For CI and other non-interactive environments, an organization API token in `SOCKET_CLI_API_TOKEN` remains the right choice. See `/socket-setup` for CI configuration. ## Error Handling - **No Socket tools after installing the plugin:** restart the agent or reload plugins so the bundled MCP server loads, then check `/mcp`. - **Browser does not open:** copy the URL the agent prints into a browser. Over SSH, use the `--no-browser` option and open the URL locally. - **`organizations` returns an empty list:** the account has no organization yet. Create one at , then call `organizations` again. - **401 after it worked before:** the session expired or was revoked. Sign in again from Step 2. - **Wrong account:** clear the server's authentication in `/mcp` (or `claude mcp logout `), then sign in again. ## Tips - Never ask the user to paste an API token into the chat. Browser sign-in keeps the credential out of the conversation. - Do not print credential values to confirm a connection. Call `organizations` instead. - Use every organization the sign-in reaches unless the user selects fewer. To reach an organization the sign-in does not cover, sign in again instead of asking for a token. - The MCP server and the Socket CLI sign in separately. Being connected over MCP does not make `pnpm dlx socket scan create` work. - If the user has no account and does not want one, leave Socket unconnected. Public package lookups such as `depscore` may still work. ## Dónde encaja - Categoría: [Seguridad](https://skillsagentes.com/categorias/seguridad.md) — Auditorías, revisión de dependencias, manejo de secretos y modelado de amenazas. - Creador: [SocketDev](https://skillsagentes.com/creators/socketdev.md) — 15 skills en el directorio - [Todas las skills](https://skillsagentes.com/skills.md) - [Ranking de instalaciones](https://skillsagentes.com/ranking.md) ## Otras skills del mismo repositorio - [Socket Fix](https://skillsagentes.com/skills/socketdev/sauce/socket-fix.md): Arregla problemas de seguridad en dependencias: escanea y corrige todo (requiere /socket-scan) o repara un paquete concreto, orquestando los subskills de limpieza, reemplazo, parcheo y actualización. - [Socket Dep Upgrade](https://skillsagentes.com/skills/socketdev/sauce/socket-dep-upgrade.md): Usa `socket fix` para encontrar y actualizar dependencias vulnerables, y luego corrige los cambios incompatibles en el código. Actualizaciones auditadas en seguridad con migración de código automatizada. - [Socket Inspect](https://skillsagentes.com/skills/socketdev/sauce/socket-inspect.md): Investiga un paquete antes de depender de él: extrae señales de Socket (scores, alertas, malware, CVEs, riesgo de cadena de suministro), revisa socket.dev, evalúa alternativas y muestra parches disponibles. - [Socket Scan](https://skillsagentes.com/skills/socketdev/sauce/socket-scan.md): Ejecuta un escaneo de dependencias con Socket CLI: pide login o cuenta si no estás autenticado, ofrece un SBOM local si lo rechazas, y añade reachability y auditoría de licencias para enterprise. - [Socket Scan Setup](https://skillsagentes.com/skills/socketdev/sauce/socket-scan-setup.md): Configura los requisitos previos para escanear con Socket: instala la CLI, inicia sesión con tu propia cuenta y verifica el acceso antes del primer escaneo o ante errores de autenticación. ## Skills relacionadas - [Socket Fix](https://skillsagentes.com/skills/socketdev/sauce/socket-fix.md): Arregla problemas de seguridad en dependencias: escanea y corrige todo (requiere /socket-scan) o repara un paquete concreto, orquestando los subskills de limpieza, reemplazo, parcheo y actualización. - [Socket Dep Patch](https://skillsagentes.com/skills/socketdev/sauce/socket-dep-patch.md): Aplica los parches de seguridad a nivel binario de Socket sin cambiar versiones de dependencias, usando socket-patch apply, y verifica que el parcheo persista en cada instalación. - [Socket Dep Upgrade](https://skillsagentes.com/skills/socketdev/sauce/socket-dep-upgrade.md): Usa `socket fix` para encontrar y actualizar dependencias vulnerables, y luego corrige los cambios incompatibles en el código. Actualizaciones auditadas en seguridad con migración de código automatizada. - [Socket Inspect](https://skillsagentes.com/skills/socketdev/sauce/socket-inspect.md): Investiga un paquete antes de depender de él: extrae señales de Socket (scores, alertas, malware, CVEs, riesgo de cadena de suministro), revisa socket.dev, evalúa alternativas y muestra parches disponibles. - [Socket Scan](https://skillsagentes.com/skills/socketdev/sauce/socket-scan.md): Ejecuta un escaneo de dependencias con Socket CLI: pide login o cuenta si no estás autenticado, ofrece un SBOM local si lo rechazas, y añade reachability y auditoría de licencias para enterprise. --- Skills Agentes · [Índice de páginas en markdown](https://skillsagentes.com/sitemap.md) · [Inicio](https://skillsagentes.com/index.md)