xdr-mcp 1.0.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.
- xdr_mcp-1.0.0/.dockerignore +11 -0
- xdr_mcp-1.0.0/.github/workflows/ci.yml +89 -0
- xdr_mcp-1.0.0/.github/workflows/publish.yml +87 -0
- xdr_mcp-1.0.0/.gitignore +9 -0
- xdr_mcp-1.0.0/CONTRIBUTING.md +101 -0
- xdr_mcp-1.0.0/Dockerfile +29 -0
- xdr_mcp-1.0.0/LICENSE +202 -0
- xdr_mcp-1.0.0/NOTICE +5 -0
- xdr_mcp-1.0.0/PKG-INFO +136 -0
- xdr_mcp-1.0.0/README.en.md +111 -0
- xdr_mcp-1.0.0/README.md +111 -0
- xdr_mcp-1.0.0/SECURITY.md +59 -0
- xdr_mcp-1.0.0/pyproject.toml +63 -0
- xdr_mcp-1.0.0/requirements.lock +573 -0
- xdr_mcp-1.0.0/src/xdr_mcp/__init__.py +8 -0
- xdr_mcp-1.0.0/src/xdr_mcp/__main__.py +9 -0
- xdr_mcp-1.0.0/src/xdr_mcp/server.py +579 -0
- xdr_mcp-1.0.0/tests/test_server.py +564 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
|
|
25
|
+
# Hash-pinned: the server holds a live XDR token, so a substituted
|
|
26
|
+
# dependency is a credential compromise, not just a broken build.
|
|
27
|
+
- name: Install locked dependencies
|
|
28
|
+
run: pip install --require-hashes -r requirements.lock
|
|
29
|
+
|
|
30
|
+
- name: Install the package without touching the locked tree
|
|
31
|
+
run: pip install --no-deps -e .
|
|
32
|
+
|
|
33
|
+
- name: Run tests
|
|
34
|
+
run: python -m unittest discover -s tests -v
|
|
35
|
+
|
|
36
|
+
- name: Check the server starts and lists its tools
|
|
37
|
+
env:
|
|
38
|
+
XDR_BASE_URL: https://xdr.example.com
|
|
39
|
+
XDR_API_KEY: ci-placeholder
|
|
40
|
+
run: |
|
|
41
|
+
printf '%s\n' \
|
|
42
|
+
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"ci","version":"0"}}}' \
|
|
43
|
+
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
|
|
44
|
+
'{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
|
|
45
|
+
| timeout 30 xdr-mcp > handshake.json
|
|
46
|
+
python - <<'PY'
|
|
47
|
+
import json
|
|
48
|
+
tools = None
|
|
49
|
+
for line in open("handshake.json"):
|
|
50
|
+
line = line.strip()
|
|
51
|
+
if not line:
|
|
52
|
+
continue
|
|
53
|
+
message = json.loads(line)
|
|
54
|
+
if message.get("id") == 2:
|
|
55
|
+
tools = [t["name"] for t in message["result"]["tools"]]
|
|
56
|
+
assert tools is not None, "no tools/list response"
|
|
57
|
+
# xdr_mark_event must stay hidden unless XDR_ALLOW_WRITE is set.
|
|
58
|
+
assert "xdr_mark_event" not in tools, tools
|
|
59
|
+
assert len(tools) == 5, tools
|
|
60
|
+
print("handshake OK:", tools)
|
|
61
|
+
PY
|
|
62
|
+
|
|
63
|
+
lint:
|
|
64
|
+
runs-on: ubuntu-latest
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v4
|
|
67
|
+
|
|
68
|
+
- uses: actions/setup-python@v5
|
|
69
|
+
with:
|
|
70
|
+
python-version: "3.12"
|
|
71
|
+
|
|
72
|
+
- run: pip install ruff==0.14.2
|
|
73
|
+
|
|
74
|
+
# Lint only. The formatter is deliberately not enforced: adopting it would
|
|
75
|
+
# reformat every file and bury real changes in style noise.
|
|
76
|
+
- run: ruff check .
|
|
77
|
+
|
|
78
|
+
lock:
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
steps:
|
|
81
|
+
- uses: actions/checkout@v4
|
|
82
|
+
|
|
83
|
+
- uses: astral-sh/setup-uv@v5
|
|
84
|
+
|
|
85
|
+
# Fails if pyproject.toml and requirements.lock have drifted apart.
|
|
86
|
+
- name: Verify the lock is current
|
|
87
|
+
run: |
|
|
88
|
+
uv pip compile pyproject.toml --universal --generate-hashes -o /tmp/check.lock --quiet
|
|
89
|
+
diff -u requirements.lock /tmp/check.lock
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
environment: pypi
|
|
14
|
+
permissions:
|
|
15
|
+
# A job-level permissions block replaces the workflow-level one rather than
|
|
16
|
+
# extending it, so checkout's contents: read has to be repeated here.
|
|
17
|
+
contents: read
|
|
18
|
+
# PyPI trusted publishing — no long-lived API token in repository secrets.
|
|
19
|
+
id-token: write
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: "3.12"
|
|
26
|
+
|
|
27
|
+
- run: pip install build==1.3.0
|
|
28
|
+
|
|
29
|
+
- run: python -m build
|
|
30
|
+
|
|
31
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
32
|
+
with:
|
|
33
|
+
# a version published by hand earlier must not fail the release
|
|
34
|
+
skip-existing: true
|
|
35
|
+
|
|
36
|
+
# Deliberately not "needs: publish": the image must still be built when the
|
|
37
|
+
# PyPI job is skipped or fails, for instance for a version published by hand.
|
|
38
|
+
container:
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
permissions:
|
|
41
|
+
contents: read
|
|
42
|
+
packages: write
|
|
43
|
+
# for the build provenance attestation
|
|
44
|
+
id-token: write
|
|
45
|
+
attestations: write
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v4
|
|
48
|
+
|
|
49
|
+
# GHCR rejects an uppercase image name and the owner is F6-Security.
|
|
50
|
+
- name: Resolve the image name
|
|
51
|
+
run: echo "IMAGE=ghcr.io/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
|
|
52
|
+
|
|
53
|
+
- uses: docker/setup-qemu-action@v3
|
|
54
|
+
- uses: docker/setup-buildx-action@v3
|
|
55
|
+
|
|
56
|
+
- uses: docker/login-action@v3
|
|
57
|
+
with:
|
|
58
|
+
registry: ghcr.io
|
|
59
|
+
username: ${{ github.actor }}
|
|
60
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
61
|
+
|
|
62
|
+
- id: meta
|
|
63
|
+
uses: docker/metadata-action@v5
|
|
64
|
+
with:
|
|
65
|
+
images: ${{ env.IMAGE }}
|
|
66
|
+
tags: |
|
|
67
|
+
type=semver,pattern={{version}}
|
|
68
|
+
type=semver,pattern={{major}}.{{minor}}
|
|
69
|
+
type=raw,value=latest
|
|
70
|
+
|
|
71
|
+
- id: build
|
|
72
|
+
uses: docker/build-push-action@v6
|
|
73
|
+
with:
|
|
74
|
+
context: .
|
|
75
|
+
# arm64 included so Apple Silicon does not fall back to emulation
|
|
76
|
+
platforms: linux/amd64,linux/arm64
|
|
77
|
+
push: true
|
|
78
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
79
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
80
|
+
sbom: true
|
|
81
|
+
provenance: mode=max
|
|
82
|
+
|
|
83
|
+
- uses: actions/attest-build-provenance@v2
|
|
84
|
+
with:
|
|
85
|
+
subject-name: ${{ env.IMAGE }}
|
|
86
|
+
subject-digest: ${{ steps.build.outputs.digest }}
|
|
87
|
+
push-to-registry: true
|
xdr_mcp-1.0.0/.gitignore
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Участие в разработке
|
|
2
|
+
|
|
3
|
+
## Окружение
|
|
4
|
+
|
|
5
|
+
Нужен Python 3.10+.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
python3 -m venv venv
|
|
9
|
+
./venv/bin/pip install --require-hashes -r requirements.lock
|
|
10
|
+
./venv/bin/pip install --no-deps -e .
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Зависимости ставятся из лока с проверкой хешей: сервер держит живой API-токен,
|
|
14
|
+
поэтому подменённая зависимость здесь — это компрометация доступа, а не просто
|
|
15
|
+
сломанная сборка.
|
|
16
|
+
|
|
17
|
+
## Тесты и линт
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
./venv/bin/python -m unittest discover -s tests -v
|
|
21
|
+
./venv/bin/ruff check .
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Тесты не требуют сети и работают на stdlib `unittest`. Форматтер `ruff format`
|
|
25
|
+
намеренно не включён в CI.
|
|
26
|
+
|
|
27
|
+
## Зависимости
|
|
28
|
+
|
|
29
|
+
Версии задаются в `pyproject.toml`, `requirements.lock` из них генерируется.
|
|
30
|
+
После правки зависимостей лок нужно пересобрать, иначе CI это заметит:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
uv pip compile pyproject.toml --universal --generate-hashes -o requirements.lock
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Флаг `--universal` обязателен — лок должен ставиться на всех поддерживаемых
|
|
37
|
+
платформах и версиях Python, а не только на машине, где он собран.
|
|
38
|
+
|
|
39
|
+
## Контейнер
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
docker build -t xdr-mcp .
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Образ публикуется под `linux/amd64` и `linux/arm64`.
|
|
46
|
+
|
|
47
|
+
## Проверить сервер вручную
|
|
48
|
+
|
|
49
|
+
Сервер общается по stdio, поэтому его можно подёргать напрямую:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
printf '%s\n' \
|
|
53
|
+
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"probe","version":"0"}}}' \
|
|
54
|
+
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
|
|
55
|
+
'{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
|
|
56
|
+
| XDR_BASE_URL=https://xdr.f6.security XDR_API_KEY=<token> xdr-mcp
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Добавление секции или тула
|
|
60
|
+
|
|
61
|
+
Секции описаны словарём `SECTIONS` в `src/xdr_mcp/server.py`: базовый путь, путь
|
|
62
|
+
для `count`, поля сортировки, способ пагинации. Описания параметров генерируются
|
|
63
|
+
из этого словаря, чтобы документация не расходилась с кодом.
|
|
64
|
+
|
|
65
|
+
Имена полей и допустимые значения проверяйте по `xdr_get_mapping` и
|
|
66
|
+
`xdr_get_filters` на живой инсталляции. API не отвергает несуществующее поле или
|
|
67
|
+
значение — он отвечает пустым результатом, неотличимым от «ничего не найдено»,
|
|
68
|
+
поэтому ошибка в описании тула превращается в тихо неверный ответ модели.
|
|
69
|
+
|
|
70
|
+
## Документация
|
|
71
|
+
|
|
72
|
+
`README.md` (русский) и `README.en.md` — одно и то же содержимое на двух языках,
|
|
73
|
+
разделы совпадают один в один. Правку нужно вносить в оба файла. На PyPI уходит
|
|
74
|
+
русская версия: она указана в `readme` в `pyproject.toml`.
|
|
75
|
+
|
|
76
|
+
Оба файла публикуются и на GitHub, и на PyPI, поэтому:
|
|
77
|
+
|
|
78
|
+
- все ссылки абсолютные — PyPI не резолвит относительные пути;
|
|
79
|
+
- картинки только по абсолютному URL и только PNG или JPEG — SVG PyPI не покажет;
|
|
80
|
+
- без разметки, специфичной для GitHub (`> [!NOTE]`, `<picture>`) — санитайзер
|
|
81
|
+
PyPI её вырежет.
|
|
82
|
+
|
|
83
|
+
Проверить, как страницу отрисует PyPI:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
./venv/bin/python -m build && ./venv/bin/twine check dist/*
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Логотип: `docs/logo.svg` — исходный знак с сайта, `docs/logo-banner.svg` — версия
|
|
90
|
+
для шапки, белый знак на фирменном тёмном, чтобы читаться и в светлой, и в тёмной
|
|
91
|
+
теме. `docs/logo.png` генерируется из баннера:
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
rsvg-convert -w 880 -h 264 docs/logo-banner.svg -o docs/logo.png
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Релиз
|
|
98
|
+
|
|
99
|
+
Версия задаётся в `src/xdr_mcp/__init__.py` и оттуда попадает в метаданные
|
|
100
|
+
пакета, версию MCP-сервера и User-Agent. Публикация на PyPI и в GHCR происходит
|
|
101
|
+
по факту публикации GitHub Release.
|
xdr_mcp-1.0.0/Dockerfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Build the wheel separately so the runtime image carries no build toolchain.
|
|
2
|
+
FROM python:3.12-slim AS build
|
|
3
|
+
|
|
4
|
+
WORKDIR /build
|
|
5
|
+
RUN pip install --no-cache-dir build==1.3.0
|
|
6
|
+
|
|
7
|
+
COPY pyproject.toml README.md LICENSE NOTICE ./
|
|
8
|
+
COPY src ./src
|
|
9
|
+
RUN python -m build --wheel --outdir /dist
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
FROM python:3.12-slim
|
|
13
|
+
|
|
14
|
+
# Dependencies come from the hash-pinned lock, the package itself without
|
|
15
|
+
# resolving anything further, so the image matches what CI tested.
|
|
16
|
+
COPY requirements.lock /tmp/requirements.lock
|
|
17
|
+
RUN pip install --no-cache-dir --require-hashes -r /tmp/requirements.lock \
|
|
18
|
+
&& rm /tmp/requirements.lock
|
|
19
|
+
|
|
20
|
+
COPY --from=build /dist/*.whl /tmp/
|
|
21
|
+
RUN pip install --no-cache-dir --no-deps /tmp/*.whl && rm /tmp/*.whl
|
|
22
|
+
|
|
23
|
+
# The process holds a live XDR token; it has no reason to run as root.
|
|
24
|
+
RUN useradd --create-home --uid 10001 xdr
|
|
25
|
+
USER xdr
|
|
26
|
+
|
|
27
|
+
# stdio transport: the MCP client talks to this process over stdin/stdout,
|
|
28
|
+
# so the container must be run with -i and must print nothing else to stdout.
|
|
29
|
+
ENTRYPOINT ["xdr-mcp"]
|
xdr_mcp-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
xdr_mcp-1.0.0/NOTICE
ADDED
xdr_mcp-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: xdr-mcp
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: MCP server for the F6 XDR platform API
|
|
5
|
+
Project-URL: Homepage, https://github.com/F6-Security/xdr-mcp
|
|
6
|
+
Project-URL: Issues, https://github.com/F6-Security/xdr-mcp/issues
|
|
7
|
+
Author-email: Future Joint-Stock Company <mxdr@f6.ru>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: NOTICE
|
|
11
|
+
Keywords: mcp,model-context-protocol,security,xdr
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Information Technology
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Security
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: httpx==0.28.1
|
|
22
|
+
Requires-Dist: mcp-types==2.0.0
|
|
23
|
+
Requires-Dist: mcp==2.0.0
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
<p align="center">
|
|
27
|
+
<img src="https://raw.githubusercontent.com/F6-Security/xdr-mcp/HEAD/docs/logo.png" alt="F6" width="220">
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
# F6 XDR MCP Server
|
|
31
|
+
|
|
32
|
+
<p align="right"><a href="https://github.com/F6-Security/xdr-mcp/blob/HEAD/README.en.md">English</a></p>
|
|
33
|
+
|
|
34
|
+
[](https://pypi.org/project/xdr-mcp/)
|
|
35
|
+
[](https://pypi.org/project/xdr-mcp/)
|
|
36
|
+
[](https://github.com/F6-Security/xdr-mcp/blob/HEAD/LICENSE)
|
|
37
|
+
[](https://github.com/F6-Security/xdr-mcp/actions/workflows/ci.yml)
|
|
38
|
+
|
|
39
|
+
MCP-сервер к платформе [F6 XDR](https://f6.security). Даёт ИИ-ассистенту доступ к
|
|
40
|
+
алертам, инцидентам, письмам, файлам, хостам и журналу — поиском на языке запросов
|
|
41
|
+
платформы.
|
|
42
|
+
|
|
43
|
+
## Тулы
|
|
44
|
+
|
|
45
|
+
| Тул | Назначение |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `xdr_search` | Поиск по секции с фильтром |
|
|
48
|
+
| `xdr_list` | Список записей без фильтра |
|
|
49
|
+
| `xdr_count` | Количество записей |
|
|
50
|
+
| `xdr_get_mapping` | Доступные поля поиска |
|
|
51
|
+
| `xdr_get_filters` | Доступные значения фильтров |
|
|
52
|
+
| `xdr_mark_event` | Пометить объект: закрыть алерт, отметить ложное срабатывание |
|
|
53
|
+
|
|
54
|
+
Секции: `alerts`, `incidents`, `emails`, `files`, `events`, `connections`, `assets`,
|
|
55
|
+
`modules`, `audit`, `applications`.
|
|
56
|
+
|
|
57
|
+
Первые пять тулов только читают. `xdr_mark_event` изменяет данные и по умолчанию
|
|
58
|
+
выключен, см. раздел «Безопасность».
|
|
59
|
+
|
|
60
|
+
## Быстрый старт
|
|
61
|
+
|
|
62
|
+
Нужен Python 3.10+ и персональный API-токен пользователя XDR.
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"mcpServers": {
|
|
67
|
+
"xdr": {
|
|
68
|
+
"command": "uvx",
|
|
69
|
+
"args": ["xdr-mcp"],
|
|
70
|
+
"env": {
|
|
71
|
+
"XDR_BASE_URL": "https://xdr.f6.security",
|
|
72
|
+
"XDR_API_KEY": "<token>"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Этот блок подходит для Claude Desktop, Cursor и VS Code. Для Claude Code:
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
claude mcp add xdr \
|
|
83
|
+
-e XDR_BASE_URL=https://xdr.f6.security -e XDR_API_KEY=<token> \
|
|
84
|
+
-- uvx xdr-mcp
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Вместо `uvx` можно использовать `pip install xdr-mcp` и команду `xdr-mcp`, либо
|
|
88
|
+
контейнер — `docker run -i --rm -e XDR_BASE_URL -e XDR_API_KEY ghcr.io/f6-security/xdr-mcp`
|
|
89
|
+
(образ собран под `linux/amd64` и `linux/arm64`).
|
|
90
|
+
|
|
91
|
+
## Переменные окружения
|
|
92
|
+
|
|
93
|
+
| Переменная | Назначение |
|
|
94
|
+
| --- | --- |
|
|
95
|
+
| `XDR_BASE_URL` | Адрес инсталляции. Для облака — `https://xdr.f6.security` |
|
|
96
|
+
| `XDR_API_KEY` | Персональный API-токен пользователя |
|
|
97
|
+
| `XDR_ALLOW_WRITE` | `1` включает `xdr_mark_event`. По умолчанию выключен |
|
|
98
|
+
| `XDR_CA_BUNDLE` | PEM-бандл для инсталляции за внутренним УЦ |
|
|
99
|
+
|
|
100
|
+
## Примеры запросов
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
alerts severity : "critical" AND resolved : "false"
|
|
104
|
+
alerts timestamp >= now-1d AND NOT false_positive : "true"
|
|
105
|
+
incidents closed : "false" AND timestamp >= now-30d
|
|
106
|
+
emails is_blocked : "true" AND timestamp >= now-1d
|
|
107
|
+
assets edr_active : "true"
|
|
108
|
+
applications vendor : "Microsoft Corporation"
|
|
109
|
+
audit success : "false" AND timestamp >= now-7d
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Условия объединяются через `AND`, `OR`, `NOT` и группируются скобками. Время —
|
|
113
|
+
поле `timestamp`, относительное (`now-1d`, `now-6h`) или абсолютное. Какие поля
|
|
114
|
+
доступны в секции, покажет `xdr_get_mapping`.
|
|
115
|
+
|
|
116
|
+
## Безопасность
|
|
117
|
+
|
|
118
|
+
Всё, что возвращают читающие тулы, попадает в контекст языковой модели: адреса и
|
|
119
|
+
темы писем, имена файлов, хосты, журнал действий. Выдавайте серверу токен с
|
|
120
|
+
минимально необходимыми правами.
|
|
121
|
+
|
|
122
|
+
`xdr_mark_event` создаёт матчер — правило, которое применяется ко всем объектам,
|
|
123
|
+
подходящим под выражение, и этим тулом не отменяется. Поэтому тул выключен по
|
|
124
|
+
умолчанию; включайте `XDR_ALLOW_WRITE` осознанно и не добавляйте его в
|
|
125
|
+
авто-подтверждение MCP-клиента.
|
|
126
|
+
|
|
127
|
+
Модель угроз и порядок сообщения об уязвимостях —
|
|
128
|
+
[SECURITY.md](https://github.com/F6-Security/xdr-mcp/blob/HEAD/SECURITY.md).
|
|
129
|
+
|
|
130
|
+
## Участие в разработке
|
|
131
|
+
|
|
132
|
+
См. [CONTRIBUTING.md](https://github.com/F6-Security/xdr-mcp/blob/HEAD/CONTRIBUTING.md).
|
|
133
|
+
|
|
134
|
+
## Лицензия
|
|
135
|
+
|
|
136
|
+
[Apache License 2.0](https://github.com/F6-Security/xdr-mcp/blob/HEAD/LICENSE)
|