ncloud-mcp-server 0.7.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.
@@ -0,0 +1 @@
1
+ * text=auto eol=lf
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ # Block commits that contain secrets. Requires gitleaks (https://github.com/gitleaks/gitleaks).
3
+ if ! command -v gitleaks >/dev/null 2>&1; then
4
+ echo "pre-commit: gitleaks not found. Install it, or commit is blocked." >&2
5
+ exit 1
6
+ fi
7
+ exec gitleaks git --pre-commit --staged --redact --config .gitleaks.toml --verbose
@@ -0,0 +1,20 @@
1
+ name: gitleaks
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ scan:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v7
15
+ with:
16
+ fetch-depth: 0
17
+ - uses: gitleaks/gitleaks-action@v3
18
+ env:
19
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20
+ GITLEAKS_CONFIG: .gitleaks.toml
@@ -0,0 +1,71 @@
1
+ name: tag-release
2
+
3
+ # When main gets a version that has no tag yet, tag that commit as v<version> and
4
+ # publish it to PyPI. Versions are bumped only in release PRs, so ordinary merges do nothing.
5
+ #
6
+ # Publishing lives in this file because a tag pushed with GITHUB_TOKEN does not start
7
+ # other workflows. PyPI trusts this file by name (Trusted Publishing: no API token is
8
+ # stored anywhere), so renaming it means updating the publisher on PyPI too.
9
+
10
+ on:
11
+ push:
12
+ branches: [main]
13
+
14
+ permissions:
15
+ contents: write
16
+
17
+ jobs:
18
+ tag:
19
+ runs-on: ubuntu-latest
20
+ outputs:
21
+ created: ${{ steps.create.outputs.created }}
22
+ steps:
23
+ - uses: actions/checkout@v7
24
+ with:
25
+ fetch-depth: 0
26
+
27
+ - name: Read and compare versions
28
+ id: ver
29
+ run: |
30
+ py_ver=$(python3 -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
31
+ init_ver=$(python3 -c "import re;print(re.search(r'__version__\s*=\s*\"([^\"]+)\"', open('src/ncp_mcp/__init__.py').read()).group(1))")
32
+ echo "pyproject=$py_ver __init__=$init_ver"
33
+ if [ "$py_ver" != "$init_ver" ]; then
34
+ echo "::error::version mismatch: pyproject.toml=$py_ver, src/ncp_mcp/__init__.py=$init_ver"
35
+ exit 1
36
+ fi
37
+ echo "tag=v$py_ver" >> "$GITHUB_OUTPUT"
38
+
39
+ - name: Create tag if missing
40
+ id: create
41
+ run: |
42
+ tag="${{ steps.ver.outputs.tag }}"
43
+ if git rev-parse -q --verify "refs/tags/$tag" >/dev/null; then
44
+ echo "$tag already exists ($(git rev-list -n1 "$tag")); nothing to do"
45
+ echo "created=false" >> "$GITHUB_OUTPUT"
46
+ exit 0
47
+ fi
48
+ git config user.name "github-actions[bot]"
49
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
50
+ git tag -a "$tag" -m "$tag" "$GITHUB_SHA"
51
+ git push origin "$tag"
52
+ echo "created=true" >> "$GITHUB_OUTPUT"
53
+ echo "created $tag at $GITHUB_SHA"
54
+
55
+ publish:
56
+ # Only for a version that was just tagged. If this job fails, use
57
+ # "Re-run failed jobs": the tag job's output is kept, so it publishes again.
58
+ needs: tag
59
+ if: needs.tag.outputs.created == 'true'
60
+ runs-on: ubuntu-latest
61
+ environment: pypi
62
+ permissions:
63
+ contents: read
64
+ id-token: write # Trusted Publishing to PyPI
65
+ steps:
66
+ - uses: actions/checkout@v7
67
+ - uses: astral-sh/setup-uv@v10.3.3 # no floating v10 tag since v8
68
+ - run: uv sync --locked
69
+ - run: uv run --frozen pytest -q
70
+ - run: uv build
71
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,18 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ pytest:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v7
15
+ - uses: astral-sh/setup-uv@v10.3.3 # no floating v10 tag since v8
16
+ # --locked fails the job when uv.lock is out of date with pyproject.toml
17
+ - run: uv sync --locked
18
+ - run: uv run --frozen pytest -q
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .env
9
+ .env.*
10
+ configure
11
+ *.pem
12
+ *.key
@@ -0,0 +1,22 @@
1
+ title = "ncloud-mcp-server gitleaks config"
2
+
3
+ [extend]
4
+ useDefault = true
5
+
6
+ [[rules]]
7
+ id = "ncloud-configure-secret"
8
+ description = "Ncloud CLI configure secret key"
9
+ regex = '''(?i)ncloud_secret_access_key\s*=\s*['"]?([A-Za-z0-9/+_\-]{20,})'''
10
+ secretGroup = 1
11
+
12
+ [[rules]]
13
+ id = "ncloud-env-secret"
14
+ description = "Ncloud secret key in env/config"
15
+ regex = '''(?i)NCLOUD_SECRET_KEY["']?\s*[:=]\s*['"]?([A-Za-z0-9/+_\-]{20,})'''
16
+ secretGroup = 1
17
+
18
+ [[rules]]
19
+ id = "ncloud-access-key"
20
+ description = "Ncloud access key id assignment"
21
+ regex = '''(?i)(?:ncloud_access_key_id|NCLOUD_ACCESS_KEY)["']?\s*[:=]\s*['"]?([A-Za-z0-9_]{20,})'''
22
+ secretGroup = 1
@@ -0,0 +1,140 @@
1
+ # Changelog
2
+
3
+ All notable changes to ncloud-mcp-server (formerly ncp-mcp) are listed here, newest first.
4
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
+ While the version is 0.x, a new minor version (0.x → 0.(x+1)) may need changes in
6
+ your configuration. Those entries are marked **Breaking**.
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.7.0] - 2026-11-19
11
+
12
+ ### Changed
13
+ - **Breaking:** the package and its command are renamed from `ncp-mcp` to `ncloud-mcp-server`.
14
+ The Python module stays `ncp_mcp`.
15
+ - **Breaking:** `ncp_call` and `ncp_batch` are merged into one read tool, `ncp_read`. It takes
16
+ `calls`, a list of 1 to 50 items with the same keys as before (`service`, `action`, and
17
+ optionally `params`, `fields`, `paginate`, `profile`), and always returns
18
+ `{count, failed, results}`. A single call gets the whole result budget.
19
+ Tools are now split only by effect (read or write), which is how MCP clients grant permissions.
20
+ To migrate:
21
+ - `ncp_call(service=..., action=..., ...)` becomes `ncp_read(calls=[{"service": ..., "action": ..., ...}])`.
22
+ - `ncp_batch(calls=[...])` becomes `ncp_read(calls=[...])`.
23
+ - In client permission settings, replace `mcp__<name>__ncp_call` and `mcp__<name>__ncp_batch`
24
+ with `mcp__<name>__ncp_read`, where `<name>` is the name you registered (Claude Code naming; other clients differ).
25
+
26
+ ### Added
27
+ - Releases are published to PyPI as `ncloud-mcp-server` by the `tag-release` workflow
28
+ (Trusted Publishing, no API token).
29
+ - README: one-line install for Claude Code (`claude mcp add ... --scope user`) with the scope options.
30
+ - `CHANGELOG.md`, and a release step in `CONTRIBUTING.md` to keep it updated.
31
+
32
+ ### Fixed
33
+ - The credential config is read once per `ncp_read` request instead of once per item.
34
+ Before, a 50-call `ncp_batch` read `~/.ncloud/configure` 50 times, and an edit made while it
35
+ ran could give its items different profiles. Each request still reads the config, so key
36
+ changes apply without a restart.
37
+
38
+ ## [0.6.0] - 2026-11-19
39
+
40
+ ### Added
41
+ - Result size cap: `NCP_MCP_MAX_RESULT_CHARS` (default 100,000 characters of JSON).
42
+ List responses keep the leading items that fit, other responses become cut JSON text.
43
+ `truncated` says why and suggests `fields`. `ncp_batch` splits the budget across its
44
+ calls (at least 5,000 each).
45
+ - `CONTRIBUTING.md`: setup, how the guard is verified, how to refresh the SDK snapshot,
46
+ the NCP API facts the code relies on, and the release steps.
47
+ - `tests/data/ncp_sdk_apis.txt` (676 APIs from the official Go SDK), `scripts/refresh_sdk_apis.sh`,
48
+ and tests that every read passes, every write and state-changing GET is blocked, and the
49
+ list of credential-returning reads is exact.
50
+
51
+ ### Changed
52
+ - **Breaking:** `NCP_WRITE_ALLOWLIST` entries take an optional method: `METHOD service:action`.
53
+ Without a method only GET is allowed, so allowing POST on a REST path no longer allows
54
+ DELETE on it. REST entries that were used with POST/PUT/DELETE must now name the method.
55
+ The block message shows the entry to add.
56
+ - Shared-gateway actions accept GET and POST alike (checked against the API docs and the SDK),
57
+ so an entry such as `vserver:stopServerInstances` allows both. REST services keep distinct methods.
58
+ - Paging parameters (`pageNo`, `pageSize`, `page`, `size`) are validated before any request.
59
+ A bad value gives a clear error instead of "internal error".
60
+
61
+ ### Fixed
62
+ - `paginate` must be a JSON boolean. `ncp_batch` treated the string `"false"` as true.
63
+ - `GET /timeZone` (sourcepipeline, vsourcepipeline) is a read but was blocked because
64
+ "time" looked like a verb.
65
+
66
+ ## [0.5.0] - 2026-11-19
67
+
68
+ ### Added
69
+ - `README.en.md` and language links between the two READMEs.
70
+
71
+ ### Changed
72
+ - **Security:** deny-by-default read-only guard. A shared-gateway action counts as read-only
73
+ only when it is a single verb-first camelCase segment with a read verb. Lowercase, PascalCase
74
+ or nested variants (`terminateserverinstances`, `TerminateServerInstances`,
75
+ `terminateServerInstances/x`) were classified as reads before and are now treated as writes.
76
+ - **Security:** a REST-style path is a write if any segment, not only the last one, starts
77
+ with a non-read verb. vcdss and vses change state over GET (`restartKafkaService`,
78
+ `stopDataImportJob`, ...), which the old last-segment rule let through `ncp_call`.
79
+ - `getRootPassword`, `getRootPasswordServerInstanceList` and the NKS `kubeconfig` return
80
+ credentials. `ncp_call` and `ncp_batch` refuse them. They can be called only through
81
+ `ncp_write` with an `NCP_WRITE_ALLOWLIST` entry.
82
+
83
+ ## [0.4.0] - 2026-11-19
84
+
85
+ ### Added
86
+ - Per-zone service allowlist built from the official NCP API docs and SDK
87
+ (government Sub Account uses `/api/v2`, financial billing has its own host, STS is public zone only).
88
+ - `ncp_write` also needs an `NCP_WRITE_ALLOWLIST` `service:action` entry.
89
+ - Read-only calls retry on 429, 5xx and timeouts with backoff and `Retry-After`.
90
+ Writes are never retried and report an unknown outcome on timeout.
91
+ - Process-wide concurrency limit, configurable timeout and retries.
92
+ - Input validation and per-item isolation in `ncp_batch`.
93
+ - Mocked-transport tests (45 at the time).
94
+ - `tag-release` workflow: tags `main` as `v<version>` when the tag is missing.
95
+
96
+ ### Fixed
97
+ - Paging follows verified rules: `pageNo` 0 and 1 both mean the first page, and with `pageNo`
98
+ the `totalRows` is the page count. Lists are refetched page by page and `paging.complete`
99
+ is reported. Sub Account v1 uses `hasNext` paging.
100
+ - An incomplete first page is reported for other list shapes (`totalElements` etc.).
101
+
102
+ ## [0.3.0] - 2026-11-19
103
+
104
+ No git tag exists for this version.
105
+
106
+ ### Changed
107
+ - **Breaking:** profiles need an explicit `ncloud_zone` and a name ending with `-<zone>`.
108
+ Profiles that break the rules are disabled and reported in `ncp_profiles`.
109
+ - **Breaking:** `profile` is required when more than one profile exists. There is no default profile.
110
+ - Valid profile names are fixed into the tool schema at startup.
111
+
112
+ ### Added
113
+ - `ncp_profiles(verify=true)` shows which account and user a key belongs to (STS `caller-identity`).
114
+
115
+ ## [0.2.0] - 2026-11-19
116
+
117
+ ### Changed
118
+ - **Breaking:** `ncp_call` and `ncp_batch` are read-only. Changes go through `ncp_write`,
119
+ which is registered only when the server starts with `NCP_ALLOW_WRITE=true`.
120
+
121
+ ### Added
122
+ - MCP tool annotations (`readOnlyHint`, `destructiveHint`).
123
+ - `fields` option keeps only the selected keys of list items (dot paths).
124
+
125
+ ## [0.1.0] - 2026-11-19
126
+
127
+ ### Added
128
+ - First release: `ncp_profiles`, `ncp_call` and `ncp_batch`.
129
+ - Signature v2 (HMAC-SHA256) and `~/.ncloud/configure` profiles for the public, government and financial zones.
130
+ - Read-only by default, decided by action name. `NCP_ALLOW_WRITE` enables writes.
131
+ - Automatic paging and a gateway host allowlist.
132
+ - gitleaks pre-commit hook and GitHub Actions (gitleaks, pytest).
133
+
134
+ [Unreleased]: https://github.com/revert12/ncloud-mcp-server/compare/v0.7.0...HEAD
135
+ [0.7.0]: https://github.com/revert12/ncloud-mcp-server/compare/v0.6.0...v0.7.0
136
+ [0.6.0]: https://github.com/revert12/ncloud-mcp-server/compare/v0.5.0...v0.6.0
137
+ [0.5.0]: https://github.com/revert12/ncloud-mcp-server/compare/v0.4.0...v0.5.0
138
+ [0.4.0]: https://github.com/revert12/ncloud-mcp-server/compare/v0.2.0...v0.4.0
139
+ [0.2.0]: https://github.com/revert12/ncloud-mcp-server/compare/v0.1.0...v0.2.0
140
+ [0.1.0]: https://github.com/revert12/ncloud-mcp-server/releases/tag/v0.1.0
@@ -0,0 +1,90 @@
1
+ # Contributing
2
+
3
+ Issues and pull requests are welcome. Issues may be written in Korean or English.
4
+
5
+ ## Setup
6
+
7
+ Requires Python 3.10+ and [uv](https://docs.astral.sh/uv/) 0.13 or newer
8
+ (`uv.lock` uses the 0.13 lockfile format; older uv refuses to run, see `[tool.uv]` in `pyproject.toml`).
9
+
10
+ ```sh
11
+ uv sync
12
+ uv run pytest
13
+ git config core.hooksPath .githooks # run the gitleaks secret scan before each commit
14
+ ```
15
+
16
+ The pre-commit hook needs [gitleaks](https://github.com/gitleaks/gitleaks) on your `PATH`
17
+ (e.g. `winget install Gitleaks.Gitleaks`, `brew install gitleaks`); without it, commits are blocked.
18
+ CI runs gitleaks and `uv sync --locked` too, so a stale `uv.lock` fails the build.
19
+
20
+ ## Read-only guard: how it is verified
21
+
22
+ `ncp_read` must never change anything, so `src/ncp_mcp/guard.py` only lets
23
+ through actions that are **proven** read-only. Read its module docstring first; in short:
24
+
25
+ - Shared-gateway services (`/<service>/v2/<action>`): a read is one camelCase segment
26
+ starting with a read verb (`getServerInstanceList`). The gateway takes GET and POST alike.
27
+ - REST-style services: a write if any path segment starts with a non-read verb.
28
+ Some of these change state over GET (e.g. `vcdss /cluster/restartKafkaService/{id}`).
29
+ - Reads that return credentials (`getRootPassword`, NKS `kubeconfig`) are blocked too.
30
+
31
+ These rules are checked against **every API in the official SDK**:
32
+
33
+ | File | Purpose |
34
+ |---|---|
35
+ | `tests/data/ncp_sdk_apis.txt` | Snapshot of all APIs in [ncloud-sdk-go-v2](https://github.com/NaverCloudPlatform/ncloud-sdk-go-v2) (service, method, path) |
36
+ | `tests/test_sdk_apis.py` | Every read passes, every write and state-changing GET is blocked, the credential list is exact |
37
+ | `scripts/refresh_sdk_apis.sh` | Rebuilds the snapshot from the latest SDK |
38
+
39
+ ### Refreshing the SDK snapshot
40
+
41
+ Do this when NCP adds services or APIs, or before a release that touches the guard.
42
+
43
+ ```sh
44
+ sh scripts/refresh_sdk_apis.sh # Git Bash on Windows
45
+ uv run pytest tests/test_sdk_apis.py
46
+ ```
47
+
48
+ If tests fail, decide for each API named in the failure:
49
+
50
+ | The API... | Then |
51
+ |---|---|
52
+ | is a read the guard blocks | fix `guard.py` (e.g. add the noun to `NOUN_SEGMENTS`), or add it to `BLOCKED_READS` if blocking it is intended |
53
+ | changes state over GET | add it to `STATE_CHANGING_GETS` (the guard should already block it) |
54
+ | returns secrets | add its segment to `guard.SENSITIVE` and the pair to `SENSITIVE` in the test |
55
+ | belongs to a new service | add the service to `src/ncp_mcp/endpoints.py` with its documented endpoint |
56
+
57
+ Commit the refreshed snapshot together with these changes.
58
+
59
+ ### Not covered by the snapshot
60
+
61
+ The SDK does not include `billing`, `subaccount`, `sts`, or the government (`gov`) and
62
+ financial (`fin`) zone endpoints. Changes to those need a check against the API docs
63
+ ([api.ncloud-docs.com](https://api.ncloud-docs.com/docs/en/home)); cite the page in the PR.
64
+
65
+ ## NCP API facts this code relies on
66
+
67
+ Checked against the API docs. When one of them turns out to be wrong, fix the code and this table.
68
+
69
+ | Fact | Source |
70
+ |---|---|
71
+ | Shared-gateway v2 actions accept both GET and POST, reads and writes alike | [getServerInstanceList](https://api.ncloud-docs.com/docs/en/compute-vserver-server-getserverinstancelist), [stopServerInstances](https://api.ncloud-docs.com/docs/compute-vserver-server-stopserverinstances): method `GET \| POST` |
72
+ | `pageNo` is 0–N, and 0 and 1 both mean the first page; `pageSize` is 1–1000 and required with `pageNo` | getServerInstanceList request parameters |
73
+ | `totalRows` is the total count; without `pageNo` the whole list is returned (live calls show it counts only the page when `pageNo` is given) | [ServerInstanceList type](https://api.ncloud-docs.com/docs/en/common-vapidatatype-serverinstancelist); see the `client.py` docstring |
74
+ | Sub Account v1 list: `page` starts at 0, `size` is 1–N (default 10); the response has `items`, `hasNext`, `totalItems` | [Get sub account list](https://api.ncloud-docs.com/docs/en/management-subaccount-getsubaccounts) |
75
+
76
+ ## Releases
77
+
78
+ Bump the version in both `pyproject.toml` and `src/ncp_mcp/__init__.py`, run `uv lock`,
79
+ update the install tag in `README.md` and `README.ko.md`, and move the `[Unreleased]` entries
80
+ of `CHANGELOG.md` under the new version with its date (mark changes that need a configuration
81
+ change as **Breaking**). After the PR is merged,
82
+ the `tag-release` workflow (`.github/workflows/tag.yml`) tags `main` as `v<version>`,
83
+ runs the tests again, builds the package and publishes it to PyPI as `ncloud-mcp-server`.
84
+ Publishing uses PyPI Trusted Publishing (no API token): PyPI trusts repository
85
+ `revert12/ncloud-mcp-server`, workflow `tag.yml`. If you rename the repository or the
86
+ workflow file, update the publisher on PyPI first. A version number can be uploaded only
87
+ once, even after deleting it, so a broken release is fixed with a new version.
88
+
89
+ Use a new minor version (0.x → 0.(x+1)) when users must change their configuration,
90
+ for example the format of `NCP_WRITE_ALLOWLIST`.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ncloud-mcp-server contributors
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.
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.5
2
+ Name: ncloud-mcp-server
3
+ Version: 0.7.0
4
+ Summary: Lightweight MCP server for NAVER Cloud Platform (Ncloud): a few signed generic tools instead of one tool per API.
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.10
8
+ Requires-Dist: httpx>=0.27
9
+ Requires-Dist: mcp<3,>=2.0
10
+ Description-Content-Type: text/markdown
11
+
12
+ # ncloud-mcp-server
13
+
14
+ [한국어](https://github.com/revert12/ncloud-mcp-server/blob/main/README.ko.md) | **English**
15
+
16
+ A lightweight MCP server for NAVER Cloud Platform (Ncloud).
17
+
18
+ Instead of one tool per API, a **few signed, generic call tools** reach every Ncloud API.
19
+ The tool definitions are small, so connecting the server costs almost no conversation context.
20
+
21
+ > This is not an official NAVER Cloud project.
22
+
23
+ ## Tools
24
+
25
+ | Tool | Description |
26
+ |---|---|
27
+ | `ncp_profiles` | Usable profiles and zones, profiles disabled by the rules (with the reason), and whether writes are enabled. With `verify=true`, shows who owns each key (account ID, login alias, main/sub account). Secrets are never returned |
28
+ | `ncp_read` | 1 to 50 **read-only** API calls, run 5 at a time. Handles signing, `responseFormatType=json`, list parameter expansion, automatic paging, and `fields` to return only the fields you need. A failed item does not affect the others |
29
+ | `ncp_write` | Calls APIs that create, change or delete resources. **Registered only when the server runs with `NCP_ALLOW_WRITE=true`** |
30
+
31
+ ```jsonc
32
+ // Server list (only the fields you need)
33
+ ncp_read(calls=[{"service": "vserver", "action": "getServerInstanceList", "params": {"regionCode": "KR"},
34
+ "fields": ["serverName", "serverInstanceStatus.code", "privateIp"]}])
35
+
36
+ // Sub accounts (REST-style service)
37
+ ncp_read(calls=[{"service": "subaccount", "action": "/sub-accounts"}])
38
+
39
+ // Several regions at once
40
+ ncp_read(calls=[
41
+ {"service": "vserver", "action": "getServerInstanceList", "params": {"regionCode": "KR"}},
42
+ {"service": "vserver", "action": "getServerInstanceList", "params": {"regionCode": "JPN"}}
43
+ ])
44
+ ```
45
+
46
+ ## Safety
47
+
48
+ - **Reads and writes are separate tools.** `ncp_read` accepts only read actions such as
49
+ `get*`, `list*` and `describe*`, plus REST-style GETs. Ncloud's shared API gateway accepts even
50
+ delete actions over GET, so operations are classified by **action name**, not by HTTP method.
51
+ - Only actions **proven read-only** are allowed. On shared-gateway services an action counts as a read
52
+ only if it is a single path segment in camelCase starting with a read verb (`getServerInstanceList`).
53
+ Anything else, such as `terminateserverinstances`, `TerminateServerInstances` or
54
+ `terminateServerInstances/x`, is treated as a write and blocked.
55
+ - **Read actions that return secrets** (`getRootPassword`, `getRootPasswordServerInstanceList`, the NKS
56
+ `kubeconfig`) are blocked in `ncp_read`. If you really need one, add it to
57
+ `NCP_WRITE_ALLOWLIST` and call it with `ncp_write`.
58
+ - Writes are possible only through `ncp_write`, which appears only when the server runs with
59
+ `NCP_ALLOW_WRITE=true`. Each action must also be listed in `NCP_WRITE_ALLOWLIST` (comma separated).
60
+ Write requests are never retried.
61
+ - For shared-gateway services, write `vserver:stopServerInstances`. The shared gateway takes
62
+ GET and POST as the same call, so both are allowed.
63
+ - For REST-style services, put the method first: `POST subaccount:/sub-accounts`,
64
+ `DELETE subaccount:/sub-accounts/123`. An entry without a method allows GET only,
65
+ and allowing POST on a path does not allow DELETE on it.
66
+ - If you used an entry like `subaccount:/sub-accounts` for POST with 0.5.x or earlier, add the method.
67
+ - Callable services are limited to a per-zone allowlist (`src/ncp_mcp/endpoints.py`, based on the official
68
+ NCP API docs). To use a service that is not listed, add it explicitly, e.g. `NCP_MCP_EXTRA_SERVICES="gov:cdn"`.
69
+ - Read requests are retried up to 2 times on 429, 5xx and timeouts (`NCP_MCP_RETRIES`), and concurrent
70
+ requests are limited to 5 (`NCP_MCP_CONCURRENCY`).
71
+ - A single result is capped at 100,000 characters of JSON, about 25,000 tokens (`NCP_MCP_MAX_RESULT_CHARS`).
72
+ Beyond that, only the first list items are kept and `truncated` explains why. With several calls, `ncp_read` splits this
73
+ budget across them. If a result was cut, use `fields` to keep only the columns you need, or narrow the query.
74
+ - Every tool carries the standard MCP hints (`readOnlyHint` / `destructiveHint`). In your client's
75
+ permission settings we recommend **allowing `ncp_read`, and asking every time for `ncp_write`**.
76
+ (Claude Code example: `mcp__ncloud__ncp_read` in `permissions.allow`, `mcp__ncloud__ncp_write` in `permissions.ask`)
77
+ - Signed requests are sent only to the selected zone's API gateway domains (`*.apigw.ntruss.com` etc.).
78
+ - Keys never appear in error messages or results. The final permission boundary is the sub-account
79
+ permissions of the access key, so we recommend **a sub-account key with read-only permissions**.
80
+
81
+ ## Installation
82
+
83
+ Requires Python 3.10+ and [uv](https://docs.astral.sh/uv/).
84
+
85
+ **Claude Code**: register it with one command.
86
+
87
+ ```sh
88
+ claude mcp add ncloud --scope user -- uvx --from git+https://github.com/revert12/ncloud-mcp-server@v0.7.0 ncloud-mcp-server
89
+ ```
90
+
91
+ `--scope` picks where it is registered.
92
+ - `local` (default): only you, only in the current project (stored in `~/.claude.json`)
93
+ - `user`: only you, in every project
94
+ - `project`: stored in `.mcp.json` at the project root and shared with your team
95
+
96
+ Check with `claude mcp list`; remove with `claude mcp remove ncloud`.
97
+
98
+ **Other MCP clients**: add it to the config file directly.
99
+
100
+ ```jsonc
101
+ // .mcp.json
102
+ {
103
+ "mcpServers": {
104
+ "ncloud": {
105
+ "command": "uvx",
106
+ "args": ["--from", "git+https://github.com/revert12/ncloud-mcp-server@v0.7.0", "ncloud-mcp-server"]
107
+ }
108
+ }
109
+ }
110
+ ```
111
+
112
+ Pinning a version with a tag is recommended.
113
+
114
+ ## Credentials
115
+
116
+ The server reads `~/.ncloud/configure` (INI), the same file the Ncloud CLI uses. Each section is one profile.
117
+
118
+ ```ini
119
+ [mycompany-pub]
120
+ ncloud_access_key_id = <access key>
121
+ ncloud_secret_access_key = <secret key>
122
+ ncloud_zone = pub
123
+
124
+ [customer-a-gov]
125
+ ncloud_access_key_id = <gov access key>
126
+ ncloud_secret_access_key = <gov secret key>
127
+ ncloud_zone = gov
128
+ ```
129
+
130
+ **Profile rules** (a profile that breaks one is not used; `ncp_profiles` lists it under `disabled` with the reason)
131
+ - `ncloud_zone` (`pub`, `gov` or `fin`) is required.
132
+ - Profile names use lowercase letters, digits and hyphens, and **must end with the zone** (`-pub`, `-gov`, `-fin`),
133
+ so the zone is visible from the name alone. For the same reason `[DEFAULT]` cannot be used.
134
+ - With two or more profiles, every call must name its `profile`. There is no default profile.
135
+ - Usable profile names are written into the tool definitions as choices when the server starts.
136
+ Restart the MCP server after changing profiles.
137
+ - `ncp_profiles(verify=true)` asks STS (`caller-identity`) which NCP account and user each key really belongs to.
138
+
139
+ The Ncloud CLI can use the same profiles with `--profile <name>`.
140
+
141
+ - Setting the environment variables `NCLOUD_ACCESS_KEY`, `NCLOUD_SECRET_KEY` and `NCLOUD_ZONE` adds an `env-<zone>` profile.
142
+ - `NCP_MCP_CONFIG` changes the location of the config file.
143
+
144
+ ## Service endpoints
145
+
146
+ | Service | Endpoint |
147
+ |---|---|
148
+ | Default (shared gateway) | `https://ncloud.apigw.<zone>/<service>/v2/<action>` |
149
+ | `billing` | `https://billingapi.apigw.<zone>/billing/v1` |
150
+ | `subaccount` | `https://subaccount.apigw.<zone>/api/v1` |
151
+ | `sts` | `https://sts.apigw.<zone>/api/v1` |
152
+ | `vnks`, `vses`, `vcdss`, `source*`, etc. | See `SPECIAL` in `src/ncp_mcp/endpoints.py` |
153
+
154
+ `<zone>` is `ntruss.com` (public), `gov-ntruss.com` (government) or `fin-ntruss.com` (financial).
155
+
156
+ ## Development
157
+
158
+ ```sh
159
+ uv sync
160
+ uv run pytest
161
+ ```
162
+
163
+ See [CONTRIBUTING.md](https://github.com/revert12/ncloud-mcp-server/blob/main/CONTRIBUTING.md) for setup, the pre-commit secret scan, and how the read-only guard is verified.
164
+
165
+ ## License
166
+
167
+ MIT