certainlogic-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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CertainLogic AI
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,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: certainlogic-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP server for CertainLogic Brain API — verified fact lookup for AI agents
5
+ Author: CertainLogic AI
6
+ License: MIT
7
+ Project-URL: Homepage, https://certainlogic.ai
8
+ Project-URL: Repository, https://github.com/CertainLogicAI/certainlogic-mcp
9
+ Requires-Python: >=3.10
10
+ License-File: LICENSE
11
+ Requires-Dist: mcp[cli]>=1.0
12
+ Requires-Dist: httpx>=0.27
13
+ Requires-Dist: python-dotenv>=1.0
14
+ Requires-Dist: pydantic>=2.0
15
+ Dynamic: license-file
@@ -0,0 +1,124 @@
1
+ # CertainLogic MCP Server
2
+
3
+ Verified fact lookup for AI agents via the Brain API. Eliminates hallucinations on covered domains.
4
+
5
+ **PyPI version** | **Python 3.10+** | **License MIT**
6
+
7
+ ## What It Does
8
+
9
+ AI agents hallucinate on factual questions. CertainLogic provides a pre-verified fact database + hallucination guard that returns:
10
+
11
+ - **Verified answer** — when the fact is in our database
12
+ - **Honest `uncertain`** — when we don't know (instead of guessing)
13
+ - **Hallucination detection** — when given a claim + source text
14
+
15
+ The MCP server wraps this as tools your agent can call automatically.
16
+
17
+ ## Quick Start
18
+
19
+ ### 1. Install
20
+
21
+ ```bash
22
+ pip install certainlogic-mcp
23
+ # or: uv add certainlogic-mcp
24
+ ```
25
+
26
+ ### 2. Set Your API Key
27
+
28
+ ```bash
29
+ export BRAIN_API_KEY=your_key_here
30
+ # Free tier: 100 queries/day at https://certainlogic.ai/signup
31
+ ```
32
+
33
+ ### 3. Add to Claude Code
34
+
35
+ ```bash
36
+ claude mcp add certainlogic-brain -- certainlogic-mcp
37
+ ```
38
+
39
+ Or manually, add to `.claude/settings.json`:
40
+
41
+ ```json
42
+ {
43
+ "mcpServers": {
44
+ "certainlogic-brain": {
45
+ "command": "certainlogic-mcp",
46
+ "env": {
47
+ "BRAIN_API_KEY": "your_key_here"
48
+ }
49
+ }
50
+ }
51
+ }
52
+ ```
53
+
54
+ ### 4. Test
55
+
56
+ Ask Claude Code:
57
+
58
+ > "What's the default timeout for Python's requests library?"
59
+
60
+ Claude will call `brain_api_query` and return:
61
+
62
+ > "The default timeout is `None` — requests will hang indefinitely unless you specify a timeout."
63
+
64
+ ## Tools
65
+
66
+ | Tool | Purpose | Returns |
67
+ |---|---|---|
68
+ | `brain_api_query` | Single fact lookup | answer + confident + method |
69
+ | `batch_query` | Validate multiple facts at once | aggregated results with counts |
70
+ | `verify_fact_guard` | Hallucination detection against source text | valid/invalid/unclear |
71
+ | `health_check` | Check Brain API availability | ok / degraded / down |
72
+
73
+ ## Response Methods
74
+
75
+ | Method | Meaning | Speed | Cost |
76
+ |---|---|---|---|
77
+ | `cache` | Semantic cache hit | < 50ms | $0 |
78
+ | `facts` | Pre-verified fact database | < 100ms | $0 |
79
+ | `llm` | LLM validated the answer | 2-5s | ~$0.0001 |
80
+ | `uncertain` | No data, not guessing | 50-100ms | $0 |
81
+
82
+ ## Configuration
83
+
84
+ | Environment Variable | Description | Default |
85
+ |---|---|---|
86
+ | `BRAIN_API_KEY` | Brain API key (required) | — |
87
+ | `BRAIN_API_ENDPOINT` | Query endpoint | `https://api.certainlogic.ai/query` |
88
+ | `BRAIN_VALIDATE_ENDPOINT` | Guard endpoint | `https://api.certainlogic.ai/validate` |
89
+ | `BRAIN_HEALTH_ENDPOINT` | Health endpoint | `https://api.certainlogic.ai/health` |
90
+ | `BRAIN_API_TIMEOUT` | Request timeout (seconds) | `10` |
91
+ | `BRAIN_API_MAX_RETRIES` | Max retries on server errors | `3` |
92
+ | `MCP_LOG_LEVEL` | Logging level | `INFO` |
93
+
94
+ ## Telemetry
95
+
96
+ Each invocation logs a hashed query identifier (SHA-256, first 8 hex chars) with method and latency:
97
+
98
+ ```
99
+ [BRAIN_API] ts=1713456789.123 query_hash=a1b2c3d4 method=facts latency_ms=42
100
+ ```
101
+
102
+ **No PII or query content is logged.** Only hash, method, and timing are recorded.
103
+
104
+ ## Documentation
105
+
106
+ - [Installation Guide](docs/installation.md)
107
+ - [Architecture](docs/architecture.md)
108
+ - [Usage Examples](docs/usage.md)
109
+ - [API Reference](docs/api-reference.md)
110
+
111
+ ## Developing
112
+
113
+ ```bash
114
+ git clone https://github.com/CertainLogicAI/certainlogic-mcp.git
115
+ cd certainlogic-mcp
116
+ pip install -e ".[dev]"
117
+ pytest tests/ -v
118
+ ```
119
+
120
+ ## Links
121
+
122
+ - [CertainLogic](https://certainlogic.ai)
123
+ - [GitHub Repository](https://github.com/CertainLogicAI/certainlogic-mcp)
124
+ - [Issues](https://github.com/CertainLogicAI/certainlogic-mcp/issues)
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "certainlogic-mcp"
7
+ version = "0.1.0"
8
+ description = "MCP server for CertainLogic Brain API — verified fact lookup for AI agents"
9
+ requires-python = ">=3.10"
10
+ dependencies = [
11
+ "mcp[cli]>=1.0",
12
+ "httpx>=0.27",
13
+ "python-dotenv>=1.0",
14
+ "pydantic>=2.0",
15
+ ]
16
+
17
+ [project.urls]
18
+ Homepage = "https://certainlogic.ai"
19
+ Repository = "https://github.com/CertainLogicAI/certainlogic-mcp"
20
+
21
+ [project.license]
22
+ text = "MIT"
23
+
24
+ [[project.authors]]
25
+ name = "CertainLogic AI"
26
+
27
+ [project.scripts]
28
+ certainlogic-mcp = "certainlogic_mcp.server:main"
29
+
30
+ [tool.setuptools.package-data]
31
+ certainlogic_mcp = ["free_tier_facts.json"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,2 @@
1
+ """CertainLogic MCP Server — verified fact lookup for AI agents."""
2
+ __version__ = "0.1.0"