Add an MCP server exposing the OSV API as tools for AI agents

未关闭
#6,272 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
api, security

调研方向

Start with the existing Python tooling pattern in tools/datafix and the MCP SDK. Create an isolated server under tools/osv-mcp/ with its own pyproject.toml, using OSV_API_BASE_URL to target the stable /v1 endpoints. Done means exposing the four listed query and vulnerability lookup tools without adding dependencies to the root library; the issue says a PR is being opened, so check for that work before starting.

由索引模型根据 Issue 内容生成。

描述

Is your feature request related to a problem? Please describe.

AI coding agents (Claude, Gemini, Joule, etc.) increasingly author and modify dependency manifests, but they have no first-class, machine-native way to ask OSV "is this package/version vulnerable?" during a task. Today an agent has to know and hand-roll the OSV REST contract. There is no Model Context Protocol (MCP) server in this repo, so OSV cannot be plugged into the MCP tool ecosystem that these agents natively consume.

Describe the solution you'd like

A small, self-contained MCP server under tools/ that wraps the stable public OSV REST API (https://api.osv.dev) as MCP tools, so any MCP-capable agent can query OSV directly:

  • query_package_vulnerabilities(package_name, ecosystem, version=None) → POST /v1/query
  • query_by_commit(commit) → POST /v1/query
  • query_batch(queries) → POST /v1/querybatch
  • get_vulnerability(vuln_id) → GET /v1/vulns/{id}

Design intent:

  • Python, using the official mcp SDK, matching the existing Python tooling (poetry, yapf, pylint).
  • Fully isolated in its own tools/osv-mcp/ directory with its own pyproject.toml (same pattern as tools/datafix), so nothing leaks into the root osv library.
  • Thin REST wrapper only — no GCP dependencies, no new surface on the Go migration path. Only the stable /v1 endpoints (the two /v1experimental/ endpoints are intentionally excluded).
  • OSV_API_BASE_URL env var to target staging / a local API dev server.

Describe alternatives you've considered

  • A Go implementation (matching the repo's Python→Go migration direction) — but the MCP SDK is most mature in Python, this is auxiliary tooling rather than a core service, and tools/datafix establishes the Python-in-tools/ precedent.
  • Leaving it to third-party/out-of-tree MCP wrappers — but a first-party server keeps the tool surface and endpoint contracts in sync with OSV itself.

Additional context

Happy to open a PR for this. Flagging up front per CONTRIBUTING: this would be an AI-assisted contribution and the PR will disclose that. I'll sign the CLA. Opening a PR alongside this issue for concreteness, but happy to iterate on scope/placement first.

主要语言
Go
星标
3k
派生
390
平均合并
1 天 1 小时
30 天内合并 PR
129

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

google/osv.dev 的其他 Issue

查看 google/osv.dev 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。