wcp-conformance 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 (35) hide show
  1. wcp_conformance-0.1.0/LICENSE +201 -0
  2. wcp_conformance-0.1.0/PKG-INFO +133 -0
  3. wcp_conformance-0.1.0/README.md +101 -0
  4. wcp_conformance-0.1.0/pyproject.toml +56 -0
  5. wcp_conformance-0.1.0/setup.cfg +4 -0
  6. wcp_conformance-0.1.0/src/wcp_conformance/__init__.py +9 -0
  7. wcp_conformance-0.1.0/src/wcp_conformance/checks/__init__.py +1 -0
  8. wcp_conformance-0.1.0/src/wcp_conformance/checks/base.py +23 -0
  9. wcp_conformance-0.1.0/src/wcp_conformance/checks/errors.py +72 -0
  10. wcp_conformance-0.1.0/src/wcp_conformance/checks/manifest.py +36 -0
  11. wcp_conformance-0.1.0/src/wcp_conformance/checks/sandbox.py +42 -0
  12. wcp_conformance-0.1.0/src/wcp_conformance/checks/schema_roundtrip.py +158 -0
  13. wcp_conformance-0.1.0/src/wcp_conformance/checks/security.py +152 -0
  14. wcp_conformance-0.1.0/src/wcp_conformance/cli.py +105 -0
  15. wcp_conformance-0.1.0/src/wcp_conformance/client.py +252 -0
  16. wcp_conformance-0.1.0/src/wcp_conformance/results.py +84 -0
  17. wcp_conformance-0.1.0/src/wcp_conformance/runner.py +47 -0
  18. wcp_conformance-0.1.0/src/wcp_conformance/schemas.py +14 -0
  19. wcp_conformance-0.1.0/src/wcp_conformance/tokens.py +37 -0
  20. wcp_conformance-0.1.0/src/wcp_conformance.egg-info/PKG-INFO +133 -0
  21. wcp_conformance-0.1.0/src/wcp_conformance.egg-info/SOURCES.txt +33 -0
  22. wcp_conformance-0.1.0/src/wcp_conformance.egg-info/dependency_links.txt +1 -0
  23. wcp_conformance-0.1.0/src/wcp_conformance.egg-info/entry_points.txt +2 -0
  24. wcp_conformance-0.1.0/src/wcp_conformance.egg-info/requires.txt +8 -0
  25. wcp_conformance-0.1.0/src/wcp_conformance.egg-info/top_level.txt +1 -0
  26. wcp_conformance-0.1.0/tests/test_check_errors.py +22 -0
  27. wcp_conformance-0.1.0/tests/test_check_manifest.py +36 -0
  28. wcp_conformance-0.1.0/tests/test_check_roundtrip.py +23 -0
  29. wcp_conformance-0.1.0/tests/test_check_sandbox.py +17 -0
  30. wcp_conformance-0.1.0/tests/test_check_security.py +55 -0
  31. wcp_conformance-0.1.0/tests/test_cli.py +10 -0
  32. wcp_conformance-0.1.0/tests/test_client_inprocess.py +33 -0
  33. wcp_conformance-0.1.0/tests/test_results.py +54 -0
  34. wcp_conformance-0.1.0/tests/test_runner_inprocess.py +34 -0
  35. wcp_conformance-0.1.0/tests/test_tokens.py +32 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 The Workstation Capability Protocol contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,133 @@
1
+ Metadata-Version: 2.4
2
+ Name: wcp-conformance
3
+ Version: 0.1.0
4
+ Summary: Conformance test suite for the Workstation Capability Protocol (WCP)
5
+ Author: The Workstation Capability Protocol contributors
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/kchemorion/WorkstationCapabilityProtocol
8
+ Project-URL: Repository, https://github.com/kchemorion/WorkstationCapabilityProtocol
9
+ Project-URL: Documentation, https://github.com/kchemorion/WorkstationCapabilityProtocol/blob/main/SPEC.md
10
+ Project-URL: Issues, https://github.com/kchemorion/WorkstationCapabilityProtocol/issues
11
+ Keywords: mcp,model-context-protocol,conformance,wcp,workstation,standard
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Software Development :: Testing
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: mcp>=1.2
25
+ Requires-Dist: httpx>=0.27
26
+ Requires-Dist: jsonschema>=4.21
27
+ Requires-Dist: pyjwt>=2.8
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=8; extra == "dev"
30
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
31
+ Dynamic: license-file
32
+
33
+ # wcp-conformance
34
+
35
+ A standalone conformance test suite for the Workstation Capability
36
+ Protocol (WCP). It certifies **any** WCP endpoint — the `wcpd` reference
37
+ server or a third-party implementation — against the published contract:
38
+ the manifest schema (`schemas/manifest.schema.json`), the per-operation
39
+ schemas (`schemas/ops/<op.id>.json`), and the MCP binding described in the
40
+ WCP spec. This package depends only on that published standard; it never
41
+ imports or relies on `wcpd` internals.
42
+
43
+ The suite checks two things:
44
+
45
+ - **Core conformance** — the mandatory baseline every WCP server must
46
+ meet: a valid manifest and the required `wcp.system` operations
47
+ (e.g. `describe`).
48
+ - **Per-family conformance** — for each capability family the server
49
+ advertises (`wcp.fs`, `wcp.exec`, `wcp.window`, ...), whether its
50
+ operations round-trip against their schemas and enforce scopes,
51
+ sandboxing, and error codes correctly. A server that only implements a
52
+ subset of families (e.g. a headless container with just `fs` + `exec`)
53
+ can still be certified for exactly what it implements.
54
+
55
+ Results are structured as a list of `CheckResult`s rolled up into a
56
+ `ConformanceReport` (see `src/wcp_conformance/results.py`), which can be
57
+ rendered as human-readable text (`report.summary()`) or serialized to
58
+ JSON (`report.as_dict()`).
59
+
60
+ ## Install
61
+
62
+ This package has its own virtualenv, independent of `reference/wcpd`.
63
+
64
+ ```bash
65
+ cd conformance
66
+ python3 -m venv .venv
67
+ .venv/bin/pip install -e ".[dev]"
68
+ ```
69
+
70
+ ## Test
71
+
72
+ ```bash
73
+ cd conformance
74
+ .venv/bin/python -m pytest -q
75
+ ```
76
+
77
+ ## Usage
78
+
79
+ ```bash
80
+ wcp-conformance --help
81
+ ```
82
+
83
+ The CLI needs a bearer token to call the target server. Exactly one of
84
+ two token modes must be supplied:
85
+
86
+ 1. **Pre-minted tokens** (works against any WCP server, including
87
+ third-party implementations). The operator mints tokens out of band
88
+ and passes them in:
89
+
90
+ ```bash
91
+ wcp-conformance \
92
+ --endpoint https://workstation.example.com/mcp \
93
+ --token-admin "$ADMIN_TOKEN" \
94
+ --token-none "$ZERO_SCOPE_TOKEN" \
95
+ --token-star "$STAR_SCOPE_TOKEN" \
96
+ --json report.json
97
+ ```
98
+
99
+ - `--token-admin`: a full-scope token, used to exercise normal
100
+ operation of every advertised family.
101
+ - `--token-none`: a zero-scope token, used to verify the server
102
+ correctly denies unauthorized calls.
103
+ - `--token-star`: a token scoped to the wildcard `*` (but not the
104
+ restricted `wcp:input:synthesize` scope), used to verify wildcard
105
+ scopes don't implicitly grant input synthesis.
106
+
107
+ 2. **Local HS256 minting** (convenient against reference/HS256-based
108
+ servers such as `wcpd`). The suite mints its own tokens with
109
+ `pyjwt`, given the server's shared secret:
110
+
111
+ ```bash
112
+ wcp-conformance \
113
+ --endpoint http://localhost:8977/mcp \
114
+ --jwt-secret "$WCP_JWT_SECRET" \
115
+ --workstation-id dev-ws \
116
+ --json report.json
117
+ ```
118
+
119
+ By default the suite only ever invokes operations the target's manifest
120
+ marks `read_only`; it never performs a mutating action expected to
121
+ succeed. `--include-mutating` and `--sandbox-path PATH` (default `.`)
122
+ are available for exercising more of the surface — see
123
+ [`docs/certifying.md`](docs/certifying.md) for details, including a
124
+ worked example with `--include-mutating --sandbox-path /tmp/wcp-probe`.
125
+
126
+ The CLI prints `report.summary()` to stdout (unless `--quiet`),
127
+ optionally writes a machine-readable report to the path given by
128
+ `--json`, and exits `0` if `report.ok` is true, `1` if a required check
129
+ failed, or `2` on a usage error (e.g. no token source supplied).
130
+
131
+ For the full certifying guide — both token modes, what "read-only by
132
+ default" means, and how to read `core_conformant`/`family_verdicts` in
133
+ the report — see [`docs/certifying.md`](docs/certifying.md).
@@ -0,0 +1,101 @@
1
+ # wcp-conformance
2
+
3
+ A standalone conformance test suite for the Workstation Capability
4
+ Protocol (WCP). It certifies **any** WCP endpoint — the `wcpd` reference
5
+ server or a third-party implementation — against the published contract:
6
+ the manifest schema (`schemas/manifest.schema.json`), the per-operation
7
+ schemas (`schemas/ops/<op.id>.json`), and the MCP binding described in the
8
+ WCP spec. This package depends only on that published standard; it never
9
+ imports or relies on `wcpd` internals.
10
+
11
+ The suite checks two things:
12
+
13
+ - **Core conformance** — the mandatory baseline every WCP server must
14
+ meet: a valid manifest and the required `wcp.system` operations
15
+ (e.g. `describe`).
16
+ - **Per-family conformance** — for each capability family the server
17
+ advertises (`wcp.fs`, `wcp.exec`, `wcp.window`, ...), whether its
18
+ operations round-trip against their schemas and enforce scopes,
19
+ sandboxing, and error codes correctly. A server that only implements a
20
+ subset of families (e.g. a headless container with just `fs` + `exec`)
21
+ can still be certified for exactly what it implements.
22
+
23
+ Results are structured as a list of `CheckResult`s rolled up into a
24
+ `ConformanceReport` (see `src/wcp_conformance/results.py`), which can be
25
+ rendered as human-readable text (`report.summary()`) or serialized to
26
+ JSON (`report.as_dict()`).
27
+
28
+ ## Install
29
+
30
+ This package has its own virtualenv, independent of `reference/wcpd`.
31
+
32
+ ```bash
33
+ cd conformance
34
+ python3 -m venv .venv
35
+ .venv/bin/pip install -e ".[dev]"
36
+ ```
37
+
38
+ ## Test
39
+
40
+ ```bash
41
+ cd conformance
42
+ .venv/bin/python -m pytest -q
43
+ ```
44
+
45
+ ## Usage
46
+
47
+ ```bash
48
+ wcp-conformance --help
49
+ ```
50
+
51
+ The CLI needs a bearer token to call the target server. Exactly one of
52
+ two token modes must be supplied:
53
+
54
+ 1. **Pre-minted tokens** (works against any WCP server, including
55
+ third-party implementations). The operator mints tokens out of band
56
+ and passes them in:
57
+
58
+ ```bash
59
+ wcp-conformance \
60
+ --endpoint https://workstation.example.com/mcp \
61
+ --token-admin "$ADMIN_TOKEN" \
62
+ --token-none "$ZERO_SCOPE_TOKEN" \
63
+ --token-star "$STAR_SCOPE_TOKEN" \
64
+ --json report.json
65
+ ```
66
+
67
+ - `--token-admin`: a full-scope token, used to exercise normal
68
+ operation of every advertised family.
69
+ - `--token-none`: a zero-scope token, used to verify the server
70
+ correctly denies unauthorized calls.
71
+ - `--token-star`: a token scoped to the wildcard `*` (but not the
72
+ restricted `wcp:input:synthesize` scope), used to verify wildcard
73
+ scopes don't implicitly grant input synthesis.
74
+
75
+ 2. **Local HS256 minting** (convenient against reference/HS256-based
76
+ servers such as `wcpd`). The suite mints its own tokens with
77
+ `pyjwt`, given the server's shared secret:
78
+
79
+ ```bash
80
+ wcp-conformance \
81
+ --endpoint http://localhost:8977/mcp \
82
+ --jwt-secret "$WCP_JWT_SECRET" \
83
+ --workstation-id dev-ws \
84
+ --json report.json
85
+ ```
86
+
87
+ By default the suite only ever invokes operations the target's manifest
88
+ marks `read_only`; it never performs a mutating action expected to
89
+ succeed. `--include-mutating` and `--sandbox-path PATH` (default `.`)
90
+ are available for exercising more of the surface — see
91
+ [`docs/certifying.md`](docs/certifying.md) for details, including a
92
+ worked example with `--include-mutating --sandbox-path /tmp/wcp-probe`.
93
+
94
+ The CLI prints `report.summary()` to stdout (unless `--quiet`),
95
+ optionally writes a machine-readable report to the path given by
96
+ `--json`, and exits `0` if `report.ok` is true, `1` if a required check
97
+ failed, or `2` on a usage error (e.g. no token source supplied).
98
+
99
+ For the full certifying guide — both token modes, what "read-only by
100
+ default" means, and how to read `core_conformant`/`family_verdicts` in
101
+ the report — see [`docs/certifying.md`](docs/certifying.md).
@@ -0,0 +1,56 @@
1
+ [project]
2
+ name = "wcp-conformance"
3
+ version = "0.1.0"
4
+ description = "Conformance test suite for the Workstation Capability Protocol (WCP)"
5
+ readme = "README.md"
6
+ license = { text = "Apache-2.0" }
7
+ authors = [{ name = "The Workstation Capability Protocol contributors" }]
8
+ keywords = [
9
+ "mcp",
10
+ "model-context-protocol",
11
+ "conformance",
12
+ "wcp",
13
+ "workstation",
14
+ "standard",
15
+ ]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: Apache Software License",
20
+ "Operating System :: OS Independent",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Topic :: Software Development :: Testing",
26
+ ]
27
+ requires-python = ">=3.10"
28
+ dependencies = ["mcp>=1.2", "httpx>=0.27", "jsonschema>=4.21", "pyjwt>=2.8"]
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/kchemorion/WorkstationCapabilityProtocol"
32
+ Repository = "https://github.com/kchemorion/WorkstationCapabilityProtocol"
33
+ Documentation = "https://github.com/kchemorion/WorkstationCapabilityProtocol/blob/main/SPEC.md"
34
+ Issues = "https://github.com/kchemorion/WorkstationCapabilityProtocol/issues"
35
+
36
+ [project.optional-dependencies]
37
+ dev = ["pytest>=8", "pytest-asyncio>=0.23"]
38
+
39
+ [project.scripts]
40
+ wcp-conformance = "wcp_conformance.cli:main"
41
+
42
+ [tool.pytest.ini_options]
43
+ pythonpath = ["src"]
44
+ asyncio_mode = "auto"
45
+
46
+ [tool.ruff]
47
+ line-length = 100
48
+ target-version = "py310"
49
+
50
+ [tool.ruff.lint]
51
+ select = ["E", "F", "I", "UP", "B"]
52
+ ignore = ["E501"] # long lines in descriptive strings are acceptable
53
+
54
+ [build-system]
55
+ requires = ["setuptools>=68"]
56
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,9 @@
1
+ """wcp-conformance: standalone conformance test suite for the Workstation
2
+ Capability Protocol (WCP).
3
+
4
+ This package certifies any WCP endpoint against the published contract
5
+ (manifest schema + MCP binding). It depends only on the standard — never
6
+ on any particular server implementation (e.g. wcpd) internals.
7
+ """
8
+
9
+ __all__: list[str] = []
@@ -0,0 +1 @@
1
+ """Conformance checks: the pluggable units the suite runs against a server."""
@@ -0,0 +1,23 @@
1
+ """Check protocol + shared context."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass
6
+ from pathlib import Path
7
+
8
+ from ..results import CheckResult
9
+
10
+
11
+ @dataclass
12
+ class CheckContext:
13
+ schemas_dir: Path
14
+ manifest: dict
15
+ include_mutating: bool
16
+ sandbox_path: str
17
+ unprivileged_client_factory: object = None
18
+ restricted_client_factory: object = None
19
+
20
+
21
+ class Check:
22
+ async def run(self, client, ctx: CheckContext) -> list[CheckResult]: # pragma: no cover
23
+ raise NotImplementedError
@@ -0,0 +1,72 @@
1
+ """Check: error responses use only normative WCP error codes."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from ..client import ToolError
6
+ from ..results import CheckResult, Severity
7
+ from .base import Check, CheckContext
8
+
9
+ NORMATIVE_CODES = frozenset(
10
+ {
11
+ "WCP_PERMISSION_DENIED",
12
+ "WCP_SANDBOX_VIOLATION",
13
+ "WCP_UNSUPPORTED_OPERATION",
14
+ "WCP_BACKEND_UNAVAILABLE",
15
+ "WCP_INVALID_PARAMS",
16
+ "WCP_LIMIT_EXCEEDED",
17
+ "WCP_INTERNAL",
18
+ }
19
+ )
20
+
21
+
22
+ class ErrorCodeCheck(Check):
23
+ async def run(self, client, ctx: CheckContext) -> list[CheckResult]:
24
+ observed: list[str] = []
25
+ problems: list[str] = []
26
+
27
+ # 1) invalid params on a known op: an unknown property, which the
28
+ # declared params schema forbids (additionalProperties: false).
29
+ # core.md names this an explicit WCP_INVALID_PARAMS trigger, and —
30
+ # unlike a wrong-typed declared param, which the MCP transport's own
31
+ # signature validation rejects codelessly before the WCP layer sees
32
+ # it (legitimately, like an unknown tool) — an unknown property is
33
+ # dispatched through to the WCP layer. A conforming server MUST
34
+ # therefore return a normative WCP code here, ideally
35
+ # WCP_INVALID_PARAMS; a codeless (flattened-text) error is a failure.
36
+ if "wcp.fs" in ctx.manifest["families"]:
37
+ try:
38
+ await client.call("wcp.fs.read", path=".", __unknown_param__=1)
39
+ except ToolError as exc:
40
+ if not exc.code:
41
+ problems.append("invalid-params returned no WCP error code")
42
+ else:
43
+ observed.append(exc.code)
44
+ if exc.code not in NORMATIVE_CODES:
45
+ problems.append(f"invalid-params returned non-normative {exc.code}")
46
+ elif exc.code != "WCP_INVALID_PARAMS":
47
+ problems.append(
48
+ f"invalid-params returned {exc.code}, expected WCP_INVALID_PARAMS"
49
+ )
50
+ else:
51
+ problems.append("invalid-params call did not raise an error")
52
+
53
+ # 2) unknown operation → WCP_UNSUPPORTED_OPERATION (or transport-level tool-not-found)
54
+ try:
55
+ await client.call("wcp.fs.__nope__")
56
+ except ToolError as exc:
57
+ if exc.code and exc.code not in NORMATIVE_CODES:
58
+ problems.append(f"unknown-op returned non-normative {exc.code}")
59
+ except Exception:
60
+ pass # transport may reject unknown tool names before WCP layer; acceptable
61
+
62
+ passed = not problems
63
+ return [
64
+ CheckResult(
65
+ "errors.normative_codes",
66
+ None,
67
+ passed,
68
+ Severity.REQUIRED,
69
+ "all observed codes normative" if passed else "; ".join(problems),
70
+ evidence={"observed": observed},
71
+ )
72
+ ]
@@ -0,0 +1,36 @@
1
+ """Check: the live manifest validates against manifest.schema.json."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import jsonschema
6
+
7
+ from ..results import CheckResult, Severity
8
+ from ..schemas import load_manifest_schema
9
+ from .base import Check, CheckContext
10
+
11
+
12
+ class ManifestValidCheck(Check):
13
+ async def run(self, client, ctx: CheckContext) -> list[CheckResult]:
14
+ schema = load_manifest_schema(ctx.schemas_dir)
15
+ try:
16
+ jsonschema.validate(ctx.manifest, schema)
17
+ return [
18
+ CheckResult(
19
+ "manifest.valid",
20
+ None,
21
+ True,
22
+ Severity.REQUIRED,
23
+ "manifest validates against manifest.schema.json",
24
+ )
25
+ ]
26
+ except jsonschema.ValidationError as exc:
27
+ return [
28
+ CheckResult(
29
+ "manifest.valid",
30
+ None,
31
+ False,
32
+ Severity.REQUIRED,
33
+ f"manifest invalid: {exc.message}",
34
+ evidence={"path": list(exc.absolute_path)},
35
+ )
36
+ ]