Skip to content

Commit ca3f1a2

Browse files
committed
2.0.3 - Automatically install MCP
1 parent 391b364 commit ca3f1a2

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

README.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,9 @@ This extension provides automatic reporting of security concerns from [Socket Se
88

99
* Socket detects multiple alternate forms of package imports, including dynamic `import()` or `require` in JavaScript or `importlib.import_module` in Python.
1010

11-
## After Package Installation
11+
## MCP Server
1212

13-
Workspaces are run against Socket's reporting utilities upon detection of JavaScript or Python dependencies. Note these also run prior to actual installation: presence in `package.json`, `requirements.txt`, or any other supported file is enough.
14-
15-
* Package dependency files like `package.json` and `pyproject.toml` are run against more thorough issue reporting to see exact issues for each dependency. These are listed in the "Problems" tab for easy access.
16-
17-
* You can hover over package imports in JavaScript or Python code to see a summary of their issues.
18-
19-
## Pull Requests
20-
21-
* Simplified GitHub application installation is available as a code lens. It detects your username/organization and sets up the installation workflow automatically with a simple click. These reports are more extensive than the ones provided within the extension and include things such as transitive issue aggregation and diffing from one commit to another. If you want these features, please install [the GitHub app](https://github.com/marketplace/socket-security).
13+
* This will automatically register the socket MCP server at https://mcp.socket.dev to allow usage of the public MCP server.
2214

2315
# Team Guide
2416

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-socket-security",
33
"displayName": "Socket Security",
44
"description": "Editor integration with Socket Security",
5-
"version": "2.0.2",
5+
"version": "2.0.3",
66
"private": true,
77
"preview": false,
88
"categories": [
@@ -77,6 +77,12 @@
7777
"category": "Socket Security",
7878
"command": "socket-security.login"
7979
}
80+
],
81+
"mcpServerDefinitionProviders": [
82+
{
83+
"id": "socket-security.mcp-server",
84+
"label": "[Extension] Socket Security"
85+
}
8086
]
8187
},
8288
"bugs": {
@@ -87,7 +93,7 @@
8793
"vscode:prepublish": "npm run esbuild -- --minify",
8894
"vscode:uninstall": "node ./src/lifecycle/uninstall.mjs",
8995
"esbuild-base": "esbuild --bundle --external:tree-sitter-java --external:vscode --loader:.wasm=binary --loader:.go=file --loader:.py=text --outdir=out/ --platform=node --sourcemap",
90-
"esbuild": "npm run esbuild-base -- --format=cjs main=src/extension.ts",
96+
"esbuild": "npm run esbuild-base -- --format=cjs main=src/extension.ts --define:EXTENSION_VERSION=\"\\\"$npm_package_version\\\"\"",
9197
"test-compile": "tsc -p ./",
9298
"lint": "eslint \"src/**/*.ts\"",
9399
"compile": "npm run esbuild",

src/extension.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,37 @@
11
// The module 'vscode' contains the VS Code extensibility API
22
// Import the module and reference it with the alias vscode in your code below
33

4-
import { ExtensionContext } from 'vscode';
4+
import * as vscode from 'vscode';
55
import * as editorConfig from './data/editor-config';
66
import * as files from './ui/file'
77
import * as auth from './auth'
88

9-
export async function activate(context: ExtensionContext) {
9+
// This identifier is replaced at build time by esbuild using --define:EXTENSION_VERSION
10+
// Keep a `typeof` guard when reading it so runtime is safe if the define wasn't provided.
11+
declare const EXTENSION_VERSION: string | undefined;
12+
13+
export async function activate(context: vscode.ExtensionContext) {
1014
editorConfig.activate(context);
1115
auth.activate(context, context.subscriptions);
1216
files.activate(context);
17+
if (vscode.lm?.registerMcpServerDefinitionProvider) {
18+
const definition: vscode.McpHttpServerDefinition = new vscode.McpHttpServerDefinition(
19+
'[Extension] Socket Security',
20+
vscode.Uri.parse('https://mcp.socket.dev/'),
21+
{
22+
'user-agent': `Socket Security VSCode Extension/${EXTENSION_VERSION}`,
23+
}
24+
)
25+
const provider: vscode.McpServerDefinitionProvider<vscode.McpHttpServerDefinition> = {
26+
provideMcpServerDefinitions(token) {
27+
return [
28+
definition
29+
];
30+
},
31+
resolveMcpServerDefinition(definition, token) {
32+
return definition
33+
}
34+
}
35+
vscode.lm.registerMcpServerDefinitionProvider('socket-security.mcp-server', provider);
36+
}
1337
}

0 commit comments

Comments
 (0)