Skip to content

Commit ad54b9e

Browse files
authored
Merge pull request #151 from SocketDev/feat/add-ruby-gem-ecosystem
Add Ruby gems and other ecosystems to depscore tool
2 parents 7545583 + 40e7863 commit ad54b9e

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function createConfiguredServer (): McpServer {
8888
description: "Get the dependency score of packages with the `depscore` tool from Socket. Use 'unknown' for version if not known. Use this tool to scan dependencies for their quality and security on existing code or when code is generated. Stop generating code and ask the user how to proceed when any of the scores are low. When checking dependencies, make sure to also check the imports in the code, not just the manifest files (pyproject.toml, package.json, etc).",
8989
inputSchema: {
9090
packages: z.array(z.object({
91-
ecosystem: z.string().describe('The package ecosystem (e.g., npm, pypi)').default('npm'),
91+
ecosystem: z.string().describe('The package ecosystem (e.g., npm, pypi, gem, golang, maven, nuget, cargo)').default('npm'),
9292
depname: z.string().describe('The name of the dependency'),
9393
version: z.string().describe("The version of the dependency, use 'unknown' if not known").default('unknown'),
9494
})).describe('Array of packages to check'),

test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ test('Socket MCP Server', async (t) => {
4545
{ depname: 'lodash', ecosystem: 'npm', version: '4.17.21' },
4646
{ depname: 'react', ecosystem: 'npm', version: '18.2.0' },
4747
{ depname: 'requests', ecosystem: 'pypi', version: '2.31.0' },
48+
{ depname: 'puma', ecosystem: 'gem', version: '6.4.0' },
4849
{ depname: 'unknown-package', ecosystem: 'npm', version: 'unknown' }
4950
]
5051

@@ -61,6 +62,30 @@ test('Socket MCP Server', async (t) => {
6162
assert.ok(result.content.length > 0, 'Content should not be empty')
6263
})
6364

65+
await t.test('call depscore tool with gem ecosystem', async () => {
66+
const gemPackages = [
67+
{ depname: 'puma', ecosystem: 'gem', version: '6.4.0' },
68+
{ depname: 'rails', ecosystem: 'gem', version: '7.1.0' },
69+
{ depname: 'nokogiri', ecosystem: 'gem', version: '1.16.0' }
70+
]
71+
72+
const result = await client.callTool({
73+
name: 'depscore',
74+
arguments: {
75+
packages: gemPackages
76+
}
77+
})
78+
79+
assert.ok(result, 'Should get a result from depscore for gem packages')
80+
assert.ok(result.content, 'Result should have content')
81+
assert.ok(Array.isArray(result.content), 'Content should be an array')
82+
assert.ok(result.content.length > 0, 'Content should not be empty')
83+
84+
const textContent = result.content[0] as { type: string; text: string }
85+
assert.ok(textContent.text.includes('pkg:gem/'), 'Result should contain gem purl format')
86+
assert.ok(!textContent.text.includes('No score found'), 'Gem packages should have scores')
87+
})
88+
6489
await t.test('close client', async () => {
6590
await client.close()
6691
assert.ok(true, 'Client closed successfully')

0 commit comments

Comments
 (0)