vdb-mcp 0.1.0__tar.gz
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.
- vdb_mcp-0.1.0/.gitignore +244 -0
- vdb_mcp-0.1.0/Dockerfile +33 -0
- vdb_mcp-0.1.0/LICENSE +99 -0
- vdb_mcp-0.1.0/PKG-INFO +97 -0
- vdb_mcp-0.1.0/README.md +76 -0
- vdb_mcp-0.1.0/pyproject.toml +39 -0
- vdb_mcp-0.1.0/server.json +34 -0
- vdb_mcp-0.1.0/smithery.yaml +30 -0
- vdb_mcp-0.1.0/vdb_mcp/__init__.py +3 -0
- vdb_mcp-0.1.0/vdb_mcp/server.py +302 -0
vdb_mcp-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
# Python venv dirs — anchored to repo root so they don't collide with
|
|
18
|
+
# unrelated `lib/` directories elsewhere (e.g. docker/web/src/lib/).
|
|
19
|
+
/lib/
|
|
20
|
+
/lib64/
|
|
21
|
+
parts/
|
|
22
|
+
sdist/
|
|
23
|
+
var/
|
|
24
|
+
wheels/
|
|
25
|
+
share/python-wheels/
|
|
26
|
+
*.egg-info/
|
|
27
|
+
.installed.cfg
|
|
28
|
+
*.egg
|
|
29
|
+
MANIFEST
|
|
30
|
+
|
|
31
|
+
# PyInstaller
|
|
32
|
+
# Usually these files are written by a python script from a template
|
|
33
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
34
|
+
*.manifest
|
|
35
|
+
*.spec
|
|
36
|
+
|
|
37
|
+
# Installer logs
|
|
38
|
+
pip-log.txt
|
|
39
|
+
pip-delete-this-directory.txt
|
|
40
|
+
|
|
41
|
+
# Unit test / coverage reports
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
.cache
|
|
48
|
+
nosetests.xml
|
|
49
|
+
coverage.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py.cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
cover/
|
|
55
|
+
|
|
56
|
+
# Translations
|
|
57
|
+
*.mo
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
# Django stuff:
|
|
61
|
+
*.log
|
|
62
|
+
local_settings.py
|
|
63
|
+
db.sqlite3
|
|
64
|
+
db.sqlite3-journal
|
|
65
|
+
|
|
66
|
+
# Flask stuff:
|
|
67
|
+
instance/
|
|
68
|
+
.webassets-cache
|
|
69
|
+
|
|
70
|
+
# Scrapy stuff:
|
|
71
|
+
.scrapy
|
|
72
|
+
|
|
73
|
+
# Sphinx documentation
|
|
74
|
+
docs/_build/
|
|
75
|
+
|
|
76
|
+
# PyBuilder
|
|
77
|
+
.pybuilder/
|
|
78
|
+
target/
|
|
79
|
+
|
|
80
|
+
# Jupyter Notebook
|
|
81
|
+
.ipynb_checkpoints
|
|
82
|
+
|
|
83
|
+
# IPython
|
|
84
|
+
profile_default/
|
|
85
|
+
ipython_config.py
|
|
86
|
+
|
|
87
|
+
# pyenv
|
|
88
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
89
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
90
|
+
# .python-version
|
|
91
|
+
|
|
92
|
+
# pipenv
|
|
93
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
94
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
95
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
96
|
+
# install all needed dependencies.
|
|
97
|
+
# Pipfile.lock
|
|
98
|
+
|
|
99
|
+
# UV
|
|
100
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
101
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
102
|
+
# commonly ignored for libraries.
|
|
103
|
+
# uv.lock
|
|
104
|
+
|
|
105
|
+
# poetry
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
107
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
108
|
+
# commonly ignored for libraries.
|
|
109
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
110
|
+
# poetry.lock
|
|
111
|
+
# poetry.toml
|
|
112
|
+
|
|
113
|
+
# pdm
|
|
114
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
115
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
116
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
117
|
+
# pdm.lock
|
|
118
|
+
# pdm.toml
|
|
119
|
+
.pdm-python
|
|
120
|
+
.pdm-build/
|
|
121
|
+
|
|
122
|
+
# pixi
|
|
123
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
124
|
+
# pixi.lock
|
|
125
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
126
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
127
|
+
.pixi
|
|
128
|
+
|
|
129
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
130
|
+
__pypackages__/
|
|
131
|
+
|
|
132
|
+
# Celery stuff
|
|
133
|
+
celerybeat-schedule
|
|
134
|
+
celerybeat.pid
|
|
135
|
+
|
|
136
|
+
# Redis
|
|
137
|
+
*.rdb
|
|
138
|
+
*.aof
|
|
139
|
+
*.pid
|
|
140
|
+
|
|
141
|
+
# RabbitMQ
|
|
142
|
+
mnesia/
|
|
143
|
+
rabbitmq/
|
|
144
|
+
rabbitmq-data/
|
|
145
|
+
|
|
146
|
+
# ActiveMQ
|
|
147
|
+
activemq-data/
|
|
148
|
+
|
|
149
|
+
# SageMath parsed files
|
|
150
|
+
*.sage.py
|
|
151
|
+
|
|
152
|
+
# Environments
|
|
153
|
+
.env
|
|
154
|
+
.envrc
|
|
155
|
+
.venv
|
|
156
|
+
env/
|
|
157
|
+
venv/
|
|
158
|
+
ENV/
|
|
159
|
+
env.bak/
|
|
160
|
+
venv.bak/
|
|
161
|
+
|
|
162
|
+
# Spyder project settings
|
|
163
|
+
.spyderproject
|
|
164
|
+
.spyproject
|
|
165
|
+
|
|
166
|
+
# Rope project settings
|
|
167
|
+
.ropeproject
|
|
168
|
+
|
|
169
|
+
# mkdocs documentation
|
|
170
|
+
/site
|
|
171
|
+
|
|
172
|
+
# mypy
|
|
173
|
+
.mypy_cache/
|
|
174
|
+
.dmypy.json
|
|
175
|
+
dmypy.json
|
|
176
|
+
|
|
177
|
+
# Pyre type checker
|
|
178
|
+
.pyre/
|
|
179
|
+
|
|
180
|
+
# pytype static type analyzer
|
|
181
|
+
.pytype/
|
|
182
|
+
|
|
183
|
+
# Cython debug symbols
|
|
184
|
+
cython_debug/
|
|
185
|
+
|
|
186
|
+
# PyCharm
|
|
187
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
188
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
189
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
190
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
191
|
+
# .idea/
|
|
192
|
+
|
|
193
|
+
# Abstra
|
|
194
|
+
# Abstra is an AI-powered process automation framework.
|
|
195
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
196
|
+
# Learn more at https://abstra.io/docs
|
|
197
|
+
.abstra/
|
|
198
|
+
|
|
199
|
+
# Visual Studio Code
|
|
200
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
201
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
202
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
203
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
204
|
+
# .vscode/
|
|
205
|
+
# Temporary file for partial code execution
|
|
206
|
+
tempCodeRunnerFile.py
|
|
207
|
+
|
|
208
|
+
# Ruff stuff:
|
|
209
|
+
.ruff_cache/
|
|
210
|
+
|
|
211
|
+
# PyPI configuration file
|
|
212
|
+
.pypirc
|
|
213
|
+
|
|
214
|
+
# Marimo
|
|
215
|
+
marimo/_static/
|
|
216
|
+
marimo/_lsp/
|
|
217
|
+
__marimo__/
|
|
218
|
+
|
|
219
|
+
# Streamlit
|
|
220
|
+
.streamlit/secrets.toml
|
|
221
|
+
|
|
222
|
+
# ── VDB project ─────────────────────────────────────────────────────────────
|
|
223
|
+
.env
|
|
224
|
+
.env.local
|
|
225
|
+
.env.*.local
|
|
226
|
+
backups/
|
|
227
|
+
*.dump
|
|
228
|
+
*.sql.gz
|
|
229
|
+
|
|
230
|
+
# Docker
|
|
231
|
+
docker/app/__pycache__/
|
|
232
|
+
|
|
233
|
+
# IDE
|
|
234
|
+
.vscode/
|
|
235
|
+
.idea/
|
|
236
|
+
*.swp
|
|
237
|
+
.DS_Store
|
|
238
|
+
|
|
239
|
+
# ── VDB web (Astro) ─────────────────────────────────────────────────────────
|
|
240
|
+
docker/web/node_modules/
|
|
241
|
+
docker/web/dist/
|
|
242
|
+
docker/web/.astro/
|
|
243
|
+
docker/web/package-lock.json
|
|
244
|
+
*.bak
|
vdb_mcp-0.1.0/Dockerfile
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
2
|
+
# vdb-mcp — MCP server that wraps the VDB REST API.
|
|
3
|
+
#
|
|
4
|
+
# Usage (stdio mode, for Claude Desktop / Cursor):
|
|
5
|
+
# docker run -i --rm \
|
|
6
|
+
# -e VDB_API_URL=http://host.docker.internal:8080 \
|
|
7
|
+
# vdb/mcp:dev
|
|
8
|
+
#
|
|
9
|
+
# Usage (HTTP/SSE mode, for remote clients):
|
|
10
|
+
# docker run -d -p 7700:7700 -e MCP_MODE=sse vdb/mcp:dev
|
|
11
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
FROM python:3.12-slim
|
|
14
|
+
|
|
15
|
+
ENV PYTHONUNBUFFERED=1 \
|
|
16
|
+
PYTHONDONTWRITEBYTECODE=1 \
|
|
17
|
+
PIP_NO_CACHE_DIR=1
|
|
18
|
+
|
|
19
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
20
|
+
ca-certificates tini \
|
|
21
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
22
|
+
|
|
23
|
+
WORKDIR /app
|
|
24
|
+
RUN pip install --no-cache-dir "mcp>=1.0.0" "httpx>=0.27.0"
|
|
25
|
+
|
|
26
|
+
COPY vdb_mcp /app/vdb_mcp
|
|
27
|
+
|
|
28
|
+
ENV VDB_API_URL=http://api:8080 \
|
|
29
|
+
MCP_MODE=stdio \
|
|
30
|
+
MCP_PORT=7700
|
|
31
|
+
|
|
32
|
+
ENTRYPOINT ["/usr/bin/tini", "--"]
|
|
33
|
+
CMD ["python", "-m", "vdb_mcp.server"]
|
vdb_mcp-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Licensor: VDB (https://vdb.ai.kr) — Licensed Work: vdb-mcp
|
|
2
|
+
You may use this software freely, including inside a commercial
|
|
3
|
+
organization. You may NOT provide it to third parties as a hosted or
|
|
4
|
+
managed service, or resell it as a product (see Limitations below).
|
|
5
|
+
Commercial licensing inquiries: dev@egdee.com
|
|
6
|
+
|
|
7
|
+
Elastic License 2.0
|
|
8
|
+
|
|
9
|
+
URL: https://www.elastic.co/licensing/elastic-license
|
|
10
|
+
|
|
11
|
+
## Acceptance
|
|
12
|
+
|
|
13
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
14
|
+
|
|
15
|
+
## Copyright License
|
|
16
|
+
|
|
17
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
18
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
19
|
+
available, and prepare derivative works of the software, in each case subject to
|
|
20
|
+
the limitations and conditions below.
|
|
21
|
+
|
|
22
|
+
## Limitations
|
|
23
|
+
|
|
24
|
+
You may not provide the software to third parties as a hosted or managed
|
|
25
|
+
service, where the service provides users with access to any substantial set of
|
|
26
|
+
the features or functionality of the software.
|
|
27
|
+
|
|
28
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
29
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
30
|
+
software that is protected by the license key.
|
|
31
|
+
|
|
32
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices
|
|
33
|
+
of the licensor in the software. Any use of the licensor’s trademarks is subject
|
|
34
|
+
to applicable law.
|
|
35
|
+
|
|
36
|
+
## Patents
|
|
37
|
+
|
|
38
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
39
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
40
|
+
sale, import and have imported the software, in each case subject to the
|
|
41
|
+
limitations and conditions in this license. This license does not cover any
|
|
42
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
43
|
+
the software. If you or your company make any written claim that the software
|
|
44
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
45
|
+
the software granted under these terms ends immediately. If your company makes
|
|
46
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
47
|
+
company.
|
|
48
|
+
|
|
49
|
+
## Notices
|
|
50
|
+
|
|
51
|
+
You must ensure that anyone who gets a copy of any part of the software from you
|
|
52
|
+
also gets a copy of these terms.
|
|
53
|
+
|
|
54
|
+
If you modify the software, you must include in any modified copies of the
|
|
55
|
+
software prominent notices stating that you have modified the software.
|
|
56
|
+
|
|
57
|
+
## No Other Rights
|
|
58
|
+
|
|
59
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
60
|
+
these terms.
|
|
61
|
+
|
|
62
|
+
## Termination
|
|
63
|
+
|
|
64
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
65
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
66
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
67
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
68
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
69
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
70
|
+
to terminate automatically and permanently.
|
|
71
|
+
|
|
72
|
+
## No Liability
|
|
73
|
+
|
|
74
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
75
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
76
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
77
|
+
legal claim.*
|
|
78
|
+
|
|
79
|
+
## Definitions
|
|
80
|
+
|
|
81
|
+
The **licensor** is the entity offering these terms, and the **software** is the
|
|
82
|
+
software the licensor makes available under these terms, including any portion
|
|
83
|
+
of it.
|
|
84
|
+
|
|
85
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
86
|
+
|
|
87
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
88
|
+
organization that you work for, plus all organizations that have control over,
|
|
89
|
+
are under the control of, or are under common control with that
|
|
90
|
+
organization. **control** means ownership of substantially all the assets of an
|
|
91
|
+
entity, or the power to direct its management and policies by vote, contract, or
|
|
92
|
+
otherwise. Control can be direct or indirect.
|
|
93
|
+
|
|
94
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
95
|
+
these terms.
|
|
96
|
+
|
|
97
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
98
|
+
|
|
99
|
+
**trademark** means trademarks, service marks, and similar rights.
|
vdb_mcp-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vdb-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for VDB — AI-aware vulnerability database (packages, MCP servers, models). Check packages for CVEs and slopsquatting before installing.
|
|
5
|
+
Project-URL: Homepage, https://vdb.ai.kr
|
|
6
|
+
Project-URL: Documentation, https://vdb.ai.kr/connect
|
|
7
|
+
Project-URL: Repository, https://github.com/0pstech/vdb
|
|
8
|
+
Author-email: VDB <dev@egdee.com>
|
|
9
|
+
License: Elastic-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: cve,mcp,model-context-protocol,osv,sbom,security,slopsquatting,supply-chain,vulnerability
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: Other/Proprietary License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Security
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: httpx>=0.27.0
|
|
19
|
+
Requires-Dist: mcp>=1.0.0
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# vdb-mcp
|
|
23
|
+
|
|
24
|
+
MCP (Model Context Protocol) server for **[VDB](https://vdb.ai.kr)** — the
|
|
25
|
+
AI-aware vulnerability database. Lets Claude Desktop, Claude Code, Cursor,
|
|
26
|
+
Cline, Continue, and any MCP client check packages **while generating code**:
|
|
27
|
+
known CVEs, slopsquatting (LLM-hallucinated package names an attacker may have
|
|
28
|
+
registered), CISA KEV status, MCP-server trust profiles, and more.
|
|
29
|
+
|
|
30
|
+
## Quick start
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
uvx vdb-mcp # or: pipx run vdb-mcp
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Claude Desktop (`claude_desktop_config.json`) / Cursor (`.cursor/mcp.json`):
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"mcpServers": {
|
|
41
|
+
"vdb": { "command": "uvx", "args": ["vdb-mcp"] }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
That's it — the server talks to the hosted instance at `https://vdb.ai.kr`
|
|
47
|
+
by default. Anonymous use gets a free per-IP trial; add an API key for
|
|
48
|
+
unmetered access (free at <https://vdb.ai.kr/signup>):
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"vdb": {
|
|
54
|
+
"command": "uvx",
|
|
55
|
+
"args": ["vdb-mcp"],
|
|
56
|
+
"env": { "VDB_API_TOKEN": "vdb_..." }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Tools
|
|
63
|
+
|
|
64
|
+
| Tool | What it does |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `vdb_check_package` | Check one package (purl + optional version) for vulnerabilities, slop risk, KEV |
|
|
67
|
+
| `vdb_check_packages` | Bulk slopsquatting / risk check for a list of packages |
|
|
68
|
+
| `vdb_lookup` | Fetch one advisory by ID (CVE-…, GHSA-…, VDB-SLOP-…) |
|
|
69
|
+
| `vdb_search` | Free-text search over the vulnerability corpus |
|
|
70
|
+
| `vdb_check_mcp_server` | Trust tier + permission scopes of a community MCP server |
|
|
71
|
+
| `vdb_list_slopsquatting` | Current slopsquatting candidates per ecosystem |
|
|
72
|
+
|
|
73
|
+
## Environment
|
|
74
|
+
|
|
75
|
+
| Variable | Default | Meaning |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| `VDB_API_URL` | `https://vdb.ai.kr` | VDB instance to query (set for self-hosted) |
|
|
78
|
+
| `VDB_API_TOKEN` | *(empty)* | `vdb_…` API key — unmetered, per-account quota |
|
|
79
|
+
| `MCP_MODE` | `stdio` | `stdio` or `sse` (long-running HTTP server) |
|
|
80
|
+
| `MCP_PORT` | `7700` | SSE port |
|
|
81
|
+
|
|
82
|
+
## Why
|
|
83
|
+
|
|
84
|
+
LLMs hallucinate package names; attackers register them (slopsquatting).
|
|
85
|
+
LLMs also happily recommend packages with known RCEs. VDB gives your agent a
|
|
86
|
+
guardrail: one tool call before `npm install` / `pip install`. See
|
|
87
|
+
<https://vdb.ai.kr/connect> for the one-line prompt variant that needs no MCP
|
|
88
|
+
at all.
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
[Elastic License 2.0](https://www.elastic.co/licensing/elastic-license) —
|
|
93
|
+
free to use, including inside commercial organizations and CI. The only
|
|
94
|
+
restrictions: you may not offer this software to third parties as a hosted
|
|
95
|
+
or managed service, or resell it as a product. Commercial licensing beyond
|
|
96
|
+
that: <dev@egdee.com>. API usage is governed by the VDB service terms
|
|
97
|
+
regardless of how you call it.
|
vdb_mcp-0.1.0/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# vdb-mcp
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for **[VDB](https://vdb.ai.kr)** — the
|
|
4
|
+
AI-aware vulnerability database. Lets Claude Desktop, Claude Code, Cursor,
|
|
5
|
+
Cline, Continue, and any MCP client check packages **while generating code**:
|
|
6
|
+
known CVEs, slopsquatting (LLM-hallucinated package names an attacker may have
|
|
7
|
+
registered), CISA KEV status, MCP-server trust profiles, and more.
|
|
8
|
+
|
|
9
|
+
## Quick start
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
uvx vdb-mcp # or: pipx run vdb-mcp
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Claude Desktop (`claude_desktop_config.json`) / Cursor (`.cursor/mcp.json`):
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"vdb": { "command": "uvx", "args": ["vdb-mcp"] }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
That's it — the server talks to the hosted instance at `https://vdb.ai.kr`
|
|
26
|
+
by default. Anonymous use gets a free per-IP trial; add an API key for
|
|
27
|
+
unmetered access (free at <https://vdb.ai.kr/signup>):
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"mcpServers": {
|
|
32
|
+
"vdb": {
|
|
33
|
+
"command": "uvx",
|
|
34
|
+
"args": ["vdb-mcp"],
|
|
35
|
+
"env": { "VDB_API_TOKEN": "vdb_..." }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Tools
|
|
42
|
+
|
|
43
|
+
| Tool | What it does |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `vdb_check_package` | Check one package (purl + optional version) for vulnerabilities, slop risk, KEV |
|
|
46
|
+
| `vdb_check_packages` | Bulk slopsquatting / risk check for a list of packages |
|
|
47
|
+
| `vdb_lookup` | Fetch one advisory by ID (CVE-…, GHSA-…, VDB-SLOP-…) |
|
|
48
|
+
| `vdb_search` | Free-text search over the vulnerability corpus |
|
|
49
|
+
| `vdb_check_mcp_server` | Trust tier + permission scopes of a community MCP server |
|
|
50
|
+
| `vdb_list_slopsquatting` | Current slopsquatting candidates per ecosystem |
|
|
51
|
+
|
|
52
|
+
## Environment
|
|
53
|
+
|
|
54
|
+
| Variable | Default | Meaning |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| `VDB_API_URL` | `https://vdb.ai.kr` | VDB instance to query (set for self-hosted) |
|
|
57
|
+
| `VDB_API_TOKEN` | *(empty)* | `vdb_…` API key — unmetered, per-account quota |
|
|
58
|
+
| `MCP_MODE` | `stdio` | `stdio` or `sse` (long-running HTTP server) |
|
|
59
|
+
| `MCP_PORT` | `7700` | SSE port |
|
|
60
|
+
|
|
61
|
+
## Why
|
|
62
|
+
|
|
63
|
+
LLMs hallucinate package names; attackers register them (slopsquatting).
|
|
64
|
+
LLMs also happily recommend packages with known RCEs. VDB gives your agent a
|
|
65
|
+
guardrail: one tool call before `npm install` / `pip install`. See
|
|
66
|
+
<https://vdb.ai.kr/connect> for the one-line prompt variant that needs no MCP
|
|
67
|
+
at all.
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
[Elastic License 2.0](https://www.elastic.co/licensing/elastic-license) —
|
|
72
|
+
free to use, including inside commercial organizations and CI. The only
|
|
73
|
+
restrictions: you may not offer this software to third parties as a hosted
|
|
74
|
+
or managed service, or resell it as a product. Commercial licensing beyond
|
|
75
|
+
that: <dev@egdee.com>. API usage is governed by the VDB service terms
|
|
76
|
+
regardless of how you call it.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vdb-mcp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "MCP server for VDB — AI-aware vulnerability database (packages, MCP servers, models). Check packages for CVEs and slopsquatting before installing."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "Elastic-2.0" }
|
|
12
|
+
authors = [{ name = "VDB", email = "dev@egdee.com" }]
|
|
13
|
+
keywords = [
|
|
14
|
+
"mcp", "model-context-protocol", "security", "vulnerability",
|
|
15
|
+
"sbom", "slopsquatting", "supply-chain", "cve", "osv",
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"License :: Other/Proprietary License",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Topic :: Security",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
# `mcp` pulls starlette/uvicorn needed by the optional SSE mode.
|
|
26
|
+
"mcp>=1.0.0",
|
|
27
|
+
"httpx>=0.27.0",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://vdb.ai.kr"
|
|
32
|
+
Documentation = "https://vdb.ai.kr/connect"
|
|
33
|
+
Repository = "https://github.com/0pstech/vdb"
|
|
34
|
+
|
|
35
|
+
[project.scripts]
|
|
36
|
+
vdb-mcp = "vdb_mcp.server:main"
|
|
37
|
+
|
|
38
|
+
[tool.hatch.build.targets.wheel]
|
|
39
|
+
packages = ["vdb_mcp"]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-09-29/server.schema.json",
|
|
3
|
+
"name": "kr.ai.vdb/vdb",
|
|
4
|
+
"description": "AI-aware vulnerability database: check packages for CVEs, slopsquatting, and KEV status; audit MCP servers and SBOMs — before your agent installs anything.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"url": "https://github.com/0pstech/vdb",
|
|
7
|
+
"source": "github"
|
|
8
|
+
},
|
|
9
|
+
"version": "0.1.0",
|
|
10
|
+
"websiteUrl": "https://vdb.ai.kr",
|
|
11
|
+
"packages": [
|
|
12
|
+
{
|
|
13
|
+
"registryType": "pypi",
|
|
14
|
+
"registryBaseUrl": "https://pypi.org",
|
|
15
|
+
"identifier": "vdb-mcp",
|
|
16
|
+
"version": "0.1.0",
|
|
17
|
+
"transport": { "type": "stdio" },
|
|
18
|
+
"environmentVariables": [
|
|
19
|
+
{
|
|
20
|
+
"name": "VDB_API_URL",
|
|
21
|
+
"description": "VDB instance origin. Defaults to the hosted https://vdb.ai.kr.",
|
|
22
|
+
"isRequired": false,
|
|
23
|
+
"isSecret": false
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "VDB_API_TOKEN",
|
|
27
|
+
"description": "Optional vdb_… API key for unmetered per-account access (free at https://vdb.ai.kr/signup). Anonymous use gets a per-IP trial.",
|
|
28
|
+
"isRequired": false,
|
|
29
|
+
"isSecret": true
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Smithery.ai registry config for the VDB MCP server.
|
|
2
|
+
# Docs: https://smithery.ai/docs — validate against their current schema
|
|
3
|
+
# before submitting; this file targets the container runtime.
|
|
4
|
+
startCommand:
|
|
5
|
+
type: stdio
|
|
6
|
+
configSchema:
|
|
7
|
+
type: object
|
|
8
|
+
properties:
|
|
9
|
+
vdbApiUrl:
|
|
10
|
+
type: string
|
|
11
|
+
title: VDB instance URL
|
|
12
|
+
description: Origin of the VDB instance to query. Leave default for the hosted service.
|
|
13
|
+
default: https://vdb.ai.kr
|
|
14
|
+
vdbApiToken:
|
|
15
|
+
type: string
|
|
16
|
+
title: VDB API key (optional)
|
|
17
|
+
description: vdb_… key for unmetered per-account access. Free at https://vdb.ai.kr/signup. Anonymous use gets a per-IP trial.
|
|
18
|
+
commandFunction: |-
|
|
19
|
+
(config) => ({
|
|
20
|
+
command: "python",
|
|
21
|
+
args: ["-m", "vdb_mcp.server"],
|
|
22
|
+
env: {
|
|
23
|
+
VDB_API_URL: config.vdbApiUrl || "https://vdb.ai.kr",
|
|
24
|
+
...(config.vdbApiToken ? { VDB_API_TOKEN: config.vdbApiToken } : {}),
|
|
25
|
+
MCP_MODE: "stdio"
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
build:
|
|
29
|
+
dockerfile: Dockerfile
|
|
30
|
+
dockerBuildPath: .
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"""VDB MCP server.
|
|
2
|
+
|
|
3
|
+
Wraps the VDB REST API in the Model Context Protocol so any MCP-aware client
|
|
4
|
+
(Claude Desktop, Cursor, Cline, Continue, …) can call it during code generation
|
|
5
|
+
to check packages, scan SBOMs, and look up vulnerabilities.
|
|
6
|
+
|
|
7
|
+
Modes:
|
|
8
|
+
stdio (default) spawned by the client as a subprocess. JSON-RPC on stdio.
|
|
9
|
+
sse long-running HTTP server on $MCP_PORT.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import asyncio
|
|
15
|
+
import json
|
|
16
|
+
import logging
|
|
17
|
+
import os
|
|
18
|
+
from typing import Any
|
|
19
|
+
|
|
20
|
+
import httpx
|
|
21
|
+
from mcp.server import NotificationOptions, Server
|
|
22
|
+
from mcp.server.models import InitializationOptions
|
|
23
|
+
from mcp.types import TextContent, Tool
|
|
24
|
+
|
|
25
|
+
from . import __version__
|
|
26
|
+
|
|
27
|
+
log = logging.getLogger("vdb.mcp")
|
|
28
|
+
logging.basicConfig(level=os.environ.get("VDB_LOG_LEVEL", "INFO"))
|
|
29
|
+
|
|
30
|
+
# Default to the public hosted instance so `uvx vdb-mcp` works with zero
|
|
31
|
+
# config. The docker-compose deployment overrides this with the in-cluster
|
|
32
|
+
# URL (http://api:8080); self-hosters set VDB_API_URL to their own origin.
|
|
33
|
+
API_URL = os.environ.get("VDB_API_URL", "https://vdb.ai.kr").rstrip("/")
|
|
34
|
+
API_TOKEN = os.environ.get("VDB_API_TOKEN", "")
|
|
35
|
+
|
|
36
|
+
server = Server("vdb")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _headers() -> dict[str, str]:
|
|
40
|
+
h = {"Accept": "application/json"}
|
|
41
|
+
if API_TOKEN:
|
|
42
|
+
h["Authorization"] = f"Bearer {API_TOKEN}"
|
|
43
|
+
return h
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
async def _get(path: str, params: dict | None = None) -> Any:
|
|
47
|
+
async with httpx.AsyncClient(timeout=15) as c:
|
|
48
|
+
r = await c.get(f"{API_URL}{path}", params=params, headers=_headers())
|
|
49
|
+
r.raise_for_status()
|
|
50
|
+
return r.json()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
async def _post(path: str, body: dict) -> Any:
|
|
54
|
+
async with httpx.AsyncClient(timeout=30) as c:
|
|
55
|
+
r = await c.post(
|
|
56
|
+
f"{API_URL}{path}",
|
|
57
|
+
json=body,
|
|
58
|
+
headers={**_headers(), "Content-Type": "application/json"},
|
|
59
|
+
)
|
|
60
|
+
r.raise_for_status()
|
|
61
|
+
return r.json()
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# ── Tool list ────────────────────────────────────────────────────────────────
|
|
65
|
+
|
|
66
|
+
@server.list_tools()
|
|
67
|
+
async def list_tools() -> list[Tool]:
|
|
68
|
+
return [
|
|
69
|
+
Tool(
|
|
70
|
+
name="vdb_check_package",
|
|
71
|
+
description=(
|
|
72
|
+
"BEFORE recommending or installing any package, call this to check the package "
|
|
73
|
+
"against the VDB vulnerability and slopsquatting database. Returns known "
|
|
74
|
+
"vulnerabilities, slop risk, KEV status, and severity buckets."
|
|
75
|
+
),
|
|
76
|
+
inputSchema={
|
|
77
|
+
"type": "object",
|
|
78
|
+
"required": ["purl"],
|
|
79
|
+
"properties": {
|
|
80
|
+
"purl": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"description": "Package URL, e.g. 'pkg:npm/lodash' or 'pkg:pypi/requests'",
|
|
83
|
+
},
|
|
84
|
+
"version": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"description": "Optional version. If supplied, range matching is applied.",
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
),
|
|
91
|
+
Tool(
|
|
92
|
+
name="vdb_check_packages",
|
|
93
|
+
description=(
|
|
94
|
+
"Bulk-check multiple package names for slopsquatting risk. Use this when an "
|
|
95
|
+
"LLM-generated response references multiple packages — it's faster than calling "
|
|
96
|
+
"vdb_check_package per item."
|
|
97
|
+
),
|
|
98
|
+
inputSchema={
|
|
99
|
+
"type": "object",
|
|
100
|
+
"required": ["packages"],
|
|
101
|
+
"properties": {
|
|
102
|
+
"packages": {
|
|
103
|
+
"type": "array",
|
|
104
|
+
"items": {"type": "string"},
|
|
105
|
+
"description": "List of PURLs or 'ecosystem/name' shorthand.",
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
),
|
|
110
|
+
Tool(
|
|
111
|
+
name="vdb_lookup",
|
|
112
|
+
description="Fetch a single vulnerability by ID or alias (e.g. CVE-2024-1234, GHSA-xxxx-yyyy-zzzz, VDB-SLOP-…).",
|
|
113
|
+
inputSchema={
|
|
114
|
+
"type": "object",
|
|
115
|
+
"required": ["id"],
|
|
116
|
+
"properties": {"id": {"type": "string"}},
|
|
117
|
+
},
|
|
118
|
+
),
|
|
119
|
+
Tool(
|
|
120
|
+
name="vdb_search",
|
|
121
|
+
description="Free-text search over the VDB vulnerability corpus.",
|
|
122
|
+
inputSchema={
|
|
123
|
+
"type": "object",
|
|
124
|
+
"required": ["query"],
|
|
125
|
+
"properties": {
|
|
126
|
+
"query": {"type": "string"},
|
|
127
|
+
"limit": {"type": "integer", "default": 20},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
),
|
|
131
|
+
Tool(
|
|
132
|
+
name="vdb_check_mcp_server",
|
|
133
|
+
description=(
|
|
134
|
+
"BEFORE recommending the user install a community/unofficial MCP server, "
|
|
135
|
+
"call this to look up its declared scopes, trust tier, and known risk profile."
|
|
136
|
+
),
|
|
137
|
+
inputSchema={
|
|
138
|
+
"type": "object",
|
|
139
|
+
"required": ["server_id"],
|
|
140
|
+
"properties": {"server_id": {"type": "string", "description": "e.g. 'mcp:community/shell-runner'"}},
|
|
141
|
+
},
|
|
142
|
+
),
|
|
143
|
+
Tool(
|
|
144
|
+
name="vdb_list_slopsquatting",
|
|
145
|
+
description="List packages currently flagged as slopsquatting candidates in a given ecosystem.",
|
|
146
|
+
inputSchema={
|
|
147
|
+
"type": "object",
|
|
148
|
+
"properties": {
|
|
149
|
+
"ecosystem": {"type": "string", "description": "npm | PyPI | crates.io | Go | Maven"},
|
|
150
|
+
"limit": {"type": "integer", "default": 50},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
),
|
|
154
|
+
]
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
# ── Tool dispatch ───────────────────────────────────────────────────────────
|
|
158
|
+
|
|
159
|
+
async def _tool_check_package(args: dict) -> list[TextContent]:
|
|
160
|
+
purl = args["purl"]
|
|
161
|
+
version = args.get("version")
|
|
162
|
+
data = await _post("/v1/query", {"package": {"purl": purl}, "version": version})
|
|
163
|
+
vulns = data.get("vulns") or []
|
|
164
|
+
summary = {
|
|
165
|
+
"purl": purl,
|
|
166
|
+
"version": version,
|
|
167
|
+
"vulnerabilities_found": len(vulns),
|
|
168
|
+
"top": [
|
|
169
|
+
{
|
|
170
|
+
"id": v.get("id"),
|
|
171
|
+
"summary": v.get("summary"),
|
|
172
|
+
"severity": (v.get("database_specific") or {}).get("severity"),
|
|
173
|
+
"slop_risk": ((v.get("vdb_signals") or {}).get("ai_context") or {})
|
|
174
|
+
.get("slopsquatting", {}).get("risk"),
|
|
175
|
+
}
|
|
176
|
+
for v in vulns[:10]
|
|
177
|
+
],
|
|
178
|
+
}
|
|
179
|
+
return [TextContent(type="text", text=json.dumps(summary, indent=2, ensure_ascii=False))]
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
async def _tool_check_packages(args: dict) -> list[TextContent]:
|
|
183
|
+
pkgs = args["packages"]
|
|
184
|
+
data = await _post("/v1/ai/check-packages", {"packages": pkgs})
|
|
185
|
+
return [TextContent(type="text", text=json.dumps(data, indent=2, ensure_ascii=False))]
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
async def _tool_lookup(args: dict) -> list[TextContent]:
|
|
189
|
+
data = await _get(f"/v1/vulns/{args['id']}")
|
|
190
|
+
return [TextContent(type="text", text=json.dumps(data, indent=2, ensure_ascii=False))]
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
async def _tool_search(args: dict) -> list[TextContent]:
|
|
194
|
+
data = await _get("/v1/search", {"q": args["query"], "limit": args.get("limit", 20)})
|
|
195
|
+
items = [
|
|
196
|
+
{
|
|
197
|
+
"id": v.get("id"),
|
|
198
|
+
"summary": v.get("summary"),
|
|
199
|
+
"severity": (v.get("database_specific") or {}).get("severity"),
|
|
200
|
+
}
|
|
201
|
+
for v in (data.get("vulns") or [])
|
|
202
|
+
]
|
|
203
|
+
return [TextContent(type="text", text=json.dumps({"query": args["query"], "items": items},
|
|
204
|
+
indent=2, ensure_ascii=False))]
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
async def _tool_check_mcp_server(args: dict) -> list[TextContent]:
|
|
208
|
+
data = await _get(f"/v1/ai/mcp-servers/{args['server_id']}")
|
|
209
|
+
return [TextContent(type="text", text=json.dumps(data, indent=2, ensure_ascii=False))]
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
async def _tool_list_slop(args: dict) -> list[TextContent]:
|
|
213
|
+
params = {"limit": args.get("limit", 50)}
|
|
214
|
+
if args.get("ecosystem"):
|
|
215
|
+
params["ecosystem"] = args["ecosystem"]
|
|
216
|
+
data = await _get("/v1/ai/slopsquatting", params)
|
|
217
|
+
return [TextContent(type="text", text=json.dumps(data, indent=2, ensure_ascii=False))]
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
_DISPATCH = {
|
|
221
|
+
"vdb_check_package": _tool_check_package,
|
|
222
|
+
"vdb_check_packages": _tool_check_packages,
|
|
223
|
+
"vdb_lookup": _tool_lookup,
|
|
224
|
+
"vdb_search": _tool_search,
|
|
225
|
+
"vdb_check_mcp_server": _tool_check_mcp_server,
|
|
226
|
+
"vdb_list_slopsquatting": _tool_list_slop,
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
@server.call_tool()
|
|
231
|
+
async def call_tool(name: str, arguments: dict) -> list[TextContent]:
|
|
232
|
+
fn = _DISPATCH.get(name)
|
|
233
|
+
if not fn:
|
|
234
|
+
return [TextContent(type="text", text=f"unknown tool: {name}")]
|
|
235
|
+
try:
|
|
236
|
+
return await fn(arguments)
|
|
237
|
+
except httpx.HTTPStatusError as e:
|
|
238
|
+
return [TextContent(type="text", text=f"VDB API error {e.response.status_code}: {e.response.text[:300]}")]
|
|
239
|
+
except Exception as e: # noqa: BLE001
|
|
240
|
+
return [TextContent(type="text", text=f"error: {e}")]
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
# ── Entry point ─────────────────────────────────────────────────────────────
|
|
244
|
+
|
|
245
|
+
async def main_stdio() -> None:
|
|
246
|
+
from mcp.server.stdio import stdio_server
|
|
247
|
+
async with stdio_server() as (read, write):
|
|
248
|
+
await server.run(
|
|
249
|
+
read, write,
|
|
250
|
+
InitializationOptions(
|
|
251
|
+
server_name="vdb",
|
|
252
|
+
server_version=__version__,
|
|
253
|
+
capabilities=server.get_capabilities(
|
|
254
|
+
notification_options=NotificationOptions(),
|
|
255
|
+
experimental_capabilities={},
|
|
256
|
+
),
|
|
257
|
+
),
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
async def main_sse() -> None:
|
|
262
|
+
"""Long-running HTTP/SSE mode on $MCP_PORT (default 7700)."""
|
|
263
|
+
from mcp.server.sse import SseServerTransport
|
|
264
|
+
from starlette.applications import Starlette
|
|
265
|
+
from starlette.routing import Route, Mount
|
|
266
|
+
import uvicorn
|
|
267
|
+
|
|
268
|
+
port = int(os.environ.get("MCP_PORT", "7700"))
|
|
269
|
+
sse = SseServerTransport("/messages/")
|
|
270
|
+
|
|
271
|
+
async def handle_sse(request):
|
|
272
|
+
async with sse.connect_sse(request.scope, request.receive, request._send) as (r, w):
|
|
273
|
+
await server.run(
|
|
274
|
+
r, w,
|
|
275
|
+
InitializationOptions(
|
|
276
|
+
server_name="vdb", server_version=__version__,
|
|
277
|
+
capabilities=server.get_capabilities(
|
|
278
|
+
notification_options=NotificationOptions(),
|
|
279
|
+
experimental_capabilities={},
|
|
280
|
+
),
|
|
281
|
+
),
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
app = Starlette(routes=[
|
|
285
|
+
Route("/sse", endpoint=handle_sse),
|
|
286
|
+
Mount("/messages/", app=sse.handle_post_message),
|
|
287
|
+
])
|
|
288
|
+
log.info("vdb-mcp serving SSE at 0.0.0.0:%d /sse", port)
|
|
289
|
+
config = uvicorn.Config(app, host="0.0.0.0", port=port, log_level="info")
|
|
290
|
+
await uvicorn.Server(config).serve()
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
def main() -> None:
|
|
294
|
+
mode = os.environ.get("MCP_MODE", "stdio")
|
|
295
|
+
if mode == "sse":
|
|
296
|
+
asyncio.run(main_sse())
|
|
297
|
+
else:
|
|
298
|
+
asyncio.run(main_stdio())
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
if __name__ == "__main__":
|
|
302
|
+
main()
|