mcpcheck-cli 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 (31) hide show
  1. mcpcheck_cli-0.1.0/LICENSE +21 -0
  2. mcpcheck_cli-0.1.0/PKG-INFO +167 -0
  3. mcpcheck_cli-0.1.0/README.md +153 -0
  4. mcpcheck_cli-0.1.0/pyproject.toml +35 -0
  5. mcpcheck_cli-0.1.0/setup.cfg +4 -0
  6. mcpcheck_cli-0.1.0/src/mcpcheck/__init__.py +3 -0
  7. mcpcheck_cli-0.1.0/src/mcpcheck/cli.py +404 -0
  8. mcpcheck_cli-0.1.0/src/mcpcheck/config.py +183 -0
  9. mcpcheck_cli-0.1.0/src/mcpcheck/doctor.py +245 -0
  10. mcpcheck_cli-0.1.0/src/mcpcheck/lockfile.py +138 -0
  11. mcpcheck_cli-0.1.0/src/mcpcheck/probe.py +170 -0
  12. mcpcheck_cli-0.1.0/src/mcpcheck/protocol.py +303 -0
  13. mcpcheck_cli-0.1.0/src/mcpcheck_cli.egg-info/PKG-INFO +167 -0
  14. mcpcheck_cli-0.1.0/src/mcpcheck_cli.egg-info/SOURCES.txt +29 -0
  15. mcpcheck_cli-0.1.0/src/mcpcheck_cli.egg-info/dependency_links.txt +1 -0
  16. mcpcheck_cli-0.1.0/src/mcpcheck_cli.egg-info/entry_points.txt +2 -0
  17. mcpcheck_cli-0.1.0/src/mcpcheck_cli.egg-info/requires.txt +6 -0
  18. mcpcheck_cli-0.1.0/src/mcpcheck_cli.egg-info/top_level.txt +1 -0
  19. mcpcheck_cli-0.1.0/tests/test_cli_config.py +108 -0
  20. mcpcheck_cli-0.1.0/tests/test_cli_doctor.py +178 -0
  21. mcpcheck_cli-0.1.0/tests/test_cli_lock.py +245 -0
  22. mcpcheck_cli-0.1.0/tests/test_cli_probe.py +150 -0
  23. mcpcheck_cli-0.1.0/tests/test_discover.py +96 -0
  24. mcpcheck_cli-0.1.0/tests/test_doctor.py +247 -0
  25. mcpcheck_cli-0.1.0/tests/test_expand_env.py +46 -0
  26. mcpcheck_cli-0.1.0/tests/test_lockfile.py +172 -0
  27. mcpcheck_cli-0.1.0/tests/test_probe.py +285 -0
  28. mcpcheck_cli-0.1.0/tests/test_protocol.py +226 -0
  29. mcpcheck_cli-0.1.0/tests/test_readme.py +87 -0
  30. mcpcheck_cli-0.1.0/tests/test_validate.py +152 -0
  31. mcpcheck_cli-0.1.0/tests/test_version.py +28 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Matrinus
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.4
2
+ Name: mcpcheck-cli
3
+ Version: 0.1.0
4
+ Summary: MCP server configuration probe
5
+ Requires-Python: >=3.11
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Provides-Extra: dev
9
+ Requires-Dist: pytest; extra == "dev"
10
+ Requires-Dist: pytest-cov; extra == "dev"
11
+ Requires-Dist: ruff; extra == "dev"
12
+ Requires-Dist: pyright; extra == "dev"
13
+ Dynamic: license-file
14
+
15
+ # mcpcheck
16
+
17
+ Diagnose and lock your MCP setup: validate configs, probe servers over stdio, and
18
+ diff tool schemas in CI so your agent does not silently gain or lose abilities.
19
+
20
+ [![CI](https://github.com/Matrinus/mcpcheck/actions/workflows/ci.yml/badge.svg)](https://github.com/Matrinus/mcpcheck/actions/workflows/ci.yml)
21
+ [![GitHub Action](https://img.shields.io/badge/GitHub%20Action-mcpcheck-blue?logo=githubactions&logoColor=white)](action.yml)
22
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
23
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](pyproject.toml)
24
+
25
+ **Status: v0.1.0**
26
+
27
+ ## Demo
28
+
29
+ ```text
30
+ # demo: two fixture servers (ok.py, evil.py) in a temporary directory
31
+
32
+ $ mcpcheck config --config mcp.json
33
+ mcp.json (claude)
34
+ fs: stdio
35
+ risky: stdio
36
+
37
+ $ mcpcheck probe --config mcp.json
38
+ name status startup tools
39
+ fs ok 11ms 2
40
+ risky ok 11ms 1
41
+
42
+ $ mcpcheck lock --config mcp.json -o mcp.lock.json
43
+ wrote mcp.lock.json
44
+
45
+ $ mcpcheck verify --config mcp.json --lock mcp.lock.json
46
+ no changes
47
+
48
+ $ mcpcheck verify --config mcp-v2.json --lock mcp.lock.json
49
+ ~ fs.echo
50
+ 0 added, 0 removed, 1 changed
51
+
52
+ $ mcpcheck doctor --config mcp.json --security
53
+ info DOC006 risky.exec_shell (mcp.json): tool name looks like it executes or writes: exec_shell
54
+ hint: Disable this tool for untrusted models or scope what it can reach. Treat this as a signal, not a verdict: heuristic, review manually.
55
+ info DOC007 risky.exec_shell (mcp.json): description contains "ignore previous": exec_shell
56
+ hint: Inspect the description and consider pinning the server version. Treat this as a signal, not a verdict: heuristic, review manually.
57
+ 0 errors, 0 warnings, 2 info
58
+
59
+ all 6 steps behaved as expected
60
+ ```
61
+
62
+ The transcript above is the output of [`demo.sh`](demo.sh) on the fixture servers:
63
+ config and probe see both servers, the lock matches, a changed schema turns
64
+ `verify` red, and `doctor --security` flags the risky tool as info only.
65
+
66
+ ## Install
67
+
68
+ ```bash
69
+ # from source, works today
70
+ pipx install git+https://github.com/Matrinus/mcpcheck
71
+ pip install git+https://github.com/Matrinus/mcpcheck
72
+
73
+ # from PyPI, once 0.1.0 is published (the distribution is mcpcheck-cli, the command is mcpcheck)
74
+ pipx install mcpcheck-cli
75
+ ```
76
+
77
+ `pipx` keeps the CLI in its own environment (recommended); `pip` installs it into
78
+ the current one. Python 3.11 or newer.
79
+
80
+ ## Quickstart
81
+
82
+ ```bash
83
+ mcpcheck config --config mcp.json # validate the config and resolve ${VAR}
84
+ mcpcheck probe --config mcp.json # start each server and read its tools
85
+ mcpcheck lock --config mcp.json -o mcp.lock.json # record schemas in a lockfile
86
+ mcpcheck verify --config mcp.json --lock mcp.lock.json # compare live tools with the lock
87
+ mcpcheck doctor --config mcp.json --security # aggregate findings and security hints
88
+ ```
89
+
90
+ ## What it does
91
+
92
+ | command | returns | exit code |
93
+ | -------- | ----------------------------------------------------------------------- | --------- |
94
+ | `config` | discovered/validated configs, resolved env, config errors | 0, 1, 2 |
95
+ | `probe` | per-server status, startup ms, tools, schema hashes, resources | 0, 1, 2 |
96
+ | `lock` | writes `mcp.lock.json` for servers that answered | 0, 2, 3 |
97
+ | `verify` | added / removed / changed tools versus the lockfile | 0, 1, 2, 3 |
98
+ | `doctor` | findings `DOC001`–`DOC009` with severity and an actionable hint | 0, 1, 2 |
99
+
100
+ `--json` is available on every command and is byte-stable across runs: no
101
+ timestamps, sorted keys. The only exception is `startup_ms` in `probe`, which
102
+ measures real process startup.
103
+
104
+ ## How it works
105
+
106
+ `mcpcheck` speaks JSON-RPC over stdio itself: one JSON message per line,
107
+ `initialize` + `notifications/initialized`, a deadline on every read, and a
108
+ process-group kill on timeout or close. It then sends `tools/list` (following
109
+ `nextCursor`) and `resources/list`. Each tool is hashed as the SHA-256 of its
110
+ canonical JSON schema with sorted keys, so a new parameter changes the hash while
111
+ reformatting the config does not. Environment values are expanded and handed to
112
+ the child process, but never serialized: `--json` carries only `env_keys`, so
113
+ secrets stay out of logs and CI output.
114
+
115
+ ## What it does not do
116
+
117
+ - HTTP/SSE transports — remote servers are reported as `unsupported` (v0.2).
118
+ - OAuth or any interactive auth; a server that needs a browser cannot be probed.
119
+ - Tools are never called, so it cannot tell you whether a tool *works*.
120
+ - The `--security` checks are heuristics on names and descriptions, not an audit.
121
+ - Linux and macOS only in v0.1.
122
+
123
+ ## Exit codes
124
+
125
+ | code | meaning |
126
+ | ---- | ------------------------------------------------------------------------- |
127
+ | 0 | success; changes outside the `--fail-on` policy are still printed |
128
+ | 1 | config errors, unreachable servers, findings (with `--strict` also warns), or changes inside the policy |
129
+ | 2 | usage error, unreadable or invalid config/lockfile |
130
+ | 3 | a server did not respond during `lock`/`verify`, so nothing was compared |
131
+
132
+ ## Use as a GitHub Action
133
+
134
+ The composite action installs its own Python 3.12 and runs `mcpcheck verify`,
135
+ failing the job on changes inside `fail-on` (`any` by default):
136
+
137
+ ```yaml
138
+ - uses: actions/checkout@v4
139
+ - uses: Matrinus/mcpcheck@v0.1.0
140
+ with:
141
+ config: .mcp.json
142
+ lock: mcp.lock.json
143
+ fail-on: any
144
+ ```
145
+
146
+ Inputs: `config` (default `.mcp.json`), `lock` (default `mcp.lock.json`),
147
+ `fail-on` (`any`, `added`, `removed` or `changed`) and `timeout` in seconds
148
+ (default `5`). Pin the tag to the version of `mcpcheck` that wrote the lockfile;
149
+ see [`action.yml`](action.yml) for the full definition.
150
+
151
+ ## Roadmap
152
+
153
+ - **v0.2** — HTTP/SSE transports, `--watch`, pre-commit hook.
154
+ - **v0.3** — per-project policy (`policy.yaml`), SARIF export for code scanning.
155
+ - **v0.4** — compare two machines: what one has that the other does not.
156
+
157
+ See [`docs/design.md`](docs/design.md) for the decisions behind v0.1.
158
+
159
+ ## Contributing
160
+
161
+ See [CONTRIBUTING.md](CONTRIBUTING.md). New config formats and new doctor rules
162
+ are designed to be small, self-contained contributions; `make check` must pass
163
+ and `bash demo.sh` must stay green.
164
+
165
+ ## License
166
+
167
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,153 @@
1
+ # mcpcheck
2
+
3
+ Diagnose and lock your MCP setup: validate configs, probe servers over stdio, and
4
+ diff tool schemas in CI so your agent does not silently gain or lose abilities.
5
+
6
+ [![CI](https://github.com/Matrinus/mcpcheck/actions/workflows/ci.yml/badge.svg)](https://github.com/Matrinus/mcpcheck/actions/workflows/ci.yml)
7
+ [![GitHub Action](https://img.shields.io/badge/GitHub%20Action-mcpcheck-blue?logo=githubactions&logoColor=white)](action.yml)
8
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](pyproject.toml)
10
+
11
+ **Status: v0.1.0**
12
+
13
+ ## Demo
14
+
15
+ ```text
16
+ # demo: two fixture servers (ok.py, evil.py) in a temporary directory
17
+
18
+ $ mcpcheck config --config mcp.json
19
+ mcp.json (claude)
20
+ fs: stdio
21
+ risky: stdio
22
+
23
+ $ mcpcheck probe --config mcp.json
24
+ name status startup tools
25
+ fs ok 11ms 2
26
+ risky ok 11ms 1
27
+
28
+ $ mcpcheck lock --config mcp.json -o mcp.lock.json
29
+ wrote mcp.lock.json
30
+
31
+ $ mcpcheck verify --config mcp.json --lock mcp.lock.json
32
+ no changes
33
+
34
+ $ mcpcheck verify --config mcp-v2.json --lock mcp.lock.json
35
+ ~ fs.echo
36
+ 0 added, 0 removed, 1 changed
37
+
38
+ $ mcpcheck doctor --config mcp.json --security
39
+ info DOC006 risky.exec_shell (mcp.json): tool name looks like it executes or writes: exec_shell
40
+ hint: Disable this tool for untrusted models or scope what it can reach. Treat this as a signal, not a verdict: heuristic, review manually.
41
+ info DOC007 risky.exec_shell (mcp.json): description contains "ignore previous": exec_shell
42
+ hint: Inspect the description and consider pinning the server version. Treat this as a signal, not a verdict: heuristic, review manually.
43
+ 0 errors, 0 warnings, 2 info
44
+
45
+ all 6 steps behaved as expected
46
+ ```
47
+
48
+ The transcript above is the output of [`demo.sh`](demo.sh) on the fixture servers:
49
+ config and probe see both servers, the lock matches, a changed schema turns
50
+ `verify` red, and `doctor --security` flags the risky tool as info only.
51
+
52
+ ## Install
53
+
54
+ ```bash
55
+ # from source, works today
56
+ pipx install git+https://github.com/Matrinus/mcpcheck
57
+ pip install git+https://github.com/Matrinus/mcpcheck
58
+
59
+ # from PyPI, once 0.1.0 is published (the distribution is mcpcheck-cli, the command is mcpcheck)
60
+ pipx install mcpcheck-cli
61
+ ```
62
+
63
+ `pipx` keeps the CLI in its own environment (recommended); `pip` installs it into
64
+ the current one. Python 3.11 or newer.
65
+
66
+ ## Quickstart
67
+
68
+ ```bash
69
+ mcpcheck config --config mcp.json # validate the config and resolve ${VAR}
70
+ mcpcheck probe --config mcp.json # start each server and read its tools
71
+ mcpcheck lock --config mcp.json -o mcp.lock.json # record schemas in a lockfile
72
+ mcpcheck verify --config mcp.json --lock mcp.lock.json # compare live tools with the lock
73
+ mcpcheck doctor --config mcp.json --security # aggregate findings and security hints
74
+ ```
75
+
76
+ ## What it does
77
+
78
+ | command | returns | exit code |
79
+ | -------- | ----------------------------------------------------------------------- | --------- |
80
+ | `config` | discovered/validated configs, resolved env, config errors | 0, 1, 2 |
81
+ | `probe` | per-server status, startup ms, tools, schema hashes, resources | 0, 1, 2 |
82
+ | `lock` | writes `mcp.lock.json` for servers that answered | 0, 2, 3 |
83
+ | `verify` | added / removed / changed tools versus the lockfile | 0, 1, 2, 3 |
84
+ | `doctor` | findings `DOC001`–`DOC009` with severity and an actionable hint | 0, 1, 2 |
85
+
86
+ `--json` is available on every command and is byte-stable across runs: no
87
+ timestamps, sorted keys. The only exception is `startup_ms` in `probe`, which
88
+ measures real process startup.
89
+
90
+ ## How it works
91
+
92
+ `mcpcheck` speaks JSON-RPC over stdio itself: one JSON message per line,
93
+ `initialize` + `notifications/initialized`, a deadline on every read, and a
94
+ process-group kill on timeout or close. It then sends `tools/list` (following
95
+ `nextCursor`) and `resources/list`. Each tool is hashed as the SHA-256 of its
96
+ canonical JSON schema with sorted keys, so a new parameter changes the hash while
97
+ reformatting the config does not. Environment values are expanded and handed to
98
+ the child process, but never serialized: `--json` carries only `env_keys`, so
99
+ secrets stay out of logs and CI output.
100
+
101
+ ## What it does not do
102
+
103
+ - HTTP/SSE transports — remote servers are reported as `unsupported` (v0.2).
104
+ - OAuth or any interactive auth; a server that needs a browser cannot be probed.
105
+ - Tools are never called, so it cannot tell you whether a tool *works*.
106
+ - The `--security` checks are heuristics on names and descriptions, not an audit.
107
+ - Linux and macOS only in v0.1.
108
+
109
+ ## Exit codes
110
+
111
+ | code | meaning |
112
+ | ---- | ------------------------------------------------------------------------- |
113
+ | 0 | success; changes outside the `--fail-on` policy are still printed |
114
+ | 1 | config errors, unreachable servers, findings (with `--strict` also warns), or changes inside the policy |
115
+ | 2 | usage error, unreadable or invalid config/lockfile |
116
+ | 3 | a server did not respond during `lock`/`verify`, so nothing was compared |
117
+
118
+ ## Use as a GitHub Action
119
+
120
+ The composite action installs its own Python 3.12 and runs `mcpcheck verify`,
121
+ failing the job on changes inside `fail-on` (`any` by default):
122
+
123
+ ```yaml
124
+ - uses: actions/checkout@v4
125
+ - uses: Matrinus/mcpcheck@v0.1.0
126
+ with:
127
+ config: .mcp.json
128
+ lock: mcp.lock.json
129
+ fail-on: any
130
+ ```
131
+
132
+ Inputs: `config` (default `.mcp.json`), `lock` (default `mcp.lock.json`),
133
+ `fail-on` (`any`, `added`, `removed` or `changed`) and `timeout` in seconds
134
+ (default `5`). Pin the tag to the version of `mcpcheck` that wrote the lockfile;
135
+ see [`action.yml`](action.yml) for the full definition.
136
+
137
+ ## Roadmap
138
+
139
+ - **v0.2** — HTTP/SSE transports, `--watch`, pre-commit hook.
140
+ - **v0.3** — per-project policy (`policy.yaml`), SARIF export for code scanning.
141
+ - **v0.4** — compare two machines: what one has that the other does not.
142
+
143
+ See [`docs/design.md`](docs/design.md) for the decisions behind v0.1.
144
+
145
+ ## Contributing
146
+
147
+ See [CONTRIBUTING.md](CONTRIBUTING.md). New config formats and new doctor rules
148
+ are designed to be small, self-contained contributions; `make check` must pass
149
+ and `bash demo.sh` must stay green.
150
+
151
+ ## License
152
+
153
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,35 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "mcpcheck-cli"
7
+ version = "0.1.0"
8
+ description = "MCP server configuration probe"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ dependencies = []
12
+
13
+ [project.optional-dependencies]
14
+ dev = [
15
+ "pytest",
16
+ "pytest-cov",
17
+ "ruff",
18
+ "pyright",
19
+ ]
20
+
21
+ [project.scripts]
22
+ mcpcheck = "mcpcheck.cli:main"
23
+
24
+ [tool.ruff]
25
+ line-length = 92
26
+
27
+ [tool.ruff.format]
28
+ quote-style = "double"
29
+
30
+ [tool.pyright]
31
+ typeCheckingMode = "basic"
32
+ pythonVersion = "3.11"
33
+
34
+ [tool.pytest.ini_options]
35
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ from __future__ import annotations
2
+
3
+ __version__ = "0.1.0"