Skip to content

feat: OSV-Scanner MCP server#2256

Merged
another-rex merged 13 commits into
google:mainfrom
another-rex:scanner-mcp
Oct 24, 2025
Merged

feat: OSV-Scanner MCP server#2256
another-rex merged 13 commits into
google:mainfrom
another-rex:scanner-mcp

Conversation

@another-rex

@another-rex another-rex commented Oct 1, 2025

Copy link
Copy Markdown
Collaborator

Basic MVP of an osv-scanner MCP server fulfilling workflow 1. Directly vulnerability scanning of a project with prioritisation.

@codecov-commenter

codecov-commenter commented Oct 1, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 9.52381% with 133 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.94%. Comparing base (280ac6a) to head (ac4141c).
⚠️ Report is 285 commits behind head on main.

Files with missing lines Patch % Lines
cmd/osv-scanner/mcp/command.go 0.00% 118 Missing ⚠️
cmd/osv-scanner/mcp/stats.go 0.00% 11 Missing ⚠️
pkg/osvscanner/scan.go 50.00% 1 Missing and 2 partials ⚠️
cmd/osv-scanner/main.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2256      +/-   ##
==========================================
- Coverage   68.64%   67.94%   -0.70%     
==========================================
  Files         169      171       +2     
  Lines       12646    12785     +139     
==========================================
+ Hits         8681     8687       +6     
- Misses       3294     3425     +131     
- Partials      671      673       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@another-rex

Copy link
Copy Markdown
Collaborator Author

/gemini

Comment thread go.mod Outdated
github.com/google/osv-scalibr v0.3.4
github.com/ianlancetaylor/demangle v0.0.0-20250628045327-2d64ad6b7ec5
github.com/jedib0t/go-pretty/v6 v6.6.8
github.com/mark3labs/mcp-go v0.41.1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scorecard is looking into a MCP server as well, is there a reason you went with this library? We had been looking at the official SDK ( partly maintained by the Go team)?
https://github.com/modelcontextprotocol/go-sdk

I haven't personally looked at alternatives, so I'm just trying to avoid redoing any analysis that may have already been done.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked too much into the different mcp libraries, I mostly picked go-mcp as it was the most popular by stars, and was not aware that there is an official one.

But what I found during implementation is that it really doesn't matter too much the mcp library being used, the actual part interfacing with the mcp library is quite minimal, so it should be very easy to switch between different libraries. I might switch to use go-sdk as it looks like an evolution of the go-mcp library that's more officially supported.

@another-rex
another-rex changed the base branch from mcp to main October 20, 2025 05:24
Comment thread cmd/osv-scanner/mcp/command.go Outdated
Comment thread internal/output/mcp.go Outdated
Comment thread .github/workflows/checks.yml
Comment thread cmd/osv-scanner/mcp/command.go Outdated
another-rex and others added 3 commits October 22, 2025 11:17
@another-rex

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an experimental MCP (Model-Context Protocol) server to osv-scanner, allowing AI models to interact with the scanner's capabilities. The implementation adds a new mcp command, which can run as a server over stdio or an SSE HTTP server.

My review has identified a critical race condition in the handling of the vulnerability cache, which could lead to panics under concurrent use. I've also found a high-severity security issue where the HTTP server is started without timeouts, making it vulnerable to resource exhaustion attacks. Additionally, there are a couple of medium-severity suggestions for improving context propagation and code clarity.

Once these critical and high-severity issues are addressed, this will be a great addition to the project.

Comment thread cmd/osv-scanner/mcp/command.go Outdated
Comment thread cmd/osv-scanner/mcp/command.go Outdated
Comment thread cmd/osv-scanner/mcp/command.go
Comment thread internal/output/mcp.go Outdated
@another-rex
another-rex requested a review from cuixq October 22, 2025 04:46

@michaelkedar michaelkedar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment thread cmd/osv-scanner/mcp/command.go Outdated
Comment thread cmd/osv-scanner/mcp/command.go
Comment thread pkg/osvscanner/stats.go
Comment thread cmd/osv-scanner/mcp/command.go Outdated
Comment thread cmd/osv-scanner/mcp/command.go
Comment thread cmd/osv-scanner/mcp/command.go
@another-rex
another-rex merged commit ff8ddf0 into google:main Oct 24, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants