Skip to content

Commit c799b62

Browse files
committed
feat: initial socket-gate WIP
1 parent 42f5e61 commit c799b62

15 files changed

Lines changed: 2455 additions & 134 deletions

README.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ A Model Context Protocol (MCP) server for Socket integration, allowing AI assist
99
## ✨ Features
1010

1111
- 🔍 **Dependency Security Scanning** - Get comprehensive security scores for npm, PyPI, and other package ecosystems
12+
- 🛡️ **Verdicts + Alerts** - PASS/WARN/FAIL verdicts with Socket alerts for actionable context
13+
- 🚧 **Claude Code Install Gate (Optional)** - PreToolUse hook to warn/block risky package installs before execution
1214
- 🌐 **Public Hosted Service** - Use our public server at `https://mcp.socket.dev/` with no setup required
1315
- 🚀 **Multiple Deployment Options** - Run locally via stdio, HTTP, or use our service
1416
- 🤖 **AI Assistant Integration** - Works seamlessly with Claude, VS Code Copilot, Cursor, and other MCP clients
@@ -138,6 +140,18 @@ To use the Socket MCP server in Windsurf:
138140

139141
If you prefer to run your own instance, you can deploy the Socket MCP server locally using either stdio or HTTP modes.
140142

143+
### (Optional) Claude Code Socket Security Gate
144+
145+
If you use Claude Code, you can install a PreToolUse hook that intercepts package install commands (npm/pip/cargo/etc.), checks them with Socket, and blocks known malware by default.
146+
147+
One-liner setup:
148+
149+
```bash
150+
npx @socketsecurity/mcp@latest --setup-claude-code
151+
```
152+
153+
This will update `~/.claude/settings.json`, install `~/.claude/hooks/socket-gate.sh`, and print a recommended `.claude/CLAUDE.md` snippet.
154+
141155
### Getting an API key
142156

143157
To use a local Socket MCP Server, you need to create an API key. You can do this by following [these steps](https://docs.socket.dev/reference/creating-and-managing-api-tokens). The only required permission scope is `packages:list`, which allows the MCP server to query package metadata for dependency scores.
@@ -196,9 +210,21 @@ This approach automatically uses the latest version without requiring global ins
196210

197211
## Tools exposed by the Socket MCP Server
198212

199-
### depscore
213+
### check_package
214+
215+
Check a single package and return a PASS/WARN/FAIL verdict, category scores, and any Socket alerts.
216+
217+
### batch_check
218+
219+
Check multiple packages at once and return per-package verdicts, scores, alerts, and a summary.
220+
221+
### explain_alert
222+
223+
Explain a Socket alert type in plain language (static knowledge base; no API call).
224+
225+
### depscore (deprecated)
200226

201-
The `depscore` tool allows AI assistants to query the Socket API for dependency scoring information. It provides comprehensive security and quality metrics for packages across different ecosystems.
227+
The `depscore` tool is kept for backward compatibility. Prefer `batch_check`.
202228

203229
**Parameters:**
204230

@@ -257,7 +283,7 @@ You can further customize how the Socket MCP server interacts with your AI assis
257283
Rules that can be added to the client rules file include the following:
258284

259285
```md
260-
Always check dependency scores with the depscore tool when you add a new dependency. If the score is low, consider using an alternative library or writing the code yourself. If you are unsure about the score, ask for a review from someone with more experience. When checking dependencies, make sure to also check the imports not just the pyproject.toml/package.json/dependency file.
286+
Before installing or importing a new dependency, check it with the check_package tool (or batch_check for multiple). If the verdict is FAIL, do not proceed. If the verdict is WARN, explain the risks and ask the user how to proceed. When checking dependencies, make sure to also check the imports not just the pyproject.toml/package.json/dependency file.
261287
```
262288

263289
You can adjust the rules to fit your needs. For example, you can add rules to include specific manifest files, or guide the AI assistant on how to handle low scores. The rules are flexible and can be tailored to your workflow.

0 commit comments

Comments
 (0)