netbox-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.
- netbox_mcp-0.1.0/.dockerignore +33 -0
- netbox_mcp-0.1.0/.env.example +84 -0
- netbox_mcp-0.1.0/.github/dependabot.yml +19 -0
- netbox_mcp-0.1.0/.github/workflows/pre-commit.yml +27 -0
- netbox_mcp-0.1.0/.github/workflows/publish.yml +118 -0
- netbox_mcp-0.1.0/.github/workflows/release.yml +36 -0
- netbox_mcp-0.1.0/.gitignore +238 -0
- netbox_mcp-0.1.0/.mcp.json +11 -0
- netbox_mcp-0.1.0/.pre-commit-config.yaml +78 -0
- netbox_mcp-0.1.0/CHANGELOG.md +5 -0
- netbox_mcp-0.1.0/Dockerfile +56 -0
- netbox_mcp-0.1.0/LICENSE +21 -0
- netbox_mcp-0.1.0/MANIFEST.in +3 -0
- netbox_mcp-0.1.0/PKG-INFO +567 -0
- netbox_mcp-0.1.0/README.md +514 -0
- netbox_mcp-0.1.0/fastmcp.json +18 -0
- netbox_mcp-0.1.0/pyproject.toml +151 -0
- netbox_mcp-0.1.0/server.json +440 -0
- netbox_mcp-0.1.0/src/netbox_mcp/__init__.py +5 -0
- netbox_mcp-0.1.0/src/netbox_mcp/filters.py +112 -0
- netbox_mcp-0.1.0/src/netbox_mcp/models.py +105 -0
- netbox_mcp-0.1.0/src/netbox_mcp/netbox_client.py +495 -0
- netbox_mcp-0.1.0/src/netbox_mcp/object_types.py +249 -0
- netbox_mcp-0.1.0/src/netbox_mcp/retry.py +164 -0
- netbox_mcp-0.1.0/src/netbox_mcp/sentry_init.py +92 -0
- netbox_mcp-0.1.0/src/netbox_mcp/server.py +269 -0
- netbox_mcp-0.1.0/src/netbox_mcp/tools/__init__.py +29 -0
- netbox_mcp-0.1.0/src/netbox_mcp/tools/branching.py +127 -0
- netbox_mcp-0.1.0/src/netbox_mcp/tools/common.py +249 -0
- netbox_mcp-0.1.0/src/netbox_mcp/tools/errors.py +71 -0
- netbox_mcp-0.1.0/src/netbox_mcp/tools/extras.py +332 -0
- netbox_mcp-0.1.0/src/netbox_mcp/tools/objects.py +416 -0
- netbox_mcp-0.1.0/src/netbox_mcp/tools/writes.py +376 -0
- netbox_mcp-0.1.0/src/netbox_mcp/utils.py +24 -0
- netbox_mcp-0.1.0/tests/__init__.py +3 -0
- netbox_mcp-0.1.0/tests/conftest.py +115 -0
- netbox_mcp-0.1.0/tests/test_client.py +240 -0
- netbox_mcp-0.1.0/tests/test_dry_run.py +118 -0
- netbox_mcp-0.1.0/tests/test_filters.py +48 -0
- netbox_mcp-0.1.0/tests/test_object_types.py +70 -0
- netbox_mcp-0.1.0/tests/test_settings_documented.py +35 -0
- netbox_mcp-0.1.0/tests/test_tools.py +381 -0
- netbox_mcp-0.1.0/tests/test_utils.py +32 -0
- netbox_mcp-0.1.0/uv.lock +2171 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Docker ignore file to reduce build context size
|
|
2
|
+
**/__pycache__/
|
|
3
|
+
*.pyc
|
|
4
|
+
*.pyo
|
|
5
|
+
*.pyd
|
|
6
|
+
.Python
|
|
7
|
+
*.so
|
|
8
|
+
.git
|
|
9
|
+
.gitignore
|
|
10
|
+
.github
|
|
11
|
+
.vscode
|
|
12
|
+
.idea
|
|
13
|
+
*.md
|
|
14
|
+
!README.md
|
|
15
|
+
.env
|
|
16
|
+
.env.*
|
|
17
|
+
!.env.example
|
|
18
|
+
*.log
|
|
19
|
+
.coverage
|
|
20
|
+
.pytest_cache
|
|
21
|
+
.mypy_cache
|
|
22
|
+
dist/
|
|
23
|
+
build/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
screenshots/
|
|
26
|
+
docker-compose.yml
|
|
27
|
+
Dockerfile*
|
|
28
|
+
*.tar
|
|
29
|
+
*.zip
|
|
30
|
+
.venv/
|
|
31
|
+
venv/
|
|
32
|
+
.ruff_cache/
|
|
33
|
+
.mcpregistry_*
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# NetBox MCP Server Environment Configuration
|
|
2
|
+
|
|
3
|
+
# NetBox Connection Details
|
|
4
|
+
NETBOX_URL=https://netbox.example.com
|
|
5
|
+
|
|
6
|
+
# API Token - v2 tokens (nbt_<key>.<token>, NetBox 4.5+) are sent as "Bearer",
|
|
7
|
+
# legacy v1 tokens as "Token"
|
|
8
|
+
NETBOX_TOKEN=nbt_your-key.your-token
|
|
9
|
+
|
|
10
|
+
# SSL Configuration
|
|
11
|
+
NETBOX_VERIFY_SSL=true
|
|
12
|
+
# Total time allowed for one NetBox request, retries included (seconds)
|
|
13
|
+
NETBOX_TIMEOUT=30
|
|
14
|
+
|
|
15
|
+
# Branching (requires the netbox-branching plugin)
|
|
16
|
+
# Set NETBOX_BRANCHING_ENABLED true to add the branch tools and the 'branch'
|
|
17
|
+
# argument to every tool. Off by default - leave it off on a NetBox without the plugin
|
|
18
|
+
NETBOX_BRANCHING_ENABLED=false
|
|
19
|
+
# Default branch (name or schema ID) used by every call; empty = main.
|
|
20
|
+
# Requires NETBOX_BRANCHING_ENABLED=true
|
|
21
|
+
NETBOX_BRANCH=
|
|
22
|
+
|
|
23
|
+
# Plugin Discovery
|
|
24
|
+
# Set NETBOX_PLUGIN_DISCOVERY true to expose plugin models (e.g. netbox_dns.zone)
|
|
25
|
+
NETBOX_PLUGIN_DISCOVERY=false
|
|
26
|
+
|
|
27
|
+
# Read-Only Mode
|
|
28
|
+
# Set READ_ONLY_MODE true to hide all write tools (create, update, delete)
|
|
29
|
+
READ_ONLY_MODE=false
|
|
30
|
+
|
|
31
|
+
# Dry-Run Mode
|
|
32
|
+
# Set DRY_RUN_MODE true to make every write tool only simulate the change:
|
|
33
|
+
# it returns the request it would send and never modifies NetBox
|
|
34
|
+
DRY_RUN_MODE=false
|
|
35
|
+
|
|
36
|
+
# Disabled Tags
|
|
37
|
+
# Comma-separated list of tags to disable tools for (empty by default)
|
|
38
|
+
# Example: DISABLED_TAGS=delete,graphql,branching
|
|
39
|
+
DISABLED_TAGS=
|
|
40
|
+
|
|
41
|
+
# Logging Configuration
|
|
42
|
+
LOG_LEVEL=INFO
|
|
43
|
+
|
|
44
|
+
# Response Size Limit
|
|
45
|
+
# Maximum tool response size in bytes; larger responses are truncated (empty = unlimited)
|
|
46
|
+
RESPONSE_MAX_SIZE=
|
|
47
|
+
|
|
48
|
+
# Rate Limiting
|
|
49
|
+
# Set RATE_LIMIT_ENABLED true to enable rate limiting
|
|
50
|
+
RATE_LIMIT_ENABLED=false
|
|
51
|
+
RATE_LIMIT_MAX_REQUESTS=60
|
|
52
|
+
RATE_LIMIT_WINDOW_MINUTES=1
|
|
53
|
+
|
|
54
|
+
# Tool Search Transform (Optional)
|
|
55
|
+
# Set TOOL_SEARCH_ENABLED true to replace full tool listings with search_tools + call_tool
|
|
56
|
+
TOOL_SEARCH_ENABLED=false
|
|
57
|
+
# Search strategy: bm25 (natural language) or regex (pattern match)
|
|
58
|
+
TOOL_SEARCH_STRATEGY=bm25
|
|
59
|
+
# Maximum number of tools returned by search_tools
|
|
60
|
+
TOOL_SEARCH_MAX_RESULTS=5
|
|
61
|
+
|
|
62
|
+
# Sentry Error Tracking (Optional)
|
|
63
|
+
# Set SENTRY_DSN to enable error tracking and performance monitoring
|
|
64
|
+
# SENTRY_DSN=https://your-key@o12345.ingest.us.sentry.io/6789
|
|
65
|
+
# Optional Sentry configuration
|
|
66
|
+
# SENTRY_TRACES_SAMPLE_RATE=1.0
|
|
67
|
+
# SENTRY_SEND_DEFAULT_PII=true
|
|
68
|
+
# SENTRY_ENVIRONMENT=production
|
|
69
|
+
# SENTRY_RELEASE=1.2.3
|
|
70
|
+
# SENTRY_PROFILE_SESSION_SAMPLE_RATE=1.0
|
|
71
|
+
# SENTRY_PROFILE_LIFECYCLE=trace
|
|
72
|
+
# SENTRY_ENABLE_LOGS=true
|
|
73
|
+
|
|
74
|
+
# MCP Transport Configuration
|
|
75
|
+
# Transport type: 'stdio' (default), 'sse' (Server-Sent Events), or 'http' (HTTP Streamable)
|
|
76
|
+
# MCP_TRANSPORT=stdio
|
|
77
|
+
|
|
78
|
+
# HTTP Transport Settings (used when MCP_TRANSPORT=sse or MCP_TRANSPORT=http)
|
|
79
|
+
# Host to bind the HTTP server (default: 127.0.0.1)
|
|
80
|
+
# MCP_HTTP_HOST=127.0.0.1
|
|
81
|
+
# Port to bind the HTTP server (default: 8000)
|
|
82
|
+
# MCP_HTTP_PORT=8000
|
|
83
|
+
# Optional bearer token for authentication (leave empty for no auth)
|
|
84
|
+
# MCP_HTTP_BEARER_TOKEN=
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "github-actions"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "daily"
|
|
7
|
+
groups:
|
|
8
|
+
github-actions:
|
|
9
|
+
patterns:
|
|
10
|
+
- "*"
|
|
11
|
+
- package-ecosystem: "uv"
|
|
12
|
+
directory: "/"
|
|
13
|
+
schedule:
|
|
14
|
+
interval: "daily"
|
|
15
|
+
groups:
|
|
16
|
+
uv-dependencies:
|
|
17
|
+
dependency-type: "production"
|
|
18
|
+
uv-dev-dependencies:
|
|
19
|
+
dependency-type: "development"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Pre-commit Checks
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
prek:
|
|
15
|
+
name: Run prek
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
|
+
|
|
21
|
+
- name: Install the latest version of uv and set the python version
|
|
22
|
+
uses: astral-sh/setup-uv@v7
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.14"
|
|
25
|
+
|
|
26
|
+
- name: Run prek
|
|
27
|
+
uses: j178/prek-action@v2
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
tags:
|
|
7
|
+
- "v*.*.*"
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
REGISTRY: ghcr.io
|
|
11
|
+
IMAGE_NAME: ${{ github.repository }}
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
publish-docker:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
packages: write
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout repository
|
|
22
|
+
uses: actions/checkout@v7
|
|
23
|
+
|
|
24
|
+
- name: Set up QEMU
|
|
25
|
+
uses: docker/setup-qemu-action@v4
|
|
26
|
+
|
|
27
|
+
- name: Set up Docker Buildx
|
|
28
|
+
uses: docker/setup-buildx-action@v4
|
|
29
|
+
|
|
30
|
+
- name: Log in to GitHub Container Registry
|
|
31
|
+
if: github.event_name != 'pull_request'
|
|
32
|
+
uses: docker/login-action@v4
|
|
33
|
+
with:
|
|
34
|
+
registry: ${{ env.REGISTRY }}
|
|
35
|
+
username: ${{ github.actor }}
|
|
36
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
37
|
+
|
|
38
|
+
- name: Extract metadata for Docker
|
|
39
|
+
id: meta
|
|
40
|
+
uses: docker/metadata-action@v6
|
|
41
|
+
with:
|
|
42
|
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
43
|
+
tags: |
|
|
44
|
+
# Set latest tag for main branch
|
|
45
|
+
type=raw,value=latest,enable={{is_default_branch}}
|
|
46
|
+
# Tag with branch name (e.g., main, develop)
|
|
47
|
+
type=ref,event=branch
|
|
48
|
+
# Tag with PR number (e.g., pr-2)
|
|
49
|
+
type=ref,event=pr
|
|
50
|
+
# Tag with semver - v1.2.3 -> 1.2.3
|
|
51
|
+
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
52
|
+
# Tag with major.minor - v1.2.3 -> 1.2
|
|
53
|
+
type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
54
|
+
# Tag with major - v1.2.3 -> 1
|
|
55
|
+
type=semver,pattern={{major}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
56
|
+
# Tag with git sha
|
|
57
|
+
type=sha,format=short
|
|
58
|
+
|
|
59
|
+
- name: Build and push Docker image
|
|
60
|
+
uses: docker/build-push-action@v7
|
|
61
|
+
with:
|
|
62
|
+
context: .
|
|
63
|
+
platforms: linux/amd64,linux/arm64
|
|
64
|
+
push: ${{ github.event_name != 'pull_request' }}
|
|
65
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
66
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
67
|
+
cache-from: type=gha
|
|
68
|
+
cache-to: type=gha,mode=max
|
|
69
|
+
|
|
70
|
+
publish-pypi:
|
|
71
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
72
|
+
runs-on: ubuntu-latest
|
|
73
|
+
environment:
|
|
74
|
+
name: pypi
|
|
75
|
+
url: https://pypi.org/p/netbox-mcp
|
|
76
|
+
permissions:
|
|
77
|
+
id-token: write # Mandatory for Trusted Publishing
|
|
78
|
+
|
|
79
|
+
steps:
|
|
80
|
+
- name: Checkout code
|
|
81
|
+
uses: actions/checkout@v7
|
|
82
|
+
|
|
83
|
+
- name: Install the latest version of uv and set the python version
|
|
84
|
+
uses: astral-sh/setup-uv@v7
|
|
85
|
+
with:
|
|
86
|
+
python-version: "3.14"
|
|
87
|
+
|
|
88
|
+
- name: Install dependencies
|
|
89
|
+
run: uv sync --locked --all-extras --no-dev
|
|
90
|
+
|
|
91
|
+
- name: Build package
|
|
92
|
+
run: uv build
|
|
93
|
+
|
|
94
|
+
- name: Publish package distributions to PyPI
|
|
95
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
96
|
+
|
|
97
|
+
publish-mcp-registry:
|
|
98
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
99
|
+
runs-on: ubuntu-latest
|
|
100
|
+
needs: [publish-pypi, publish-docker]
|
|
101
|
+
permissions:
|
|
102
|
+
id-token: write # Required for OIDC authentication
|
|
103
|
+
contents: read
|
|
104
|
+
|
|
105
|
+
steps:
|
|
106
|
+
- name: Checkout code
|
|
107
|
+
uses: actions/checkout@v7
|
|
108
|
+
|
|
109
|
+
- name: Install mcp-publisher
|
|
110
|
+
run: |
|
|
111
|
+
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
|
|
112
|
+
chmod +x mcp-publisher
|
|
113
|
+
|
|
114
|
+
- name: Authenticate to MCP Registry
|
|
115
|
+
run: ./mcp-publisher login github-oidc
|
|
116
|
+
|
|
117
|
+
- name: Publish server to MCP Registry
|
|
118
|
+
run: ./mcp-publisher publish
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
create-release:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
outputs:
|
|
14
|
+
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
15
|
+
tag_name: ${{ steps.get_version.outputs.tag_name }}
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout code
|
|
19
|
+
uses: actions/checkout@v7
|
|
20
|
+
|
|
21
|
+
- name: Get version from tag
|
|
22
|
+
id: get_version
|
|
23
|
+
run: echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
24
|
+
|
|
25
|
+
- name: Create Release
|
|
26
|
+
id: create_release
|
|
27
|
+
uses: softprops/action-gh-release@v3
|
|
28
|
+
with:
|
|
29
|
+
tag_name: ${{ steps.get_version.outputs.tag_name }}
|
|
30
|
+
name: ${{ steps.get_version.outputs.tag_name }}
|
|
31
|
+
generate_release_notes: true
|
|
32
|
+
append_body: true
|
|
33
|
+
body: |
|
|
34
|
+
## Docker Image
|
|
35
|
+
- `ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.tag_name }}`
|
|
36
|
+
prerelease: ${{ contains(steps.get_version.outputs.tag_name, '-') }}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
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
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
110
|
+
.pdm.toml
|
|
111
|
+
|
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
113
|
+
__pypackages__/
|
|
114
|
+
|
|
115
|
+
# Celery stuff
|
|
116
|
+
celerybeat-schedule
|
|
117
|
+
celerybeat.pid
|
|
118
|
+
|
|
119
|
+
# SageMath parsed files
|
|
120
|
+
*.sage.py
|
|
121
|
+
|
|
122
|
+
# Environments
|
|
123
|
+
.env
|
|
124
|
+
.venv
|
|
125
|
+
env/
|
|
126
|
+
venv/
|
|
127
|
+
ENV/
|
|
128
|
+
env.bak/
|
|
129
|
+
venv.bak/
|
|
130
|
+
|
|
131
|
+
# Spyder project settings
|
|
132
|
+
.spyderproject
|
|
133
|
+
.spyproject
|
|
134
|
+
|
|
135
|
+
# Rope project settings
|
|
136
|
+
.ropeproject
|
|
137
|
+
|
|
138
|
+
# mkdocs documentation
|
|
139
|
+
/site
|
|
140
|
+
|
|
141
|
+
# mypy
|
|
142
|
+
.mypy_cache/
|
|
143
|
+
.dmypy.json
|
|
144
|
+
dmypy.json
|
|
145
|
+
|
|
146
|
+
# Pyre type checker
|
|
147
|
+
.pyre/
|
|
148
|
+
|
|
149
|
+
# pytype static type analyzer
|
|
150
|
+
.pytype/
|
|
151
|
+
|
|
152
|
+
# Cython debug symbols
|
|
153
|
+
cython_debug/
|
|
154
|
+
|
|
155
|
+
# PyCharm
|
|
156
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
157
|
+
# be added to the global gitignore or merged into this project gitignore. For a JetBrains IDE
|
|
158
|
+
# it is recommended to use a global gitignore:
|
|
159
|
+
# https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
160
|
+
# JetBrains IDEs
|
|
161
|
+
.idea/
|
|
162
|
+
|
|
163
|
+
# VS Code
|
|
164
|
+
.vscode/
|
|
165
|
+
!.vscode/tasks.json
|
|
166
|
+
!.vscode/launch.json
|
|
167
|
+
!.vscode/extensions.json
|
|
168
|
+
!.vscode/settings.json
|
|
169
|
+
|
|
170
|
+
# Project specific
|
|
171
|
+
# Environment files
|
|
172
|
+
.env.local
|
|
173
|
+
.env.production
|
|
174
|
+
.env.development
|
|
175
|
+
|
|
176
|
+
# Logs
|
|
177
|
+
*.log
|
|
178
|
+
logs/
|
|
179
|
+
|
|
180
|
+
# Temporary files
|
|
181
|
+
*.tmp
|
|
182
|
+
*.temp
|
|
183
|
+
temp/
|
|
184
|
+
tmp/
|
|
185
|
+
|
|
186
|
+
# Backup files
|
|
187
|
+
*.backup
|
|
188
|
+
*.bak
|
|
189
|
+
backups/
|
|
190
|
+
|
|
191
|
+
# SSL Certificates (if stored locally)
|
|
192
|
+
*.pem
|
|
193
|
+
*.key
|
|
194
|
+
*.crt
|
|
195
|
+
*.cert
|
|
196
|
+
certificates/
|
|
197
|
+
|
|
198
|
+
# Test outputs
|
|
199
|
+
test_results/
|
|
200
|
+
test_output/
|
|
201
|
+
|
|
202
|
+
# Documentation builds
|
|
203
|
+
docs/_build/
|
|
204
|
+
docs/build/
|
|
205
|
+
|
|
206
|
+
# MacOS
|
|
207
|
+
.DS_Store
|
|
208
|
+
.AppleDouble
|
|
209
|
+
.LSOverride
|
|
210
|
+
|
|
211
|
+
# Windows
|
|
212
|
+
Thumbs.db
|
|
213
|
+
ehthumbs.db
|
|
214
|
+
Desktop.ini
|
|
215
|
+
|
|
216
|
+
# Linux
|
|
217
|
+
*~
|
|
218
|
+
|
|
219
|
+
# UV specific
|
|
220
|
+
.uv/
|
|
221
|
+
|
|
222
|
+
# Runtime files
|
|
223
|
+
*.pid
|
|
224
|
+
*.sock
|
|
225
|
+
|
|
226
|
+
# Database files (if any)
|
|
227
|
+
*.db
|
|
228
|
+
*.sqlite
|
|
229
|
+
*.sqlite3
|
|
230
|
+
|
|
231
|
+
# Cache directories
|
|
232
|
+
.cache/
|
|
233
|
+
cache/
|
|
234
|
+
|
|
235
|
+
# ruff cache
|
|
236
|
+
.ruff_cache/
|
|
237
|
+
|
|
238
|
+
.mcpregistry_*
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
fail_fast: false
|
|
2
|
+
minimum_prek_version: "0.5.0"
|
|
3
|
+
default_install_hook_types: [ pre-push, commit-msg, pre-commit ]
|
|
4
|
+
exclude: |
|
|
5
|
+
(?x)^(
|
|
6
|
+
uv\.lock
|
|
7
|
+
)$
|
|
8
|
+
|
|
9
|
+
repos:
|
|
10
|
+
- repo: meta
|
|
11
|
+
hooks:
|
|
12
|
+
- id: identity
|
|
13
|
+
name: Print checked files
|
|
14
|
+
description: Print input to the static check hooks for troubleshooting
|
|
15
|
+
|
|
16
|
+
- repo: builtin
|
|
17
|
+
hooks:
|
|
18
|
+
- id: trailing-whitespace
|
|
19
|
+
- id: mixed-line-ending
|
|
20
|
+
- id: check-yaml
|
|
21
|
+
- id: check-toml
|
|
22
|
+
- id: check-json
|
|
23
|
+
- id: end-of-file-fixer
|
|
24
|
+
- id: check-case-conflict
|
|
25
|
+
- id: check-merge-conflict
|
|
26
|
+
- id: check-added-large-files
|
|
27
|
+
args: [ --maxkb=100 ]
|
|
28
|
+
|
|
29
|
+
- repo: local
|
|
30
|
+
hooks:
|
|
31
|
+
- id: local-ruff-check
|
|
32
|
+
name: ruff check
|
|
33
|
+
entry: uv run ruff check --force-exclude --fix --exit-non-zero-on-fix
|
|
34
|
+
require_serial: true
|
|
35
|
+
language: system
|
|
36
|
+
types: [ python ]
|
|
37
|
+
|
|
38
|
+
- id: local-ruff-format
|
|
39
|
+
name: ruff format
|
|
40
|
+
entry: uv run ruff format --force-exclude --exit-non-zero-on-format
|
|
41
|
+
require_serial: true
|
|
42
|
+
language: system
|
|
43
|
+
types: [ python ]
|
|
44
|
+
|
|
45
|
+
- id: local-ty-check
|
|
46
|
+
name: ty check
|
|
47
|
+
entry: uv run ty check . --ignore unresolved-import
|
|
48
|
+
language: system
|
|
49
|
+
pass_filenames: false
|
|
50
|
+
always_run: true
|
|
51
|
+
|
|
52
|
+
- id: local-typos
|
|
53
|
+
name: typos
|
|
54
|
+
entry: uv run typos
|
|
55
|
+
language: system
|
|
56
|
+
|
|
57
|
+
- id: local-commitizen
|
|
58
|
+
name: commitizen check
|
|
59
|
+
entry: uv run cz check --allow-abort --commit-msg-file
|
|
60
|
+
language: system
|
|
61
|
+
stages: [ commit-msg ]
|
|
62
|
+
|
|
63
|
+
- id: local-commitizen-branch
|
|
64
|
+
name: commitizen branch check
|
|
65
|
+
entry: uv run cz check --rev-range origin/HEAD..HEAD
|
|
66
|
+
language: system
|
|
67
|
+
pass_filenames: false
|
|
68
|
+
always_run: true
|
|
69
|
+
stages:
|
|
70
|
+
- pre-push
|
|
71
|
+
|
|
72
|
+
- id: pytest
|
|
73
|
+
name: pytest
|
|
74
|
+
entry: uv run pytest
|
|
75
|
+
language: system
|
|
76
|
+
types: [ python ]
|
|
77
|
+
pass_filenames: false
|
|
78
|
+
always_run: true
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
FROM python:3.14-alpine3.24 AS builder
|
|
2
|
+
|
|
3
|
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
|
4
|
+
ENV UV_LINK_MODE=copy
|
|
5
|
+
ENV UV_PYTHON_DOWNLOADS=0
|
|
6
|
+
|
|
7
|
+
WORKDIR /app
|
|
8
|
+
|
|
9
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
10
|
+
--mount=type=bind,source=uv.lock,target=uv.lock \
|
|
11
|
+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
|
12
|
+
uv sync --locked --all-extras --no-install-project --no-dev --no-editable
|
|
13
|
+
|
|
14
|
+
COPY pyproject.toml uv.lock LICENSE README.md ./
|
|
15
|
+
COPY src/ ./src/
|
|
16
|
+
|
|
17
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
18
|
+
uv sync --locked --all-extras --no-dev --no-editable
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
FROM python:3.14-alpine3.24
|
|
22
|
+
LABEL org.opencontainers.image.title="NetBox MCP Server" \
|
|
23
|
+
org.opencontainers.image.description="MCP server for NetBox DCIM/IPAM management" \
|
|
24
|
+
org.opencontainers.image.url="https://github.com/mhajder/netbox-mcp" \
|
|
25
|
+
org.opencontainers.image.source="https://github.com/mhajder/netbox-mcp" \
|
|
26
|
+
org.opencontainers.image.vendor="Mateusz Hajder" \
|
|
27
|
+
org.opencontainers.image.licenses="MIT" \
|
|
28
|
+
io.modelcontextprotocol.server.name="io.github.mhajder/netbox-mcp"
|
|
29
|
+
ENV PYTHONUNBUFFERED=1
|
|
30
|
+
|
|
31
|
+
RUN apk add --no-cache ca-certificates \
|
|
32
|
+
&& addgroup -g 1000 appuser \
|
|
33
|
+
&& adduser -D -u 1000 -G appuser appuser
|
|
34
|
+
|
|
35
|
+
COPY --from=builder --chown=appuser:appuser /app/.venv /app/.venv
|
|
36
|
+
|
|
37
|
+
WORKDIR /app
|
|
38
|
+
|
|
39
|
+
USER appuser
|
|
40
|
+
|
|
41
|
+
ENV PATH="/app/.venv/bin:$PATH"
|
|
42
|
+
|
|
43
|
+
HEALTHCHECK \
|
|
44
|
+
--interval=15s \
|
|
45
|
+
--timeout=5s \
|
|
46
|
+
--start-period=5s \
|
|
47
|
+
--retries=3 \
|
|
48
|
+
CMD if [ "$MCP_TRANSPORT" = "http" ]; then nc -z 127.0.0.1 "${MCP_HTTP_PORT:-8000}" || exit 1; fi
|
|
49
|
+
|
|
50
|
+
ENV MCP_TRANSPORT=http
|
|
51
|
+
ENV MCP_HTTP_HOST=0.0.0.0
|
|
52
|
+
ENV MCP_HTTP_PORT=8000
|
|
53
|
+
|
|
54
|
+
EXPOSE 8000
|
|
55
|
+
|
|
56
|
+
ENTRYPOINT ["netbox-mcp"]
|