touchstone-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.
@@ -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
95
+ Derivative 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 describing the origin of the Work and
141
+ 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 Support. 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 support.
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 Clarethium
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,91 @@
1
+ Metadata-Version: 2.4
2
+ Name: touchstone-mcp
3
+ Version: 0.1.0
4
+ Summary: Model Context Protocol server for Touchstone: hallucination detection for LLM outputs without calling another LLM. Wraps the calibrated Verifier and the raw measurement orchestrator from the clarethium-touchstone reference implementation as MCP tools.
5
+ Author-email: Lovro Lucic <11740211+lluvr@users.noreply.github.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/Clarethium/touchstone/tree/main/touchstone-mcp
8
+ Project-URL: Repository, https://github.com/Clarethium/touchstone
9
+ Project-URL: Issues, https://github.com/Clarethium/touchstone/issues
10
+ Project-URL: Changelog, https://github.com/Clarethium/touchstone/blob/main/touchstone-mcp/CHANGELOG.md
11
+ Project-URL: Touchstone Library, https://pypi.org/project/clarethium-touchstone/
12
+ Project-URL: Touchstone Standard, https://github.com/Clarethium/touchstone/blob/main/STANDARDS/touchstone-1.0.md
13
+ Keywords: ai,ai-evaluation,claude-desktop,clarethium,cursor,fabrication-detection,grounding,hallucination-detection,mcp,model-context-protocol,structural-verification,touchstone
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Software Development :: Quality Assurance
24
+ Classifier: Topic :: Software Development :: Testing
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: clarethium-touchstone>=0.2.0
29
+ Requires-Dist: fastmcp>=2.0
30
+ Provides-Extra: test
31
+ Requires-Dist: pytest>=8.0; extra == "test"
32
+ Requires-Dist: pytest-asyncio>=0.23; extra == "test"
33
+ Requires-Dist: ruff>=0.6; extra == "test"
34
+ Requires-Dist: mypy>=1.10; extra == "test"
35
+ Dynamic: license-file
36
+
37
+ # touchstone-mcp
38
+
39
+ Model Context Protocol server for [Touchstone](https://github.com/Clarethium/touchstone): hallucination detection for LLM outputs without calling another LLM.
40
+
41
+ `touchstone-mcp` exposes the calibrated `Verifier` and the raw measurement orchestrator from the [`clarethium-touchstone`](https://pypi.org/project/clarethium-touchstone/) reference implementation as MCP tools. Any MCP host (Claude Desktop, Claude Code, Cursor, custom) can attach it as a stdio MCP server.
42
+
43
+ ## Install
44
+
45
+ ```bash
46
+ pip install touchstone-mcp
47
+ ```
48
+
49
+ `fastmcp` and `clarethium-touchstone` install transitively. The `touchstone-mcp` console script is registered automatically and runs on the stdio transport by default.
50
+
51
+ ## Host config
52
+
53
+ Drop this into your MCP host config:
54
+
55
+ ```json
56
+ {
57
+ "mcpServers": {
58
+ "touchstone": {
59
+ "command": "touchstone-mcp"
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ For Claude Code: `claude mcp add touchstone touchstone-mcp`.
66
+
67
+ ## Tools exposed
68
+
69
+ * `verify` — calibrated `(text, source)` hallucination probability with scope classification, signal breakdown, and span-level localization.
70
+ * `measure` — raw multi-layer Touchstone output (all eleven Section 5 measurement layers).
71
+ * `assess_derivation_regime` — Layer 11 standalone regime classifier.
72
+ * `list_modes` — enumerate the four Verifier modes with their required inputs.
73
+
74
+ See [the host wiring guide](https://github.com/Clarethium/touchstone/blob/main/docs/mcp.md) for full tool reference, scope semantics, and threshold guidance.
75
+
76
+ ## Programmatic use
77
+
78
+ ```python
79
+ from touchstone_mcp import build_server
80
+
81
+ server = build_server()
82
+ server.run() # stdio transport
83
+ ```
84
+
85
+ ## Version pairing
86
+
87
+ `touchstone-mcp` depends on `clarethium-touchstone>=0.2.0`. The MCP server is a thin wrapper around the library's public surface; measurement semantics and calibration coefficients are defined and tested in the library, not here.
88
+
89
+ ## License
90
+
91
+ Apache-2.0. See `LICENSE`.
@@ -0,0 +1,55 @@
1
+ # touchstone-mcp
2
+
3
+ Model Context Protocol server for [Touchstone](https://github.com/Clarethium/touchstone): hallucination detection for LLM outputs without calling another LLM.
4
+
5
+ `touchstone-mcp` exposes the calibrated `Verifier` and the raw measurement orchestrator from the [`clarethium-touchstone`](https://pypi.org/project/clarethium-touchstone/) reference implementation as MCP tools. Any MCP host (Claude Desktop, Claude Code, Cursor, custom) can attach it as a stdio MCP server.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install touchstone-mcp
11
+ ```
12
+
13
+ `fastmcp` and `clarethium-touchstone` install transitively. The `touchstone-mcp` console script is registered automatically and runs on the stdio transport by default.
14
+
15
+ ## Host config
16
+
17
+ Drop this into your MCP host config:
18
+
19
+ ```json
20
+ {
21
+ "mcpServers": {
22
+ "touchstone": {
23
+ "command": "touchstone-mcp"
24
+ }
25
+ }
26
+ }
27
+ ```
28
+
29
+ For Claude Code: `claude mcp add touchstone touchstone-mcp`.
30
+
31
+ ## Tools exposed
32
+
33
+ * `verify` — calibrated `(text, source)` hallucination probability with scope classification, signal breakdown, and span-level localization.
34
+ * `measure` — raw multi-layer Touchstone output (all eleven Section 5 measurement layers).
35
+ * `assess_derivation_regime` — Layer 11 standalone regime classifier.
36
+ * `list_modes` — enumerate the four Verifier modes with their required inputs.
37
+
38
+ See [the host wiring guide](https://github.com/Clarethium/touchstone/blob/main/docs/mcp.md) for full tool reference, scope semantics, and threshold guidance.
39
+
40
+ ## Programmatic use
41
+
42
+ ```python
43
+ from touchstone_mcp import build_server
44
+
45
+ server = build_server()
46
+ server.run() # stdio transport
47
+ ```
48
+
49
+ ## Version pairing
50
+
51
+ `touchstone-mcp` depends on `clarethium-touchstone>=0.2.0`. The MCP server is a thin wrapper around the library's public surface; measurement semantics and calibration coefficients are defined and tested in the library, not here.
52
+
53
+ ## License
54
+
55
+ Apache-2.0. See `LICENSE`.
@@ -0,0 +1,94 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "touchstone-mcp"
7
+ version = "0.1.0"
8
+ description = "Model Context Protocol server for Touchstone: hallucination detection for LLM outputs without calling another LLM. Wraps the calibrated Verifier and the raw measurement orchestrator from the clarethium-touchstone reference implementation as MCP tools."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE"]
13
+ authors = [
14
+ { name = "Lovro Lucic", email = "11740211+lluvr@users.noreply.github.com" },
15
+ ]
16
+ keywords = [
17
+ "ai",
18
+ "ai-evaluation",
19
+ "claude-desktop",
20
+ "clarethium",
21
+ "cursor",
22
+ "fabrication-detection",
23
+ "grounding",
24
+ "hallucination-detection",
25
+ "mcp",
26
+ "model-context-protocol",
27
+ "structural-verification",
28
+ "touchstone",
29
+ ]
30
+ classifiers = [
31
+ "Development Status :: 3 - Alpha",
32
+ "Intended Audience :: Developers",
33
+ "Intended Audience :: Science/Research",
34
+ "Operating System :: OS Independent",
35
+ "Programming Language :: Python :: 3",
36
+ "Programming Language :: Python :: 3.10",
37
+ "Programming Language :: Python :: 3.11",
38
+ "Programming Language :: Python :: 3.12",
39
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
40
+ "Topic :: Software Development :: Quality Assurance",
41
+ "Topic :: Software Development :: Testing",
42
+ ]
43
+ dependencies = [
44
+ "clarethium-touchstone>=0.2.0",
45
+ "fastmcp>=2.0",
46
+ ]
47
+
48
+ [project.optional-dependencies]
49
+ test = [
50
+ "pytest>=8.0",
51
+ "pytest-asyncio>=0.23",
52
+ "ruff>=0.6",
53
+ "mypy>=1.10",
54
+ ]
55
+
56
+ [project.scripts]
57
+ touchstone-mcp = "touchstone_mcp:main"
58
+
59
+ [project.urls]
60
+ Homepage = "https://github.com/Clarethium/touchstone/tree/main/touchstone-mcp"
61
+ Repository = "https://github.com/Clarethium/touchstone"
62
+ Issues = "https://github.com/Clarethium/touchstone/issues"
63
+ Changelog = "https://github.com/Clarethium/touchstone/blob/main/touchstone-mcp/CHANGELOG.md"
64
+ "Touchstone Library" = "https://pypi.org/project/clarethium-touchstone/"
65
+ "Touchstone Standard" = "https://github.com/Clarethium/touchstone/blob/main/STANDARDS/touchstone-1.0.md"
66
+
67
+ [tool.setuptools]
68
+ # Flat single-module layout matching the cma-mcp wheel convention.
69
+ # ``touchstone_mcp.py`` ships as a top-level import on the installed
70
+ # wheel; the console script entry point ``touchstone-mcp = touchstone_mcp:main``
71
+ # resolves against the top-level module without a package indirection.
72
+ py-modules = ["touchstone_mcp"]
73
+
74
+ [tool.pytest.ini_options]
75
+ minversion = "8.0"
76
+ testpaths = ["tests"]
77
+ python_files = "test_*.py"
78
+ python_classes = "Test*"
79
+ python_functions = "test_*"
80
+ asyncio_mode = "auto"
81
+
82
+ [tool.ruff]
83
+ line-length = 100
84
+ target-version = "py310"
85
+
86
+ [tool.ruff.lint]
87
+ select = ["E", "F", "I", "N", "W", "UP", "B", "C4", "SIM"]
88
+ ignore = ["E501"]
89
+
90
+ [tool.mypy]
91
+ python_version = "3.10"
92
+ strict = true
93
+ warn_unused_ignores = true
94
+ warn_return_any = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,267 @@
1
+ """Tests for the four Touchstone MCP tools.
2
+
3
+ ``touchstone-mcp`` declares ``clarethium-touchstone`` and ``fastmcp``
4
+ as hard runtime dependencies, so this test module imports them
5
+ unconditionally. Install the package with the ``test`` extra to run
6
+ the suite::
7
+
8
+ pip install -e ".[test]"
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import pytest
14
+ from fastmcp import FastMCP
15
+
16
+ from touchstone_mcp import build_server
17
+
18
+ # All tests are async; pytest-asyncio's auto mode picks them up.
19
+ pytestmark = pytest.mark.asyncio
20
+
21
+
22
+ SUPPORTED_TEXT = (
23
+ "Apple reported Q1 fiscal 2026 revenue of $143 billion. The iPhone "
24
+ "segment grew 8% year-over-year. Tim Cook commented on AI investments "
25
+ "during the earnings call. Operating margins reached 32%."
26
+ )
27
+ SUPPORTED_SOURCE = SUPPORTED_TEXT
28
+
29
+ HALLUCINATED_TEXT = (
30
+ "Apple reported Q1 fiscal 2026 revenue of $185 billion, the company's "
31
+ "highest ever. McKinsey forecasts industry-wide growth of 47% next "
32
+ "quarter. The Federal Reserve will raise rates 75 basis points in "
33
+ "response. Tesla announced a competing AR product for late 2027."
34
+ )
35
+ HALLUCINATED_SOURCE = SUPPORTED_TEXT
36
+
37
+
38
+ @pytest.fixture
39
+ def server() -> FastMCP:
40
+ """A fresh FastMCP instance with all four MCP tools registered."""
41
+ return build_server()
42
+
43
+
44
+ # -- Tool registration --------------------------------------------------------
45
+
46
+
47
+ async def test_server_registers_all_four_tools(server: FastMCP) -> None:
48
+ """The server registers exactly the four documented tools."""
49
+ tools = await server.list_tools()
50
+ names = sorted(t.name for t in tools)
51
+ assert names == sorted(["verify", "measure", "assess_derivation_regime", "list_modes"])
52
+
53
+
54
+ async def test_server_has_name_and_instructions(server: FastMCP) -> None:
55
+ """Server identity is set so MCP hosts can render it."""
56
+ assert server.name == "touchstone"
57
+ assert server.instructions
58
+ assert "Touchstone" in server.instructions
59
+
60
+
61
+ async def test_tool_descriptions_non_empty(server: FastMCP) -> None:
62
+ """Every tool ships a non-empty description (driven by docstrings)."""
63
+ tools = await server.list_tools()
64
+ for tool in tools:
65
+ assert tool.description, f"tool {tool.name!r} has no description"
66
+ assert len(tool.description) > 50, (
67
+ f"tool {tool.name!r} description too short: {tool.description!r}"
68
+ )
69
+
70
+
71
+ # -- verify tool --------------------------------------------------------------
72
+
73
+
74
+ async def test_verify_faithful_pair_low_prob(server: FastMCP) -> None:
75
+ """A self-source faithful input scores low."""
76
+ result = await server.call_tool(
77
+ "verify",
78
+ {"text": SUPPORTED_TEXT, "source": SUPPORTED_SOURCE},
79
+ )
80
+ out = result.structured_content
81
+ assert out["scope"] == "validated"
82
+ assert out["prob_hallucinated"] < 0.5
83
+ assert out["mode"] == "substrate_only"
84
+
85
+
86
+ async def test_verify_hallucinated_pair_high_prob(server: FastMCP) -> None:
87
+ """An adversarial hallucinated input scores above 0.5."""
88
+ result = await server.call_tool(
89
+ "verify",
90
+ {"text": HALLUCINATED_TEXT, "source": HALLUCINATED_SOURCE},
91
+ )
92
+ out = result.structured_content
93
+ assert out["scope"] == "validated"
94
+ assert out["prob_hallucinated"] > 0.5
95
+ assert len(out["top_unsupported"]) > 0
96
+
97
+
98
+ async def test_verify_returns_required_shape(server: FastMCP) -> None:
99
+ """Verify returns every documented field."""
100
+ result = await server.call_tool(
101
+ "verify",
102
+ {"text": HALLUCINATED_TEXT, "source": HALLUCINATED_SOURCE},
103
+ )
104
+ out = result.structured_content
105
+ assert set(out.keys()) >= {
106
+ "prob_hallucinated",
107
+ "mode",
108
+ "scope",
109
+ "scope_notes",
110
+ "signal_breakdown",
111
+ "top_unsupported",
112
+ }
113
+ assert isinstance(out["prob_hallucinated"], float)
114
+ assert 0.0 <= out["prob_hallucinated"] <= 1.0
115
+ assert isinstance(out["scope_notes"], list)
116
+ assert isinstance(out["signal_breakdown"], dict)
117
+ assert isinstance(out["top_unsupported"], list)
118
+
119
+
120
+ async def test_verify_empty_text_classified_insufficient_input(server: FastMCP) -> None:
121
+ """Empty text returns scope=insufficient_input."""
122
+ result = await server.call_tool(
123
+ "verify",
124
+ {"text": "", "source": "Some real source text with substance."},
125
+ )
126
+ out = result.structured_content
127
+ assert out["scope"] == "insufficient_input"
128
+
129
+
130
+ async def test_verify_short_self_reference_not_validated(server: FastMCP) -> None:
131
+ """A trivially short self-referential input is not validated scope."""
132
+ text = "Revenue grew 12%."
133
+ result = await server.call_tool("verify", {"text": text, "source": text})
134
+ out = result.structured_content
135
+ assert out["scope"] != "validated"
136
+ assert out["prob_hallucinated"] < 0.3
137
+
138
+
139
+ async def test_verify_top_k_caps_output(server: FastMCP) -> None:
140
+ """top_k_unsupported caps the returned span count."""
141
+ result = await server.call_tool(
142
+ "verify",
143
+ {
144
+ "text": HALLUCINATED_TEXT,
145
+ "source": HALLUCINATED_SOURCE,
146
+ "top_k_unsupported": 1,
147
+ },
148
+ )
149
+ out = result.structured_content
150
+ assert len(out["top_unsupported"]) <= 1
151
+
152
+
153
+ async def test_verify_substrate_plus_judge_mode_auto_selects(server: FastMCP) -> None:
154
+ """Passing judge_hallucinated_prob switches mode."""
155
+ result = await server.call_tool(
156
+ "verify",
157
+ {
158
+ "text": HALLUCINATED_TEXT,
159
+ "source": HALLUCINATED_SOURCE,
160
+ "judge_hallucinated_prob": 0.9,
161
+ "judge_alpha": 0.3,
162
+ },
163
+ )
164
+ out = result.structured_content
165
+ assert out["mode"] == "substrate_plus_judge"
166
+ assert "substrate_prob" in out["signal_breakdown"]
167
+ assert "judge_hallucinated_prob" in out["signal_breakdown"]
168
+
169
+
170
+ # -- measure tool -------------------------------------------------------------
171
+
172
+
173
+ async def test_measure_returns_all_layers(server: FastMCP) -> None:
174
+ """measure returns every layer key."""
175
+ result = await server.call_tool("measure", {"text": SUPPORTED_TEXT, "source": SUPPORTED_SOURCE})
176
+ out = result.structured_content
177
+ expected_layers = {
178
+ "structural_profile",
179
+ "claim_density",
180
+ "temporal_instability",
181
+ "source_matching",
182
+ "entity_provenance",
183
+ "vocabulary_proximity",
184
+ "presentation_features",
185
+ "epistemic_calibration",
186
+ "information_novelty",
187
+ "quality_profile",
188
+ "grounding_decomposition",
189
+ }
190
+ assert set(out.keys()) >= expected_layers
191
+
192
+
193
+ async def test_measure_no_source_omits_source_dependent_layers(server: FastMCP) -> None:
194
+ """When source is omitted, source-dependent layers return None."""
195
+ result = await server.call_tool(
196
+ "measure",
197
+ {"text": "Revenue grew 12% to $143M with 25% margins."},
198
+ )
199
+ out = result.structured_content
200
+ # Layers 4, 5, 6, 11 require source.
201
+ assert out["source_matching"] is None
202
+ assert out["entity_provenance"] is None
203
+ assert out["vocabulary_proximity"] is None
204
+ assert out["grounding_decomposition"] is None
205
+ # Layer 7 (presentation) does not require source and should fire.
206
+ assert out["presentation_features"] is not None
207
+
208
+
209
+ # -- assess_derivation_regime tool -------------------------------------------
210
+
211
+
212
+ async def test_assess_derivation_regime_saturated_at_high_n(server: FastMCP) -> None:
213
+ """Source with >= 10 numbers classifies as saturated."""
214
+ result = await server.call_tool("assess_derivation_regime", {"source_num_count": 14})
215
+ out = result.structured_content
216
+ assert out["derivation_regime"] == "saturated"
217
+ assert out["cross_reference_layer_4_for_numbers"] is True
218
+
219
+
220
+ async def test_assess_derivation_regime_diagnostic_at_low_n(server: FastMCP) -> None:
221
+ """Source with < 5 numbers classifies as diagnostic."""
222
+ result = await server.call_tool("assess_derivation_regime", {"source_num_count": 2})
223
+ out = result.structured_content
224
+ assert out["derivation_regime"] == "diagnostic"
225
+
226
+
227
+ # -- list_modes tool ----------------------------------------------------------
228
+
229
+
230
+ async def test_list_modes_returns_four_modes(server: FastMCP) -> None:
231
+ """list_modes enumerates the four canonical mode strings."""
232
+ result = await server.call_tool("list_modes", {})
233
+ out = result.structured_content
234
+ names = [m["name"] for m in out["modes"]]
235
+ assert names == [
236
+ "substrate_only",
237
+ "substrate_plus_minicheck",
238
+ "substrate_plus_minicheck_alignscore",
239
+ "substrate_plus_judge",
240
+ ]
241
+
242
+
243
+ async def test_list_modes_returns_versions(server: FastMCP) -> None:
244
+ """list_modes returns library + Standard versions."""
245
+ result = await server.call_tool("list_modes", {})
246
+ out = result.structured_content
247
+ assert "versions" in out
248
+ versions = out["versions"]
249
+ assert versions["touchstone_library"]
250
+ assert versions["touchstone_standard"]
251
+
252
+
253
+ async def test_list_modes_per_mode_required_inputs(server: FastMCP) -> None:
254
+ """Each mode metadata names its required input parameters."""
255
+ result = await server.call_tool("list_modes", {})
256
+ out = result.structured_content
257
+ expected_requires = {
258
+ "substrate_only": [],
259
+ "substrate_plus_minicheck": ["minicheck_supported_prob"],
260
+ "substrate_plus_minicheck_alignscore": [
261
+ "minicheck_supported_prob",
262
+ "alignscore_supported_prob",
263
+ ],
264
+ "substrate_plus_judge": ["judge_hallucinated_prob"],
265
+ }
266
+ for mode in out["modes"]:
267
+ assert mode["requires"] == expected_requires[mode["name"]]
@@ -0,0 +1,91 @@
1
+ Metadata-Version: 2.4
2
+ Name: touchstone-mcp
3
+ Version: 0.1.0
4
+ Summary: Model Context Protocol server for Touchstone: hallucination detection for LLM outputs without calling another LLM. Wraps the calibrated Verifier and the raw measurement orchestrator from the clarethium-touchstone reference implementation as MCP tools.
5
+ Author-email: Lovro Lucic <11740211+lluvr@users.noreply.github.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/Clarethium/touchstone/tree/main/touchstone-mcp
8
+ Project-URL: Repository, https://github.com/Clarethium/touchstone
9
+ Project-URL: Issues, https://github.com/Clarethium/touchstone/issues
10
+ Project-URL: Changelog, https://github.com/Clarethium/touchstone/blob/main/touchstone-mcp/CHANGELOG.md
11
+ Project-URL: Touchstone Library, https://pypi.org/project/clarethium-touchstone/
12
+ Project-URL: Touchstone Standard, https://github.com/Clarethium/touchstone/blob/main/STANDARDS/touchstone-1.0.md
13
+ Keywords: ai,ai-evaluation,claude-desktop,clarethium,cursor,fabrication-detection,grounding,hallucination-detection,mcp,model-context-protocol,structural-verification,touchstone
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Software Development :: Quality Assurance
24
+ Classifier: Topic :: Software Development :: Testing
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: clarethium-touchstone>=0.2.0
29
+ Requires-Dist: fastmcp>=2.0
30
+ Provides-Extra: test
31
+ Requires-Dist: pytest>=8.0; extra == "test"
32
+ Requires-Dist: pytest-asyncio>=0.23; extra == "test"
33
+ Requires-Dist: ruff>=0.6; extra == "test"
34
+ Requires-Dist: mypy>=1.10; extra == "test"
35
+ Dynamic: license-file
36
+
37
+ # touchstone-mcp
38
+
39
+ Model Context Protocol server for [Touchstone](https://github.com/Clarethium/touchstone): hallucination detection for LLM outputs without calling another LLM.
40
+
41
+ `touchstone-mcp` exposes the calibrated `Verifier` and the raw measurement orchestrator from the [`clarethium-touchstone`](https://pypi.org/project/clarethium-touchstone/) reference implementation as MCP tools. Any MCP host (Claude Desktop, Claude Code, Cursor, custom) can attach it as a stdio MCP server.
42
+
43
+ ## Install
44
+
45
+ ```bash
46
+ pip install touchstone-mcp
47
+ ```
48
+
49
+ `fastmcp` and `clarethium-touchstone` install transitively. The `touchstone-mcp` console script is registered automatically and runs on the stdio transport by default.
50
+
51
+ ## Host config
52
+
53
+ Drop this into your MCP host config:
54
+
55
+ ```json
56
+ {
57
+ "mcpServers": {
58
+ "touchstone": {
59
+ "command": "touchstone-mcp"
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ For Claude Code: `claude mcp add touchstone touchstone-mcp`.
66
+
67
+ ## Tools exposed
68
+
69
+ * `verify` — calibrated `(text, source)` hallucination probability with scope classification, signal breakdown, and span-level localization.
70
+ * `measure` — raw multi-layer Touchstone output (all eleven Section 5 measurement layers).
71
+ * `assess_derivation_regime` — Layer 11 standalone regime classifier.
72
+ * `list_modes` — enumerate the four Verifier modes with their required inputs.
73
+
74
+ See [the host wiring guide](https://github.com/Clarethium/touchstone/blob/main/docs/mcp.md) for full tool reference, scope semantics, and threshold guidance.
75
+
76
+ ## Programmatic use
77
+
78
+ ```python
79
+ from touchstone_mcp import build_server
80
+
81
+ server = build_server()
82
+ server.run() # stdio transport
83
+ ```
84
+
85
+ ## Version pairing
86
+
87
+ `touchstone-mcp` depends on `clarethium-touchstone>=0.2.0`. The MCP server is a thin wrapper around the library's public surface; measurement semantics and calibration coefficients are defined and tested in the library, not here.
88
+
89
+ ## License
90
+
91
+ Apache-2.0. See `LICENSE`.
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ touchstone_mcp.py
5
+ tests/test_server.py
6
+ touchstone_mcp.egg-info/PKG-INFO
7
+ touchstone_mcp.egg-info/SOURCES.txt
8
+ touchstone_mcp.egg-info/dependency_links.txt
9
+ touchstone_mcp.egg-info/entry_points.txt
10
+ touchstone_mcp.egg-info/requires.txt
11
+ touchstone_mcp.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ touchstone-mcp = touchstone_mcp:main
@@ -0,0 +1,8 @@
1
+ clarethium-touchstone>=0.2.0
2
+ fastmcp>=2.0
3
+
4
+ [test]
5
+ pytest>=8.0
6
+ pytest-asyncio>=0.23
7
+ ruff>=0.6
8
+ mypy>=1.10
@@ -0,0 +1 @@
1
+ touchstone_mcp
@@ -0,0 +1,318 @@
1
+ """Touchstone MCP server: hallucination detection for LLM outputs
2
+ without calling another LLM, exposed as Model Context Protocol tools.
3
+
4
+ Install with::
5
+
6
+ pip install touchstone-mcp
7
+
8
+ The ``touchstone-mcp`` console script is registered automatically and
9
+ runs on the stdio transport by default, matching the convention every
10
+ MCP host (Claude Desktop, Claude Code, Cursor, custom) expects for
11
+ local servers.
12
+
13
+ Programmatic use::
14
+
15
+ from touchstone_mcp import build_server
16
+
17
+ server = build_server()
18
+ server.run() # stdio transport
19
+
20
+ The four tools exposed:
21
+
22
+ * ``verify`` -- calibrated production Verifier. Returns probability,
23
+ scope, signal breakdown, and span-level localization for a
24
+ ``(text, source)`` pair. Use this for the common "is this output
25
+ faithful to its source" decision.
26
+ * ``measure`` -- low-level orchestrator that runs every Touchstone
27
+ Section 5 measurement layer whose preconditions are met. Use this
28
+ when the caller needs the raw layer outputs for drill-down.
29
+ * ``assess_derivation_regime`` -- Layer 11 standalone regime classifier.
30
+ Useful for surfacing a "trust this signal" hint before any
31
+ measurement runs.
32
+ * ``list_modes`` -- enumerate the four Verifier modes and their
33
+ preconditions. Helpful for hosts that present a mode selector.
34
+
35
+ The server uses FastMCP's decorator API. Type hints on the tool
36
+ functions drive the MCP schema; docstrings drive the tool descriptions
37
+ exposed to the host. Measurement semantics and calibration coefficients
38
+ are defined and tested in ``clarethium-touchstone`` (the reference
39
+ implementation); this module is a thin wrapper around its public
40
+ surface.
41
+ """
42
+
43
+ from __future__ import annotations
44
+
45
+ from typing import Any
46
+
47
+ from clarethium_touchstone import (
48
+ VERIFIER_MODES,
49
+ Verifier,
50
+ )
51
+ from clarethium_touchstone import (
52
+ assess_derivation_regime as _assess_derivation_regime,
53
+ )
54
+ from clarethium_touchstone import (
55
+ measure as _measure,
56
+ )
57
+ from clarethium_touchstone._version import (
58
+ __standard_version__,
59
+ )
60
+ from clarethium_touchstone._version import (
61
+ __version__ as _touchstone_lib_version,
62
+ )
63
+ from fastmcp import FastMCP
64
+
65
+ __version__ = "0.1.0"
66
+
67
+ # Module-level Verifier so the calibration coefficients load once and
68
+ # repeated calls reuse them. The Verifier is stateless across calls;
69
+ # each `score()` produces an independent result.
70
+ _VERIFIER = Verifier()
71
+
72
+
73
+ def build_server() -> FastMCP:
74
+ """Construct the Touchstone MCP server.
75
+
76
+ Returns a configured :class:`fastmcp.FastMCP` instance with four
77
+ tools registered. The instance is not started; the caller invokes
78
+ ``server.run()`` (stdio by default) or attaches it to a custom
79
+ transport.
80
+ """
81
+ mcp = FastMCP(
82
+ name="touchstone",
83
+ instructions=(
84
+ "Touchstone: hallucination detection for LLM outputs without "
85
+ "calling another LLM. Call `verify` to score a (text, source) "
86
+ "pair for hallucination probability with span-level localization. "
87
+ "Call `measure` for the raw multi-layer output. Read scope and "
88
+ "scope_notes on every verify result before acting on the "
89
+ "probability."
90
+ ),
91
+ )
92
+
93
+ @mcp.tool()
94
+ def verify(
95
+ text: str,
96
+ source: str,
97
+ minicheck_supported_prob: float | None = None,
98
+ alignscore_supported_prob: float | None = None,
99
+ judge_hallucinated_prob: float | None = None,
100
+ judge_alpha: float = 0.3,
101
+ top_k_unsupported: int = 3,
102
+ ) -> dict[str, Any]:
103
+ """Score a (text, source) pair for hallucination probability.
104
+
105
+ Returns the calibrated probability that ``text`` contains
106
+ unsupported claims relative to ``source``, along with the
107
+ signal breakdown, scope classification, and the top suspect
108
+ sentences with their Layer 11 markers.
109
+
110
+ Args:
111
+ text: The AI-generated output to verify.
112
+ source: The grounding source the output should be supported
113
+ by.
114
+ minicheck_supported_prob: Optional MiniCheck supported-
115
+ probability in [0, 1]. When supplied, the verifier
116
+ auto-selects ``substrate_plus_minicheck`` mode.
117
+ alignscore_supported_prob: Optional AlignScore supported-
118
+ probability in [0, 1]. Combine with MiniCheck for
119
+ ``substrate_plus_minicheck_alignscore`` mode.
120
+ judge_hallucinated_prob: Optional LLM-judge probability of
121
+ hallucination in [0, 1]. Auto-selects
122
+ ``substrate_plus_judge`` mode. Mutually exclusive with
123
+ the MiniCheck / AlignScore parameters in the same call.
124
+ judge_alpha: Substrate weight in the substrate+judge blend.
125
+ Defaults to 0.3 (cross-corpus mean from the published
126
+ holdout-blend table). Tune on held-out data.
127
+ top_k_unsupported: Maximum number of suspect spans to
128
+ return. Defaults to 3.
129
+
130
+ Returns:
131
+ A dict with keys ``prob_hallucinated`` (float in [0, 1]),
132
+ ``mode`` (which calibration mode produced the score),
133
+ ``scope`` (``"validated"`` / ``"limited_signal"`` /
134
+ ``"insufficient_input"`` -- see scope_notes for the
135
+ classification reason), ``scope_notes`` (list of
136
+ diagnostic strings), ``signal_breakdown`` (per-feature
137
+ logit contributions), and ``top_unsupported`` (list of
138
+ sentence-level dicts with ``sentence``, ``sentence_index``,
139
+ ``layer11_primary``, ``p_markers``, ``grounding_score``).
140
+
141
+ Threshold guidance: the default decision threshold of 0.5
142
+ under-flags on every published external corpus. F1-optimal
143
+ thresholds in the empirical-validation tables are 0.07-0.27.
144
+ Tune on your held-out data before any production deployment.
145
+ """
146
+ result = _VERIFIER.score(
147
+ text=text,
148
+ source=source,
149
+ minicheck_supported_prob=minicheck_supported_prob,
150
+ alignscore_supported_prob=alignscore_supported_prob,
151
+ judge_hallucinated_prob=judge_hallucinated_prob,
152
+ judge_alpha=judge_alpha,
153
+ top_k_unsupported=top_k_unsupported,
154
+ )
155
+ return {
156
+ "prob_hallucinated": result.prob_hallucinated,
157
+ "mode": result.mode,
158
+ "scope": result.scope,
159
+ "scope_notes": list(result.scope_notes),
160
+ "signal_breakdown": dict(result.signal_breakdown),
161
+ "top_unsupported": [
162
+ {
163
+ "sentence": span.sentence,
164
+ "sentence_index": span.sentence_index,
165
+ "layer11_primary": span.layer11_primary,
166
+ "p_markers": list(span.p_markers),
167
+ "grounding_score": span.grounding_score,
168
+ }
169
+ for span in result.top_unsupported
170
+ ],
171
+ }
172
+
173
+ @mcp.tool()
174
+ def measure(
175
+ text: str,
176
+ source: str | None = None,
177
+ topic: str | None = None,
178
+ comparisons: list[str] | None = None,
179
+ ) -> dict[str, Any]:
180
+ """Run every Touchstone measurement layer whose preconditions
181
+ are met.
182
+
183
+ This is the lower-level companion to ``verify``. Returns the
184
+ full ``MeasureResult`` keyed by layer name; source-dependent
185
+ layers (4, 5, 6, 8, 11) return ``None`` when ``source`` is
186
+ absent.
187
+
188
+ Args:
189
+ text: The AI-generated output to measure.
190
+ source: Optional grounding source. Required for Layers 4,
191
+ 5, 6, 8, and 11.
192
+ topic: Optional topic string for Layer 1a (heading
193
+ defaultness). Layer 1a additionally requires a caller-
194
+ supplied baseline-generator callable, which the MCP
195
+ tool does not currently expose; passing ``topic``
196
+ without a baseline generator produces a Layer 1a
197
+ output of ``None``.
198
+ comparisons: Optional list of other independently-generated
199
+ versions of the output for Layer 3 (temporal
200
+ instability).
201
+
202
+ Returns:
203
+ The full MeasureResult dict keyed by layer name:
204
+ ``structural_profile``, ``claim_density``,
205
+ ``temporal_instability``, ``source_matching``,
206
+ ``entity_provenance``, ``vocabulary_proximity``,
207
+ ``presentation_features``, ``epistemic_calibration``,
208
+ ``information_novelty``, ``quality_profile``,
209
+ ``grounding_decomposition``.
210
+ """
211
+ return dict(_measure(text, source=source, topic=topic, comparisons=comparisons))
212
+
213
+ @mcp.tool()
214
+ def assess_derivation_regime(source_num_count: int) -> dict[str, Any]:
215
+ """Classify the reliability of Layer 11's derivation checker
216
+ for a given source.
217
+
218
+ Layer 11's primary unsourced-numbers signal saturates as the
219
+ source's unique-number count grows. This tool returns the
220
+ regime classification (``"diagnostic"`` for source_num_count
221
+ < 5, ``"transition"`` for [5, 10), ``"saturated"`` for >= 10)
222
+ and the user-facing guidance text.
223
+
224
+ Use this before running ``measure`` or ``verify`` to surface
225
+ a "trust this signal" hint to the user. On saturated sources,
226
+ the result's guidance string directs callers to Layer 4
227
+ source matching for numerical fabrication detection rather
228
+ than to Layer 11.
229
+
230
+ Args:
231
+ source_num_count: Count of digit-formatted numbers in the
232
+ source text.
233
+
234
+ Returns:
235
+ A dict with ``derivation_regime``, ``source_num_count``,
236
+ ``cross_reference_layer_4_for_numbers``,
237
+ ``note_user_facing``, and other regime metadata.
238
+ """
239
+ return dict(_assess_derivation_regime(source_num_count=source_num_count))
240
+
241
+ @mcp.tool()
242
+ def list_modes() -> dict[str, Any]:
243
+ """Enumerate the four Verifier modes and their required inputs.
244
+
245
+ Returns a dict with the mode list and per-mode metadata so the
246
+ host can present a mode selector to the user without
247
+ re-deriving the mode-selection rules.
248
+
249
+ Returns:
250
+ A dict with ``modes`` (list of mode metadata dicts) and
251
+ ``versions`` (clarethium_touchstone library version,
252
+ Touchstone Standard version, MCP server version).
253
+ """
254
+ modes: list[dict[str, Any]] = [
255
+ {
256
+ "name": "substrate_only",
257
+ "requires": [],
258
+ "description": (
259
+ "Default. No external dependencies. Sub-100 ms per "
260
+ "5 KB document. AUC ~ 0.67-0.76 on the three external "
261
+ "summarization corpora."
262
+ ),
263
+ },
264
+ {
265
+ "name": "substrate_plus_minicheck",
266
+ "requires": ["minicheck_supported_prob"],
267
+ "description": (
268
+ "Add the MiniCheck Flan-T5-Large supported-probability. AUC ~ 0.76."
269
+ ),
270
+ },
271
+ {
272
+ "name": "substrate_plus_minicheck_alignscore",
273
+ "requires": [
274
+ "minicheck_supported_prob",
275
+ "alignscore_supported_prob",
276
+ ],
277
+ "description": ("Add both LLM-based baselines. AUC ~ 0.77."),
278
+ },
279
+ {
280
+ "name": "substrate_plus_judge",
281
+ "requires": ["judge_hallucinated_prob"],
282
+ "description": (
283
+ "Linear-blend the substrate probability with a frontier "
284
+ "LLM judge probability. AUC ranges 0.78-0.94 on the "
285
+ "published corpora depending on judge vendor and "
286
+ "cued/blind variant. Mutually exclusive with MiniCheck "
287
+ "/ AlignScore in the same call."
288
+ ),
289
+ },
290
+ ]
291
+ assert tuple(m["name"] for m in modes) == VERIFIER_MODES, (
292
+ "mode metadata drifted from VERIFIER_MODES"
293
+ )
294
+ return {
295
+ "modes": modes,
296
+ "versions": {
297
+ "touchstone_library": _touchstone_lib_version,
298
+ "touchstone_standard": __standard_version__,
299
+ "touchstone_mcp_server": __version__,
300
+ },
301
+ }
302
+
303
+ return mcp
304
+
305
+
306
+ def main() -> None:
307
+ """Entry point for the ``touchstone-mcp`` console script.
308
+
309
+ Runs the server on the default stdio transport, which is the
310
+ transport every MCP host (Claude Desktop, Claude Code, Cursor)
311
+ expects for local servers.
312
+ """
313
+ server = build_server()
314
+ server.run()
315
+
316
+
317
+ if __name__ == "__main__":
318
+ main()