cisco-sdwan-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.
Files changed (73) hide show
  1. cisco_sdwan_mcp-0.1.0/.dockerignore +36 -0
  2. cisco_sdwan_mcp-0.1.0/.env.example +112 -0
  3. cisco_sdwan_mcp-0.1.0/.github/workflows/build-push-ghcr.yaml +55 -0
  4. cisco_sdwan_mcp-0.1.0/.github/workflows/publish-chart.yaml +128 -0
  5. cisco_sdwan_mcp-0.1.0/.github/workflows/release.yml +123 -0
  6. cisco_sdwan_mcp-0.1.0/.github/workflows/test.yaml +31 -0
  7. cisco_sdwan_mcp-0.1.0/.gitignore +36 -0
  8. cisco_sdwan_mcp-0.1.0/Dockerfile +85 -0
  9. cisco_sdwan_mcp-0.1.0/LICENSE +21 -0
  10. cisco_sdwan_mcp-0.1.0/PKG-INFO +745 -0
  11. cisco_sdwan_mcp-0.1.0/README.md +719 -0
  12. cisco_sdwan_mcp-0.1.0/certificates/README.md +11 -0
  13. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/__init__.py +12 -0
  14. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/auth.py +247 -0
  15. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/env.py +46 -0
  16. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/mcp.py +54 -0
  17. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/prompts/__init__.py +8 -0
  18. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/prompts/sdwan_prompts.py +116 -0
  19. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/readme_template.html +159 -0
  20. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/resources/__init__.py +8 -0
  21. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/resources/sdwan_resources.py +87 -0
  22. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/sdwan/__init__.py +26 -0
  23. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/sdwan/client.py +317 -0
  24. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/sdwan/config.py +130 -0
  25. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/sdwan/errors.py +39 -0
  26. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/sdwan/formatting.py +225 -0
  27. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/server.py +98 -0
  28. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/tools/__init__.py +37 -0
  29. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/tools/_helpers.py +71 -0
  30. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/tools/alarm_tools.py +148 -0
  31. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/tools/config_tools.py +216 -0
  32. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/tools/inventory_tools.py +159 -0
  33. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/tools/monitoring_tools.py +247 -0
  34. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/tools/statistics_tools.py +182 -0
  35. cisco_sdwan_mcp-0.1.0/cisco_sdwan_mcp/tools/template_tools.py +185 -0
  36. cisco_sdwan_mcp-0.1.0/deploy/README.md +259 -0
  37. cisco_sdwan_mcp-0.1.0/deploy/cloud-run-service.yaml +84 -0
  38. cisco_sdwan_mcp-0.1.0/deploy/helm/README.md +114 -0
  39. cisco_sdwan_mcp-0.1.0/deploy/helm/cisco-sdwan-mcp/.helmignore +7 -0
  40. cisco_sdwan_mcp-0.1.0/deploy/helm/cisco-sdwan-mcp/Chart.yaml +26 -0
  41. cisco_sdwan_mcp-0.1.0/deploy/helm/cisco-sdwan-mcp/ci/styrmin-values.yaml +50 -0
  42. cisco_sdwan_mcp-0.1.0/deploy/helm/cisco-sdwan-mcp/templates/NOTES.txt +31 -0
  43. cisco_sdwan_mcp-0.1.0/deploy/helm/cisco-sdwan-mcp/templates/_helpers.tpl +64 -0
  44. cisco_sdwan_mcp-0.1.0/deploy/helm/cisco-sdwan-mcp/templates/configmap.yaml +44 -0
  45. cisco_sdwan_mcp-0.1.0/deploy/helm/cisco-sdwan-mcp/templates/deployment.yaml +110 -0
  46. cisco_sdwan_mcp-0.1.0/deploy/helm/cisco-sdwan-mcp/templates/ingress.yaml +40 -0
  47. cisco_sdwan_mcp-0.1.0/deploy/helm/cisco-sdwan-mcp/templates/secret.yaml +16 -0
  48. cisco_sdwan_mcp-0.1.0/deploy/helm/cisco-sdwan-mcp/templates/service.yaml +15 -0
  49. cisco_sdwan_mcp-0.1.0/deploy/helm/cisco-sdwan-mcp/templates/serviceaccount.yaml +14 -0
  50. cisco_sdwan_mcp-0.1.0/deploy/helm/cisco-sdwan-mcp/values.yaml +190 -0
  51. cisco_sdwan_mcp-0.1.0/deploy/kubernetes/configmap.yaml +51 -0
  52. cisco_sdwan_mcp-0.1.0/deploy/kubernetes/deployment.yaml +85 -0
  53. cisco_sdwan_mcp-0.1.0/deploy/kubernetes/ingress.yaml +34 -0
  54. cisco_sdwan_mcp-0.1.0/deploy/kubernetes/kustomization.yaml +16 -0
  55. cisco_sdwan_mcp-0.1.0/deploy/kubernetes/secret.example.yaml +30 -0
  56. cisco_sdwan_mcp-0.1.0/deploy/kubernetes/service.yaml +14 -0
  57. cisco_sdwan_mcp-0.1.0/deploy/styrmin.md +114 -0
  58. cisco_sdwan_mcp-0.1.0/docker-compose.yml +91 -0
  59. cisco_sdwan_mcp-0.1.0/driver.styrmin.yml +268 -0
  60. cisco_sdwan_mcp-0.1.0/pyproject.toml +63 -0
  61. cisco_sdwan_mcp-0.1.0/scripts/run_docker.ps1 +43 -0
  62. cisco_sdwan_mcp-0.1.0/scripts/run_docker.sh +39 -0
  63. cisco_sdwan_mcp-0.1.0/server.json +90 -0
  64. cisco_sdwan_mcp-0.1.0/tests/conftest.py +149 -0
  65. cisco_sdwan_mcp-0.1.0/tests/sample_data.py +201 -0
  66. cisco_sdwan_mcp-0.1.0/tests/test_auth.py +171 -0
  67. cisco_sdwan_mcp-0.1.0/tests/test_client.py +181 -0
  68. cisco_sdwan_mcp-0.1.0/tests/test_config_tools.py +180 -0
  69. cisco_sdwan_mcp-0.1.0/tests/test_env.py +36 -0
  70. cisco_sdwan_mcp-0.1.0/tests/test_formatting.py +113 -0
  71. cisco_sdwan_mcp-0.1.0/tests/test_server.py +150 -0
  72. cisco_sdwan_mcp-0.1.0/tests/test_tools.py +332 -0
  73. cisco_sdwan_mcp-0.1.0/values.j2.yml +78 -0
@@ -0,0 +1,36 @@
1
+ # Keep the build context small and avoid baking local state into the image.
2
+ .git/
3
+ .github/
4
+ .gitignore
5
+
6
+ # Virtual environments — never copy a host venv into the image
7
+ .venv/
8
+ venv/
9
+
10
+ # Python caches
11
+ __pycache__/
12
+ *.py[cod]
13
+ *.egg-info/
14
+ build/
15
+ dist/
16
+
17
+ # Tooling caches
18
+ .pytest_cache/
19
+ .ruff_cache/
20
+ .mypy_cache/
21
+ .coverage
22
+ htmlcov/
23
+
24
+ # Not needed at runtime
25
+ tests/
26
+ scripts/
27
+ deploy/
28
+ # Styrmin driver — read from a git clone of this repo, never from the image
29
+ driver.styrmin.yml
30
+ values.j2.yml
31
+ compose.yaml
32
+ .env
33
+ .env.example
34
+ .vscode/
35
+ .idea/
36
+ .DS_Store
@@ -0,0 +1,112 @@
1
+ # Copy to .env and adjust. Never commit a real .env file.
2
+ # The SDWAN_* block is required — everything else has a working default.
3
+ #
4
+ # The server reads this file at startup (repository root, or SDWAN_ENV_FILE to
5
+ # point elsewhere). Variables already set in the environment — compose
6
+ # env_file, docker --env-file, Kubernetes secrets — always win over it.
7
+ # SDWAN_VMANAGE_URL takes precedence over SDWAN_VMANAGE_HOST/PORT: set one or
8
+ # the other, not both.
9
+
10
+ # ---------------------------------------------------------------------------
11
+ # Cisco Catalyst SD-WAN Manager (vManage) — REQUIRED
12
+ # ---------------------------------------------------------------------------
13
+ # Full URL of the controller, including the port when it is not 443.
14
+ SDWAN_VMANAGE_URL=https://vmanage.example.com:8443
15
+ # Alternative to the URL: host (+ optional port, default 443).
16
+ #SDWAN_VMANAGE_HOST=vmanage.example.com
17
+ #SDWAN_VMANAGE_PORT=8443
18
+
19
+ SDWAN_USERNAME=automation-readonly
20
+ SDWAN_PASSWORD=change-me
21
+
22
+ # TLS verification. Leave true in production. Many labs and on-box controllers
23
+ # present a self-signed certificate — prefer pointing at its CA over disabling
24
+ # verification entirely.
25
+ SDWAN_VERIFY_SSL=true
26
+ #SDWAN_CA_BUNDLE=/app/certificates/vmanage-ca.pem
27
+
28
+ # Seconds to wait for vManage. Real-time endpoints poll the device itself and
29
+ # can be slow on a large fabric.
30
+ SDWAN_TIMEOUT=60
31
+
32
+ # Default cap on records a single tool call returns, so one broad question
33
+ # cannot flood the model's context.
34
+ SDWAN_PAGE_SIZE=100
35
+
36
+ # ---------------------------------------------------------------------------
37
+ # Write protection
38
+ # ---------------------------------------------------------------------------
39
+ # false (default) — configuration-changing tools are NOT registered at all, so
40
+ # the model cannot see or call them. The server is read-only.
41
+ # true — attach_device_template, activate_vsmart_policy and
42
+ # get_task_status are registered. Each still requires explicit user approval
43
+ # (MCP elicitation, or confirm=True on clients that cannot prompt).
44
+ # Use a vManage account with only the privileges you intend to grant: this flag
45
+ # governs the tool surface, not what the account itself is allowed to do.
46
+ SDWAN_ENABLE_WRITES=false
47
+
48
+ # ---------------------------------------------------------------------------
49
+ # Server
50
+ # ---------------------------------------------------------------------------
51
+ MCP_SERVER_NAME=cisco-sdwan-mcp
52
+
53
+ # Transport: "http" (default — deployable, supports auth) or "stdio" (local
54
+ # subprocess for desktop clients; host/port/auth do not apply).
55
+ MCP_TRANSPORT=http
56
+ MCP_HOST=0.0.0.0
57
+ MCP_PORT=8000
58
+
59
+ LOG_LEVEL=INFO
60
+
61
+ # ---------------------------------------------------------------------------
62
+ # Authentication of MCP clients to THIS server (HTTP transport only).
63
+ # Unrelated to SDWAN_USERNAME/SDWAN_PASSWORD, which authenticate this server to
64
+ # vManage. Pick ONE mode.
65
+ # Modes: none | static | jwt | introspection | oauth-proxy |
66
+ # github | google | azure | auth0 | workos
67
+ # ---------------------------------------------------------------------------
68
+ MCP_AUTH=none
69
+
70
+ # Scopes a token must carry to access the server (comma-separated, optional
71
+ # for most modes, REQUIRED for azure).
72
+ #MCP_AUTH_REQUIRED_SCOPES=mcp:read,mcp:write
73
+
74
+ # --- static (development only — fixed bearer tokens) -----------------------
75
+ # Comma-separated tokens, or JSON mapping tokens to scopes:
76
+ # MCP_AUTH_STATIC_TOKENS={"dev-token": ["mcp:read"]}
77
+ #MCP_AUTH_STATIC_TOKENS=dev-token
78
+
79
+ # --- jwt (verify JWTs from Keycloak, Okta, Entra ID, Cognito, ...) ----------
80
+ #MCP_AUTH_JWKS_URI=https://idp.example.com/.well-known/jwks.json
81
+ #MCP_AUTH_PUBLIC_KEY= # PEM public key, alternative to JWKS URI
82
+ #MCP_AUTH_ISSUER=https://idp.example.com/
83
+ #MCP_AUTH_AUDIENCE=cisco-sdwan-mcp
84
+ #MCP_AUTH_ALGORITHM= # only needed with MCP_AUTH_PUBLIC_KEY, e.g. RS256
85
+
86
+ # --- introspection (opaque tokens via RFC 7662) ------------------------------
87
+ #MCP_AUTH_INTROSPECTION_URL=https://idp.example.com/oauth/introspect
88
+ #MCP_AUTH_CLIENT_ID=mcp-server
89
+ #MCP_AUTH_CLIENT_SECRET=change-me
90
+
91
+ # --- oauth-proxy (full OAuth 2.1 flow via any upstream IdP) ------------------
92
+ # Also requires the jwt variables above to verify upstream access tokens.
93
+ #MCP_AUTH_UPSTREAM_AUTHORIZATION_ENDPOINT=https://idp.example.com/authorize
94
+ #MCP_AUTH_UPSTREAM_TOKEN_ENDPOINT=https://idp.example.com/oauth/token
95
+ #MCP_AUTH_CLIENT_ID=client-id
96
+ #MCP_AUTH_CLIENT_SECRET=client-secret
97
+ #MCP_AUTH_BASE_URL=https://mcp.example.com # public URL of THIS server
98
+
99
+ # --- github / google (hosted "login with ..." providers) ---------------------
100
+ #MCP_AUTH_CLIENT_ID=...
101
+ #MCP_AUTH_CLIENT_SECRET=...
102
+ #MCP_AUTH_BASE_URL=https://mcp.example.com
103
+
104
+ # --- azure (Microsoft Entra ID; MCP_AUTH_REQUIRED_SCOPES is required) --------
105
+ #MCP_AUTH_AZURE_TENANT_ID=00000000-0000-0000-0000-000000000000
106
+
107
+ # --- auth0 --------------------------------------------------------------------
108
+ #MCP_AUTH_AUTH0_CONFIG_URL=https://TENANT.auth0.com/.well-known/openid-configuration
109
+ #MCP_AUTH_AUDIENCE=https://mcp.example.com
110
+
111
+ # --- workos (AuthKit) ---------------------------------------------------------
112
+ #MCP_AUTH_AUTHKIT_DOMAIN=https://TENANT.authkit.app
@@ -0,0 +1,55 @@
1
+ name: Build and push image
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ tags: ["v*"]
7
+ workflow_dispatch:
8
+
9
+ env:
10
+ REGISTRY: ghcr.io
11
+ IMAGE_NAME: ${{ github.repository }}
12
+
13
+ jobs:
14
+ build-push:
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ contents: read
18
+ # Required for pushing to GHCR with the built-in GITHUB_TOKEN —
19
+ # no registry secrets to configure.
20
+ packages: write
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Set up Docker Buildx
26
+ uses: docker/setup-buildx-action@v3
27
+
28
+ - name: Log in to GHCR
29
+ uses: docker/login-action@v3
30
+ with:
31
+ registry: ${{ env.REGISTRY }}
32
+ username: ${{ github.actor }}
33
+ password: ${{ secrets.GITHUB_TOKEN }}
34
+
35
+ - name: Extract metadata
36
+ id: meta
37
+ uses: docker/metadata-action@v5
38
+ with:
39
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40
+ tags: |
41
+ type=ref,event=branch
42
+ type=semver,pattern={{version}}
43
+ type=semver,pattern={{major}}.{{minor}}
44
+ type=sha,prefix=sha-
45
+ type=raw,value=latest,enable={{is_default_branch}}
46
+
47
+ - name: Build and push
48
+ uses: docker/build-push-action@v6
49
+ with:
50
+ context: .
51
+ push: true
52
+ tags: ${{ steps.meta.outputs.tags }}
53
+ labels: ${{ steps.meta.outputs.labels }}
54
+ cache-from: type=gha
55
+ cache-to: type=gha,mode=max
@@ -0,0 +1,128 @@
1
+ name: Helm chart
2
+
3
+ # The Styrmin driver pins `spec.helm.main.version` to the chart version, and
4
+ # Flux pulls the chart from an OCI registry — a chart committed to this
5
+ # repository is not something Styrmin can deploy. This workflow is what turns
6
+ # deploy/helm/cisco-sdwan-mcp/ into something the driver can reference.
7
+
8
+ # Deliberately not triggered by v* tags: the chart is versioned independently of
9
+ # the application. A new application release needs no chart release — the driver
10
+ # passes the selected version through as the image tag, and the chart's own
11
+ # appVersion is only a fallback for a bare `helm install`.
12
+ on:
13
+ push:
14
+ branches: [main]
15
+ paths:
16
+ - "deploy/helm/**"
17
+ - ".github/workflows/publish-chart.yaml"
18
+ pull_request:
19
+ paths:
20
+ - "deploy/helm/**"
21
+ - "driver.styrmin.yml"
22
+ - "values.j2.yml"
23
+ - ".github/workflows/publish-chart.yaml"
24
+ workflow_dispatch:
25
+ inputs:
26
+ force:
27
+ description: "Overwrite the chart version if it is already published"
28
+ type: boolean
29
+ default: false
30
+
31
+ env:
32
+ CHART_DIR: deploy/helm/cisco-sdwan-mcp
33
+
34
+ jobs:
35
+ lint:
36
+ runs-on: ubuntu-latest
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+
40
+ - uses: azure/setup-helm@v4
41
+
42
+ - name: Lint
43
+ run: helm lint "$CHART_DIR"
44
+
45
+ - name: Render with chart defaults
46
+ run: helm template ci "$CHART_DIR" > /dev/null
47
+
48
+ - name: Render with the values the Styrmin driver produces
49
+ # Guards the chart <-> driver contract: every value values.j2.yml sets
50
+ # has to still be one the chart understands.
51
+ run: helm template ci "$CHART_DIR" -f "$CHART_DIR/ci/styrmin-values.yaml" > /dev/null
52
+
53
+ - name: Check the driver pins the chart version being built
54
+ run: |
55
+ set -euo pipefail
56
+ chart_version=$(grep -E '^version:' "$CHART_DIR/Chart.yaml" | awk '{print $2}')
57
+ driver_version=$(awk '/^ helm:/{h=1} h && /^ version:/{gsub(/["[:space:]]/,"",$2); print $2; exit}' driver.styrmin.yml)
58
+ echo "chart=$chart_version driver pins=$driver_version"
59
+ if [ "$chart_version" != "$driver_version" ]; then
60
+ echo "::error::driver.styrmin.yml pins chart version $driver_version but the chart is $chart_version — bump both together"
61
+ exit 1
62
+ fi
63
+
64
+ publish:
65
+ # Publishing a chart version that deployments already pin would silently
66
+ # change what they resolve to, so pull requests only lint.
67
+ if: github.event_name != 'pull_request'
68
+ needs: lint
69
+ runs-on: ubuntu-latest
70
+ permissions:
71
+ contents: read
72
+ packages: write
73
+ steps:
74
+ - uses: actions/checkout@v4
75
+
76
+ - uses: azure/setup-helm@v4
77
+
78
+ - name: Resolve registry path
79
+ id: registry
80
+ # GHCR paths must be lowercase; the repository owner is not guaranteed
81
+ # to be.
82
+ run: |
83
+ set -euo pipefail
84
+ version=$(grep -E '^version:' "$CHART_DIR/Chart.yaml" | awk '{print $2}')
85
+ echo "repo=oci://ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/charts" >> "$GITHUB_OUTPUT"
86
+ echo "version=$version" >> "$GITHUB_OUTPUT"
87
+
88
+ - name: Log in to GHCR
89
+ run: |
90
+ echo "${{ secrets.GITHUB_TOKEN }}" \
91
+ | helm registry login ghcr.io -u "${{ github.actor }}" --password-stdin
92
+
93
+ - name: Skip if this version is already published
94
+ # Chart versions are immutable: Styrmin deployments pin
95
+ # spec.helm.main.version, so overwriting one changes what they resolve
96
+ # to without anything recording that it happened.
97
+ if: inputs.force != true
98
+ run: |
99
+ set -euo pipefail
100
+ version="${{ steps.registry.outputs.version }}"
101
+ repo="${{ steps.registry.outputs.repo }}"
102
+ if helm show chart "$repo/cisco-sdwan-mcp" --version "$version" > /dev/null 2>&1; then
103
+ echo "::notice::chart $version is already published — bump version in $CHART_DIR/Chart.yaml (and the driver's spec.helm.main.version) to release a change"
104
+ echo "skip=true" >> "$GITHUB_ENV"
105
+ fi
106
+
107
+ - name: Package and push
108
+ if: env.skip != 'true'
109
+ run: |
110
+ set -euo pipefail
111
+ helm package "$CHART_DIR" --destination dist
112
+ helm push dist/cisco-sdwan-mcp-*.tgz "${{ steps.registry.outputs.repo }}"
113
+
114
+ - name: Summary
115
+ run: |
116
+ {
117
+ if [ "${skip:-}" = "true" ]; then
118
+ echo "### Chart already published — nothing pushed"
119
+ else
120
+ echo "### Chart published"
121
+ fi
122
+ echo
123
+ echo '```'
124
+ echo "${{ steps.registry.outputs.repo }}/cisco-sdwan-mcp:${{ steps.registry.outputs.version }}"
125
+ echo '```'
126
+ echo
127
+ echo "If this is the first push under a new package name, check the package visibility — GHCR packages start out private."
128
+ } >> "$GITHUB_STEP_SUMMARY"
@@ -0,0 +1,123 @@
1
+ name: Publish to PyPI and the MCP Registry
2
+
3
+ # Tag a release to publish: git tag v0.1.0 && git push origin v0.1.0
4
+ #
5
+ # PyPI upload uses trusted publishing (OIDC) — no API token. One-time setup at
6
+ # https://pypi.org/manage/account/publishing/, adding a pending publisher for
7
+ # project `cisco-sdwan-mcp`, owner `pcDamasceno`, repo `cisco-sdwan-mcp`,
8
+ # workflow `release.yml`, environment `pypi`.
9
+ #
10
+ # The registry proves PyPI ownership by finding the `mcp-name:` marker in
11
+ # README.md, which becomes the PyPI long description. Do not remove it.
12
+
13
+ on:
14
+ push:
15
+ tags: ["v*"]
16
+ workflow_dispatch:
17
+
18
+ jobs:
19
+ pypi:
20
+ name: Publish to PyPI
21
+ runs-on: ubuntu-latest
22
+ environment: pypi
23
+ permissions:
24
+ id-token: write # trusted publishing
25
+ contents: read
26
+ steps:
27
+ - uses: actions/checkout@v5
28
+
29
+ - name: Install uv
30
+ uses: astral-sh/setup-uv@v5
31
+
32
+ - name: Check the tag matches the project version
33
+ run: |
34
+ TAG=${GITHUB_REF#refs/tags/v}
35
+ VERSION=$(uv version --short)
36
+ if [ "$GITHUB_REF" != "${GITHUB_REF#refs/tags/}" ] && [ "$TAG" != "$VERSION" ]; then
37
+ echo "Tag v$TAG does not match pyproject version $VERSION" >&2
38
+ exit 1
39
+ fi
40
+
41
+ - name: Run tests
42
+ run: uv run --extra dev pytest -q
43
+
44
+ - name: Build
45
+ run: uv build
46
+
47
+ # uv drops a .gitignore into dist/; the publish action treats everything
48
+ # in dist/ as a distribution and newer versions reject the stray file.
49
+ - name: Clean non-distribution files out of dist/
50
+ run: rm -f dist/.gitignore
51
+
52
+ # The name below must match the "PyPI Project Name" of the trusted
53
+ # publisher exactly, or the upload fails with "Non-user identities cannot
54
+ # create new projects". Printing it makes that mismatch obvious in the log.
55
+ - name: Show the project name being published
56
+ run: |
57
+ uv run --with twine --no-project twine check dist/*
58
+ python -c "
59
+ import glob, zipfile
60
+ w = sorted(glob.glob('dist/*.whl'))[-1]
61
+ z = zipfile.ZipFile(w)
62
+ meta = next(n for n in z.namelist() if n.endswith('METADATA'))
63
+ for line in z.read(meta).decode().splitlines():
64
+ if line.startswith(('Name:', 'Version:')):
65
+ print('::notice::' + line)
66
+ "
67
+
68
+ # Auth falls back automatically: if the PYPI_API_TOKEN secret is set, the
69
+ # action uses it; if it is empty or absent, it uses trusted publishing.
70
+ #
71
+ # PyPI refuses to let a trusted publisher create a project that does not
72
+ # exist yet unless a *pending* publisher matches it exactly. Set the
73
+ # secret for the first release to create the project under your own
74
+ # account, then delete the secret — every later release goes back to
75
+ # trusted publishing with no workflow change.
76
+ - name: Publish
77
+ uses: pypa/gh-action-pypi-publish@release/v1
78
+ with:
79
+ password: ${{ secrets.PYPI_API_TOKEN }}
80
+ # Attestations require trusted publishing; they cannot be signed with
81
+ # an API token, so only ask for them when no token is set.
82
+ attestations: ${{ secrets.PYPI_API_TOKEN == '' }}
83
+
84
+ mcp-registry:
85
+ name: Publish to the MCP Registry
86
+ needs: pypi
87
+ runs-on: ubuntu-latest
88
+ permissions:
89
+ id-token: write # OIDC, proves the io.github.pcDamasceno/* namespace
90
+ contents: read
91
+ steps:
92
+ - uses: actions/checkout@v5
93
+
94
+ - name: Install mcp-publisher
95
+ run: |
96
+ 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
97
+
98
+ - name: Sync server.json version to the tag
99
+ if: startsWith(github.ref, 'refs/tags/v')
100
+ run: |
101
+ VERSION=${GITHUB_REF#refs/tags/v}
102
+ jq --arg v "$VERSION" '.version = $v | .packages[0].version = $v' server.json > server.tmp
103
+ mv server.tmp server.json
104
+
105
+ - name: Wait for the release to appear on PyPI
106
+ run: |
107
+ VERSION=$(jq -r .version server.json)
108
+ for i in $(seq 1 30); do
109
+ if curl -sf "https://pypi.org/pypi/cisco-sdwan-mcp/$VERSION/json" > /dev/null; then
110
+ echo "cisco-sdwan-mcp $VERSION is on PyPI"
111
+ exit 0
112
+ fi
113
+ echo "waiting for cisco-sdwan-mcp $VERSION on PyPI ($i/30)"
114
+ sleep 10
115
+ done
116
+ echo "Timed out waiting for PyPI" >&2
117
+ exit 1
118
+
119
+ - name: Authenticate
120
+ run: ./mcp-publisher login github-oidc
121
+
122
+ - name: Publish
123
+ run: ./mcp-publisher publish
@@ -0,0 +1,31 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ python-version: ["3.11", "3.12", "3.13"]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v5
23
+ with:
24
+ enable-cache: true
25
+ python-version: ${{ matrix.python-version }}
26
+
27
+ - name: Install dependencies
28
+ run: uv sync --extra dev
29
+
30
+ - name: Run tests
31
+ run: uv run --extra dev pytest -q
@@ -0,0 +1,36 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ build/
6
+ dist/
7
+
8
+ # Virtual environments
9
+ .venv/
10
+ venv/
11
+
12
+ # Tooling caches
13
+ .pytest_cache/
14
+ .ruff_cache/
15
+ .mypy_cache/
16
+ .coverage
17
+ htmlcov/
18
+
19
+ # Environment / secrets
20
+ .env
21
+ deploy/kubernetes/secret.yaml
22
+
23
+ # Lockfile — a template stays unpinned so new projects start fresh.
24
+ # Remove this line in your own server repo to commit reproducible installs.
25
+ uv.lock
26
+
27
+ # Corporate CA certificates are environment-specific — keep the directory,
28
+ # ignore its contents. Remove these lines if your CAs should be committed.
29
+ certificates/*
30
+ !certificates/README.md
31
+ !certificates/.gitkeep
32
+
33
+ # Editors / OS
34
+ .vscode/
35
+ .idea/
36
+ .DS_Store
@@ -0,0 +1,85 @@
1
+ # ============================================================
2
+ # Stage 1 – Install dependencies
3
+ # ============================================================
4
+ FROM python:3.13-slim AS builder
5
+
6
+ WORKDIR /app
7
+
8
+ # Optional corporate CA certificates.
9
+ # Drop any .crt/.pem files into certificates/ and they are added to the trust
10
+ # store automatically — no Dockerfile changes needed. The directory may be empty.
11
+ COPY certificates/ /tmp/ca-certs/
12
+ RUN set -eu; \
13
+ mkdir -p /usr/local/share/ca-certificates; \
14
+ installed=0; \
15
+ for f in /tmp/ca-certs/*.pem /tmp/ca-certs/*.crt; do \
16
+ [ -e "$f" ] || continue; \
17
+ cp "$f" "/usr/local/share/ca-certificates/$(basename "${f%.*}").crt"; \
18
+ installed=1; \
19
+ done; \
20
+ if [ "$installed" -eq 1 ]; then update-ca-certificates; fi; \
21
+ rm -rf /tmp/ca-certs
22
+
23
+ # Point SSL-aware tooling at the system bundle so builds work behind a
24
+ # TLS-intercepting proxy when certificates/ is populated.
25
+ # PIP_CERT → pip
26
+ # REQUESTS_CA_BUNDLE → requests/urllib3 (used by the hatchling build backend)
27
+ # SSL_CERT_FILE → OpenSSL-linked clients (httpx, aiohttp, …)
28
+ # CURL_CA_BUNDLE → curl / libcurl
29
+ ENV PIP_CERT=/etc/ssl/certs/ca-certificates.crt \
30
+ REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt \
31
+ SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
32
+ CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
33
+
34
+ # Create isolated virtual environment
35
+ RUN python -m venv /opt/venv
36
+ ENV PATH="/opt/venv/bin:$PATH"
37
+
38
+ # README.md too: pyproject declares it as the long description, so the build
39
+ # backend needs it present to resolve metadata.
40
+ COPY pyproject.toml README.md ./
41
+ # Minimal cisco_sdwan_mcp/ lets pip resolve PEP 517 project metadata
42
+ RUN mkdir -p cisco_sdwan_mcp && pip install --no-cache-dir .
43
+
44
+ # ============================================================
45
+ # Stage 2 – Runtime image
46
+ # ============================================================
47
+ FROM python:3.13-slim AS runtime
48
+
49
+ WORKDIR /app
50
+
51
+ # Carry the trusted CA bundle into the runtime stage so the running
52
+ # application can make outbound HTTPS calls through an intercepting proxy.
53
+ COPY --from=builder /usr/local/share/ca-certificates/ /usr/local/share/ca-certificates/
54
+ RUN update-ca-certificates
55
+
56
+ # Copy virtual-env from builder
57
+ COPY --from=builder /opt/venv /opt/venv
58
+ ENV PATH="/opt/venv/bin:$PATH"
59
+
60
+ ENV PYTHONPATH=/app \
61
+ PYTHONDONTWRITEBYTECODE=1 \
62
+ PYTHONUNBUFFERED=1 \
63
+ # Keep SSL trust working for any outbound HTTPS calls the app makes
64
+ REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt \
65
+ SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
66
+ CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
67
+
68
+ COPY README.md .
69
+ COPY cisco_sdwan_mcp/ ./cisco_sdwan_mcp/
70
+
71
+ RUN useradd --create-home --shell /bin/bash --uid 10001 appuser \
72
+ && chown -R appuser:appuser /app
73
+ # Numeric, not "appuser": with runAsNonRoot the kubelet has to prove the user
74
+ # is not root before starting the container, and it cannot resolve a username
75
+ # out of the image config. A named USER fails with CreateContainerConfigError.
76
+ USER 10001:10001
77
+
78
+ EXPOSE 8000
79
+
80
+ # Container-level health check against the unauthenticated /healthz route.
81
+ # Kubernetes ignores this (it uses its own probes); docker run / compose use it.
82
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
83
+ CMD python -c "import os,sys,urllib.request; sys.exit(0) if os.getenv('MCP_TRANSPORT','http')=='stdio' else urllib.request.urlopen('http://127.0.0.1:'+os.getenv('MCP_PORT','8000')+'/healthz', timeout=4)"
84
+
85
+ CMD ["python", "-m", "cisco_sdwan_mcp.server"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Autonetops
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.