@socketsecurity/mcp 0.0.7 → 0.0.9

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 CHANGED
@@ -1,132 +1,311 @@
1
1
  # Socket MCP Server
2
2
 
3
+ [![npm version](https://badge.fury.io/js/@socketsecurity%2Fmcp.svg)](https://badge.fury.io/js/@socketsecurity%2Fmcp)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Socket Badge](https://socket.dev/api/badge/npm/package/@socketsecurity/mcp)](https://socket.dev/npm/package/@socketsecurity/mcp)
6
+
3
7
  A Model Context Protocol (MCP) server for Socket integration, allowing AI assistants to efficiently check dependency vulnerability scores and security information.
4
8
 
5
- 🛠️ This project is in early development and rapidly evolving.
9
+ ## ✨ Features
6
10
 
7
- ## Tools
11
+ - 🔍 **Dependency Security Scanning** - Get comprehensive security scores for npm, PyPI, and other package ecosystems
12
+ - 🌐 **Public Hosted Service** - Use our public server at `https://mcp.socket.dev/` with no setup required
13
+ - 🚀 **Multiple Deployment Options** - Run locally via stdio, HTTP, or use our service
14
+ - 🤖 **AI Assistant Integration** - Works seamlessly with Claude, VS Code Copilot, Cursor, and other MCP clients
15
+ - 📊 **Batch Processing** - Check multiple dependencies in a single request
16
+ - 🔒 **No Authentication Required** - Public server requires no API keys or registration
8
17
 
9
- ### depscore
18
+ 🛠️ This project is in early development and rapidly evolving.
10
19
 
11
- The `depscore` tool allows AI assistants to query the Socket API for dependency scoring information. It provides security and quality metrics for packages across different ecosystems.
20
+ ## 🚀 Quick Start
12
21
 
13
- **Parameters:**
22
+ ### Option 1: Use the Public Socket MCP Server (Recommended)
14
23
 
15
- - `ecosystem`: The package ecosystem (e.g., npm, PyPI). Defaults to "npm".
16
- - `depname`: The name of the dependency.
17
- - `version`: The version of the dependency. Defaults to "unknown".
24
+ The easiest way to get started is to use our public Socket MCP server. **No API key or authentication required!** Click a button below to install the public server in your favorite AI assistant.
18
25
 
19
- ## Configuration
20
26
 
21
- ### Getting an API key
27
+ [![Install in VS Code](https://img.shields.io/badge/VS_Code-Socket_MCP-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect/mcp/install?name=socket-mcp&config={"url":"https://mcp.socket.dev/","type":"http"})
28
+ [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=socket-mcp&config=eyJ0eXBlIjoiaHR0cCIsInVybCI6Imh0dHBzOi8vbWNwLnNvY2tldC5kZXYifQ%3D%3D)
22
29
 
23
- To use the 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.
24
30
 
31
+ <details><summary><b>Manual Installation Instructions & more MCP Clients</b></summary>
25
32
 
26
- ### Usage with Claude Desktop
33
+ <details><summary><b>Install in Claude Desktop or Claude Code</b></summary>
27
34
 
28
35
  > [!NOTE]
29
36
  > Custom integrations are not available to all paid versions of Claude. Check [here](https://support.anthropic.com/en/articles/11175166-about-custom-integrations-using-remote-mcp) for more information.
30
37
 
31
- To use this MCP server with Claude Desktop:
38
+ To use the public Socket MCP server with Claude Desktop:
32
39
 
33
- 1. Install the Socket MCP server:
40
+ 1. In Claude Desktop, go to Settings > Developer > Edit Config.
34
41
 
35
- ```bash
36
- npm install -g @socketsecurity/mcp
37
- ```
42
+ 2. Add the Socket MCP server configuration:
38
43
 
39
- 2. Set the API key in your environment:
44
+ ```json
45
+ {
46
+ "mcpServers": {
47
+ "socket-mcp": {
48
+ "type": "http",
49
+ "url": "https://mcp.socket.dev/"
50
+ }
51
+ }
52
+ }
53
+ ```
40
54
 
41
- ```bash
42
- export SOCKET_API_KEY=your_api_key_here
43
- ```
55
+ 3. Save the configuration and restart Claude Desktop.
56
+
57
+ 4. Now you can ask Claude questions like "Check the security score for express version 4.18.2".
58
+
59
+ The process is similar for Claude Code. See the [Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code/mcp) for more details. Here's an example command to add the Socket MCP server:
60
+
61
+ ```bash
62
+ claude mcp add --transport http socket-mcp https://mcp.socket.dev/
63
+ ```
64
+
65
+ </details>
66
+
67
+ <details><summary><b>Install in VS Code</b></summary>
68
+
69
+ You can install the Socket MCP server using the VS Code CLI:
70
+
71
+ ```bash
72
+ # For VS Code with GitHub Copilot
73
+ code --add-mcp '{"name":"socket-mcp","type":"http","url":"https://mcp.socket.dev/}'
74
+ ```
75
+
76
+ After installation, the Socket MCP server will be available for use with your GitHub Copilot agent in VS Code.
77
+
78
+ Alternatively, you can manually add it to your VS Code MCP configuration in `.vscode/mcp.json`:
79
+
80
+ ```json
81
+ {
82
+ "servers": {
83
+ "socket-mcp": {
84
+ "type": "http",
85
+ "url": "https://mcp.socket.dev/"
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ </details>
44
92
 
45
- 3. In Claude Desktop, go to Settings > Developer > Edit Config.
93
+ <details><summary><b>Install in Cursor</b></summary>
46
94
 
95
+ Go to `Cursor Settings` -> `MCP` -> `Add new MCP Server`. Name it "socket-mcp", use `http` type with URL `https://mcp.socket.dev/`.
47
96
 
48
- ```js
97
+ ```json
49
98
  {
50
99
  "mcpServers": {
51
100
  "socket-mcp": {
52
- "command": "socket-mcp",
53
- "args": [],
54
- "env": {
55
- "SOCKET_API_KEY": "your-api-key"
56
- }
101
+ "type": "http",
102
+ "url": "https://mcp.socket.dev/"
57
103
  }
58
104
  }
59
105
  }
60
106
  ```
61
107
 
62
- 4. Enter the following:
63
- - Name: Socket
64
- - Command: `socket-mcp`
65
- - Save the configuration.
108
+ </details>
109
+
110
+ <details><summary><b>Install in Windsurf</b></summary>
66
111
 
67
- 5. Now you can ask Claude questions like "Check the security score for express version 4.18.2".
112
+ > [!WARNING]
113
+ > Windsurf does not support `http` type MCP servers yet. Use the `stdio` configuration [below](#option-2a-stdio-mode-default).
68
114
 
69
- The process is similar for Claude Code. See the [Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code/tutorials#set-up-model-context-protocol-mcp) for more details.
115
+ To use the Socket MCP server in Windsurf:
70
116
 
71
- ### Usage with VS Code
117
+ 1. Open Windsurf Settings
118
+ 2. Navigate to MCP Servers section
119
+ 3. Add a new server with the following configuration:
120
+
121
+ ```json
122
+ {
123
+ "mcpServers": {
124
+ "socket-mcp": {
125
+ "serverUrl": "https://mcp.socket.dev/mcp"
126
+ }
127
+ }
128
+ }
129
+ ```
72
130
 
73
- For quick installation, you can use the following link to install the Socket MCP server in VS Code:
131
+ 4. Save the configuration and restart Windsurf if needed.
74
132
 
133
+ </details>
75
134
 
76
- [![Install in VS Code](https://img.shields.io/badge/VS_Code-Socket_MCP-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect/mcp/install?name=socket-mcp&inputs=[{"type":"promptString","id":"socket_api_key","description":"Socket%20API%20key","password":true}]&config={"command":"depscore","type":"stdio","env":{"SOCKET_API_KEY":"${input:socket_api_key}"}})
135
+ </details>
77
136
 
137
+ ### Option 2: Deploy Socket MCP Server on your machine
78
138
 
79
- To use this MCP server in VS Code:
139
+ If you prefer to run your own instance, you can deploy the Socket MCP server locally using either stdio or HTTP modes.
80
140
 
81
- 1. Set the API key in your environment:
141
+ ### Getting an API key
142
+
143
+ 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.
144
+
145
+ For local deployment, you have two options:
146
+
147
+ ##### Option 2a: Stdio Mode (Default)
148
+
149
+ Click a button below to install the self-hosted stdio server in your favorite AI assistant.
150
+
151
+ [![Install in VS Code](https://img.shields.io/badge/VS_Code-Socket_MCP-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect/mcp/install?name=socket-mcp&config={"command":"npx","args":["@socketsecurity/mcp@latest"],"type":"stdio"})
152
+ [![Install in Cursor (stdio)](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=socket-mcp-stdio&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAc29ja2V0c2VjdXJpdHkvbWNwQGxhdGVzdCJdLCJlbnYiOnsiU09DS0VUX0FQSV9LRVkiOiJ5b3VyLWFwaS1rZXktaGVyZSJ9fQ==)
153
+
154
+ Claude Code (stdio mode) can be set up with the following command:
155
+
156
+ ```bash
157
+ claude mcp add socket-mcp -e SOCKET_API_KEY="your-api-key-here" -- npx -y @socketsecurity/mcp@latest
158
+ ```
159
+ This is how the configuration looks like on most MCP clients:
82
160
 
161
+ ```json
162
+ {
163
+ "mcpServers": {
164
+ "socket-mcp": {
165
+ "command": "npx",
166
+ "args": ["@socketsecurity/mcp@latest"],
167
+ "env": {
168
+ "SOCKET_API_KEY": "your-api-key-here"
169
+ }
170
+ }
171
+ }
172
+ }
173
+ ```
174
+
175
+ This approach automatically uses the latest version without requiring global installation.
176
+
177
+
178
+ ##### Option 2b: HTTP Mode
179
+
180
+ 1. Run the server in HTTP mode using npx:
83
181
  ```bash
84
- export SOCKET_API_KEY=your_api_key_here
182
+ MCP_HTTP_MODE=true SOCKET_API_KEY=your-api-key npx @socketsecurity/mcp@latest --http
85
183
  ```
86
184
 
87
- 2. In VS Code settings, add the Socket MCP server to your configuration `.vscode/mcp.json` file:
88
-
185
+ 2. Configure your MCP client to connect to the HTTP server:
89
186
  ```json
187
+ {
188
+ "mcpServers": {
189
+ "socket-mcp": {
190
+ "type": "http",
191
+ "url": "http://localhost:3000"
192
+ }
193
+ }
194
+ }
195
+ ```
196
+
197
+ ## Tools exposed by the Socket MCP Server
198
+
199
+ ### depscore
200
+
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.
202
+
203
+ **Parameters:**
204
+
205
+ | Parameter | Type | Required | Default | Description |
206
+ |-----------|------|----------|---------|-------------|
207
+ | `packages` | Array | ✅ Yes | - | Array of package objects to analyze |
208
+ | `packages[].ecosystem` | String | No | `"npm"` | Package ecosystem (`npm`, `pypi`, `cargo`, etc.) |
209
+ | `packages[].depname` | String | ✅ Yes | - | Name of the dependency/package |
210
+ | `packages[].version` | String | No | `"unknown"` | Version of the dependency |
211
+
212
+ **Example Usage:**
213
+
214
+ ```json
215
+ {
216
+ "packages": [
90
217
  {
91
- "inputs": [
92
- {
93
- "type": "promptString",
94
- "id": "socket_api_key",
95
- "description": "Socket API Key",
96
- "password": true
97
- }
98
- ],
99
- "servers": {
100
- "socket-mcp": {
101
- "type": "stdio",
102
- "command": "socket-mcp",
103
- "args": [],
104
- "env": {
105
- "SOCKET_API_KEY": "${input:socket_api_key}"
106
- },
107
- }
108
- }
218
+ "ecosystem": "npm",
219
+ "depname": "express",
220
+ "version": "4.18.2"
221
+ },
222
+ {
223
+ "ecosystem": "pypi",
224
+ "depname": "fastapi",
225
+ "version": "0.100.0"
109
226
  }
110
- ```
227
+ ]
228
+ }
229
+ ```
111
230
 
112
- 3. Now you can ask questions about dependency security within your VS Code environment.
113
- 4. Feel free to add the following to your `.github/copilot-instructions.md` file to control better how the tool is used by your agent:
231
+ **Sample Response:**
232
+ ```
233
+ pkg:npm/express@4.18.2: supply_chain: 1.0, quality: 0.9, maintenance: 1.0, vulnerability: 1.0, license: 1.0
234
+ pkg:pypi/fastapi@0.100.0: supply_chain: 1.0, quality: 0.95, maintenance: 0.98, vulnerability: 1.0, license: 1.0
235
+ ```
114
236
 
115
- ```markdown
116
- ## Socket MCP Server
117
- Always check the 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 decide to use a library with a low score, make sure to document the reasons for your choice. If you are unsure about the score, ask for a review from someone with more experience.
237
+ ### How to Use the Socket MCP Server
238
+
239
+ 1. **Ask your AI assistant** to check dependencies:
240
+ - "Check the security score for express version 4.18.2"
241
+ - "Analyze the security of my package.json dependencies"
242
+ - "What are the vulnerability scores for react, lodash, and axios?"
243
+
244
+ 2. **Get comprehensive security insights** including supply chain, quality, maintenance, vulnerability, and license scores.
245
+
246
+ ### Adjust tool usage with custom rules
247
+
248
+ You can further customize how the Socket MCP server interacts with your AI assistant by modifying your client rules. The rules are usually a markdown file and its location depends on the AI assistant you are using.
249
+
250
+ | MCP Client | Rules File Location |
251
+ |---|---|
252
+ | Claude Desktop/Code | `CLAUDE.md` |
253
+ | VSCode Copilot | `.github/copilot-instructions.md` |
254
+ | Cursor | `.cursor/rules` |
255
+
256
+
257
+ Rules that can be added to the client rules file include the following:
258
+
259
+ ```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.
261
+ ```
262
+
263
+ 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.
118
264
 
119
- When checking dependencies, make sure to also check the imports not just the pyproject.toml/package.json/dependency file.
120
- ```
121
265
 
122
266
  ## Development
123
267
 
124
- ### Prerequisites
268
+ ### For End Users
269
+
270
+ For most users, we recommend using either:
271
+ 1. **Public server**: `https://mcp.socket.dev/` (no setup required)
272
+ 2. **NPX command**: `npx @socketsecurity/mcp@latest` (always latest version)
273
+
274
+ ### For Contributors
275
+
276
+ If you want to contribute to the Socket MCP server development:
277
+
278
+ ### Health Check Endpoint
279
+
280
+ When running in HTTP mode, the server provides a health check endpoint for Kubernetes and Docker deployments:
281
+
282
+ ```bash
283
+ GET /health
284
+ ```
285
+
286
+ **Response:**
287
+ ```json
288
+ {
289
+ "status": "healthy",
290
+ "service": "socket-mcp",
291
+ "version": "0.0.3",
292
+ "timestamp": "2025-06-17T20:45:22.059Z"
293
+ }
294
+ ```
295
+
296
+ This endpoint can be used for:
297
+ - Kubernetes liveness and readiness probes
298
+ - Docker health checks
299
+ - Load balancer health monitoring
300
+ - General service monitoring
301
+
302
+
303
+ #### Prerequisites
125
304
 
126
305
  - Node.js v16 or higher
127
306
  - npm or yarn
128
307
 
129
- ### Installation
308
+ #### Installation
130
309
 
131
310
  Clone the repository and install dependencies:
132
311
 
@@ -136,62 +315,62 @@ cd socket-mcp
136
315
  npm install
137
316
  ```
138
317
 
139
- ## Build
318
+ #### Build
140
319
 
141
- To build the project:
320
+ This project is a directly runnable Node.js project using [Type stripping](https://nodejs.org/docs/latest/api/typescript.html).
321
+ If you are on Node.js 22, run with `node --experimental-strip-types index.ts`.
322
+ On any later versions of Node.js, you can simply run `node index.ts`.
323
+ In either version you can also run the npm run scripts which include the correct flags.
142
324
 
143
- ```bash
144
- npm run build
145
- ```
146
-
147
- This compiles the TypeScript files and makes the binary executable called `socket-mcp`.
325
+ The js files will automatically be build when running `npm publish`, and cleaned up afterwards with `npm run clean`.
148
326
 
149
- ## Run
150
-
151
- To run the Socket MCP server locally:
327
+ If you want to preview the build you can run:
152
328
 
153
329
  ```bash
154
- export SOCKET_API_KEY=your_api_key_here
155
- node build/index.js
330
+ npm run build
156
331
  ```
157
332
 
158
- After installing globally, you can run the executable directly:
333
+ #### Run from Source
334
+
335
+ To run the Socket MCP server from source:
159
336
 
160
337
  ```bash
161
338
  export SOCKET_API_KEY=your_api_key_here
162
- socket-mcp
339
+ node --experimental-strip-types index.ts
163
340
  ```
164
341
 
165
- ### Global Installation
166
-
167
- To install the tool globally and make the `socket-mcp` command available system-wide:
342
+ Or in HTTP mode:
168
343
 
169
344
  ```bash
170
- npm install -g .
345
+ MCP_HTTP_MODE=true SOCKET_API_KEY=your_api_key_here node --experimental-strip-types index.ts --http
171
346
  ```
172
347
 
173
- After global installation, you can use the `socket-mcp` command from anywhere:
348
+ ## 🔧 Troubleshooting
174
349
 
175
- ```bash
176
- export SOCKET_API_KEY=your_api_key_here
177
- socket-mcp
178
- ```
179
-
180
- ## Adjust tool usage with custom rules
350
+ ### Common Issues
181
351
 
182
- You can further customize how the Socket MCP server interacts with your AI assistant by modifying your client rules. The rules are usually a markdown file and its location depends on the AI assistant you are using.
352
+ **Q: The public server isn't responding**
353
+ - Check that you're using the correct URL: `https://mcp.socket.dev/`
354
+ - Verify your MCP client configuration is correct
355
+ - Try restarting your MCP client
183
356
 
184
- | MCP Client | Rules File Location |
185
- |---|---|
186
- | Claude Desktop/Code | `CLAUDE.md` |
187
- | VSCode Copilot | `.github/copilot-instructions.md` |
188
- | Cursor | `.cursor/rules` |
357
+ **Q: Local server fails to start**
358
+ - Ensure you have Node.js v16+ installed
359
+ - Check that your `SOCKET_API_KEY` environment variable is set
360
+ - Verify the API key has `packages:list` permission
189
361
 
362
+ **Q: Getting authentication errors with local server**
363
+ - Double-check your Socket API key is valid
364
+ - Ensure the key has the required `packages:list` scope
365
+ - Try regenerating your API key from the Socket dashboard
190
366
 
191
- Rules that can be added to the client rules file include the following:
367
+ **Q: AI assistant can't find the depscore tool**
368
+ - Restart your MCP client after configuration changes
369
+ - Verify the server configuration is saved correctly
370
+ - Check that the MCP server is running (for local deployments)
192
371
 
193
- ```md
194
- 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.
195
- ```
372
+ ### Getting Help
196
373
 
197
- 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.
374
+ - 📖 [Socket Documentation](https://docs.socket.dev)
375
+ - 🐛 [Report Issues](https://github.com/SocketDev/socket-mcp/issues)
376
+ - 💬 [Community Support](https://github.com/SocketDev/socket-mcp/discussions)
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node --experimental-strip-types
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":""}