mcp-chipradar 0.2.1__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.
- mcp_chipradar-0.2.1/LICENSE +17 -0
- mcp_chipradar-0.2.1/PKG-INFO +187 -0
- mcp_chipradar-0.2.1/README.md +159 -0
- mcp_chipradar-0.2.1/pyproject.toml +46 -0
- mcp_chipradar-0.2.1/setup.cfg +4 -0
- mcp_chipradar-0.2.1/src/mcp_chipradar/__init__.py +14 -0
- mcp_chipradar-0.2.1/src/mcp_chipradar/client.py +256 -0
- mcp_chipradar-0.2.1/src/mcp_chipradar/server.py +61 -0
- mcp_chipradar-0.2.1/src/mcp_chipradar/tools.py +104 -0
- mcp_chipradar-0.2.1/src/mcp_chipradar.egg-info/PKG-INFO +187 -0
- mcp_chipradar-0.2.1/src/mcp_chipradar.egg-info/SOURCES.txt +14 -0
- mcp_chipradar-0.2.1/src/mcp_chipradar.egg-info/dependency_links.txt +1 -0
- mcp_chipradar-0.2.1/src/mcp_chipradar.egg-info/entry_points.txt +2 -0
- mcp_chipradar-0.2.1/src/mcp_chipradar.egg-info/requires.txt +6 -0
- mcp_chipradar-0.2.1/src/mcp_chipradar.egg-info/top_level.txt +1 -0
- mcp_chipradar-0.2.1/tests/test_tools.py +38 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2026 RevenueClaw LLC
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-chipradar
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: MCP server for the ChipRadar hardware pricing API
|
|
5
|
+
Author-email: ChipRadar <dev@chipradar.io>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://chipradar.io/developers
|
|
8
|
+
Project-URL: Repository, https://github.com/RevenueClaw/mcp-chipradar
|
|
9
|
+
Project-URL: Issues, https://github.com/RevenueClaw/mcp-chipradar/issues
|
|
10
|
+
Keywords: mcp,chipradar,hardware,pricing,sbc
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: httpx>=0.27
|
|
23
|
+
Requires-Dist: mcp<2.0.0,>=1.12.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# mcp-chipradar
|
|
30
|
+
|
|
31
|
+
A Model Context Protocol (MCP) server that turns the [ChipRadar](https://chipradar.io)
|
|
32
|
+
hardware-pricing API into LLM tools. Query single-board computers, mini PCs,
|
|
33
|
+
vendor prices, deal scores, restock alerts, and LLM-on-board benchmarks directly
|
|
34
|
+
from Claude, Cursor, OpenClaw / RockClaw, n8n, or any MCP host.
|
|
35
|
+
|
|
36
|
+
## Quickstart (no API key needed)
|
|
37
|
+
|
|
38
|
+
The server runs in **demo mode** without `CHIPRADAR_API_KEY`, returning public
|
|
39
|
+
demo data and clear setup instructions so registry reviewers can test it in a
|
|
40
|
+
single copy-paste.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# uv / pipx install from the repo sub-directory
|
|
44
|
+
pipx install git+https://github.com/RevenueClaw/chipradar.git#subdirectory=mcp-chipradar
|
|
45
|
+
|
|
46
|
+
# or clone and install locally
|
|
47
|
+
git clone https://github.com/RevenueClaw/chipradar.git
|
|
48
|
+
cd chipradar/mcp-chipradar
|
|
49
|
+
pip install -e .
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Then add an MCP config block below. Without an API key, `get_boards` returns
|
|
53
|
+
sample public boards from `https://chipradar.io/api/products/current`; other tools
|
|
54
|
+
return the same public sample plus a registration note.
|
|
55
|
+
|
|
56
|
+
## API key setup
|
|
57
|
+
|
|
58
|
+
Get a free key instantly at [chipradar.io/api/keys](https://chipradar.io/api/keys)
|
|
59
|
+
(no approval). Paid tiers unlock higher rate limits and features such as
|
|
60
|
+
90-day price history and LLM benchmarks.
|
|
61
|
+
|
|
62
|
+
Prefer marketplace billing? The API is also listed on
|
|
63
|
+
[RapidAPI](https://rapidapi.com/RevenueClaw/api/chipradar-ai-compute-hardware-pricing-api1)
|
|
64
|
+
with matching BASIC/PRO/ULTRA/MEGA plans.
|
|
65
|
+
|
|
66
|
+
| Tier | Price | Monthly cap | Per-minute | Unlocks |
|
|
67
|
+
|---|---|---|---|---|
|
|
68
|
+
| **Sandbox / Free** | `$0/mo` | 100 | 5 | current deals, basic specs |
|
|
69
|
+
| **Indie / Builder** | `$12/mo` | 5,000 | 30 | 90-day history, MCP access, **LLM benchmarks** |
|
|
70
|
+
| **Pro / Growth** | `$49/mo` | 50,000 | 120 | full history, restock webhooks |
|
|
71
|
+
| **Enterprise / Supply Chain** | `$199/mo` | 250,000+ | 600 | bulk exports, priority webhooks, custom SKUs |
|
|
72
|
+
|
|
73
|
+
Set these environment variables wherever you run the server:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
export CHIPRADAR_API_KEY="sk_cr_..." # required for live B2B data
|
|
77
|
+
export CHIPRADAR_API_BASE="https://chipradar.io/api/v1" # optional
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## MCP config snippets
|
|
81
|
+
|
|
82
|
+
### OpenClaw / RockClaw (`~/.openclaw/mcp.json` or Control UI)
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"mcpServers": {
|
|
87
|
+
"chipradar": {
|
|
88
|
+
"command": "mcp-chipradar",
|
|
89
|
+
"env": {
|
|
90
|
+
"CHIPRADAR_API_KEY": "sk_cr_...",
|
|
91
|
+
"CHIPRADAR_API_BASE": "https://chipradar.io/api/v1"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Claude Desktop (`claude_desktop_config.json`)
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"mcpServers": {
|
|
103
|
+
"chipradar": {
|
|
104
|
+
"command": "mcp-chipradar",
|
|
105
|
+
"env": {
|
|
106
|
+
"CHIPRADAR_API_KEY": "sk_cr_...",
|
|
107
|
+
"CHIPRADAR_API_BASE": "https://chipradar.io/api/v1"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Cursor (Settings → MCP → Add server)
|
|
115
|
+
|
|
116
|
+
Use **Type: Command** and paste:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
CHIPRADAR_API_KEY=sk_cr_... CHIPRADAR_API_BASE=https://chipradar.io/api/v1 mcp-chipradar
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Or add to your shell profile and just run `mcp-chipradar`.
|
|
123
|
+
|
|
124
|
+
### n8n (HTTP Request or MCP node)
|
|
125
|
+
|
|
126
|
+
Point the n8n MCP node at the stdio command:
|
|
127
|
+
|
|
128
|
+
```text
|
|
129
|
+
Command: mcp-chipradar
|
|
130
|
+
Environment Variables:
|
|
131
|
+
CHIPRADAR_API_KEY = sk_cr_...
|
|
132
|
+
CHIPRADAR_API_BASE = https://chipradar.io/api/v1
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Tools
|
|
136
|
+
|
|
137
|
+
- `get_boards(family=None, brand=None, limit=20)` — list tracked boards with specs and the best in-stock vendor price.
|
|
138
|
+
- `get_board_history(asin, days=30)` — historical vendor price points for a board.
|
|
139
|
+
- `get_deals(min_score=0, limit=20)` — boards priced below MSRP, sorted by deal score.
|
|
140
|
+
- `get_restock_alerts(limit=20)` — aggregated public restock signals.
|
|
141
|
+
- `get_best_inference_provider(model, priority="balanced")` — recommend the best cloud inference provider for a model by cost, latency, or balanced score. Requires a paid API key; keyless mode returns a demo note + static provider list.
|
|
142
|
+
- `calculate_cloud_vs_local_breakeven(daily_tokens, model)` — compare 30-day cloud inference spend vs. buying a local board (cheapest in-stock non-Amazon price + on-device throughput). Requires a paid API key; keyless mode returns demo instructions + a sample board.
|
|
143
|
+
|
|
144
|
+
> **Note:** `get_board_history` and `get_deals` return free-tier limits unless
|
|
145
|
+
the active key is Indie or higher. LLM benchmark data lives at
|
|
146
|
+
`GET /api/v1/benchmarks/llm` and requires the **Indie/Builder tier or above**
|
|
147
|
+
($12/mo); it is available via the API. The two new inference tools call
|
|
148
|
+
`GET /api/v1/inference/recommend` and `GET /api/v1/inference/breakeven`
|
|
149
|
+
respectively.
|
|
150
|
+
|
|
151
|
+
## Example prompts
|
|
152
|
+
|
|
153
|
+
1. *“Find me the cheapest in-stock 8 GB ARM board right now.”*
|
|
154
|
+
→ `get_boards(brand="Raspberry Pi", limit=10)` or `get_deals(limit=10)`
|
|
155
|
+
|
|
156
|
+
2. *“Show me the 90-day price history for Raspberry Pi 5 8 GB.”*
|
|
157
|
+
→ `get_board_history(asin="B0CK2FCG1K", days=90)`
|
|
158
|
+
|
|
159
|
+
3. *“What is the best sub-$500 mini PC for running Qwen 32B by tokens-per-dollar?”*
|
|
160
|
+
→ `get_boards(family="mini_pc", limit=20)`, then use the **Indie+ API**
|
|
161
|
+
`GET /api/v1/benchmarks/llm?platform=mini_pc` to rank by
|
|
162
|
+
`perf_per_dollar` (tokens/sec per dollar) and filter by `usd_price < 500`.
|
|
163
|
+
|
|
164
|
+
## Running keyless (demo mode)
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
CHIPRADAR_API_BASE=https://bad-host.example mcp-chipradar
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
With no `CHIPRADAR_API_KEY`, the server ignores `CHIPRADAR_API_BASE` and serves
|
|
171
|
+
public demo data with registration instructions instead of crashing.
|
|
172
|
+
|
|
173
|
+
## Telemetry / limits
|
|
174
|
+
|
|
175
|
+
Every live response includes `X-RateLimit-*` headers. The free Sandbox tier is
|
|
176
|
+
100 requests/month and 5 requests/minute — plenty for evaluation.
|
|
177
|
+
|
|
178
|
+
## Changelog
|
|
179
|
+
|
|
180
|
+
- **0.2.0** — Added inference telemetry tools:
|
|
181
|
+
- `get_best_inference_provider(model, priority)`
|
|
182
|
+
- `calculate_cloud_vs_local_breakeven(daily_tokens, model)`
|
|
183
|
+
- Keyless demo mode now returns a registration note + static provider/sample-board list so the server boots cleanly without `CHIPRADAR_API_KEY`.
|
|
184
|
+
|
|
185
|
+
## License
|
|
186
|
+
|
|
187
|
+
Apache-2.0 — see [LICENSE](./LICENSE) in this package.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# mcp-chipradar
|
|
2
|
+
|
|
3
|
+
A Model Context Protocol (MCP) server that turns the [ChipRadar](https://chipradar.io)
|
|
4
|
+
hardware-pricing API into LLM tools. Query single-board computers, mini PCs,
|
|
5
|
+
vendor prices, deal scores, restock alerts, and LLM-on-board benchmarks directly
|
|
6
|
+
from Claude, Cursor, OpenClaw / RockClaw, n8n, or any MCP host.
|
|
7
|
+
|
|
8
|
+
## Quickstart (no API key needed)
|
|
9
|
+
|
|
10
|
+
The server runs in **demo mode** without `CHIPRADAR_API_KEY`, returning public
|
|
11
|
+
demo data and clear setup instructions so registry reviewers can test it in a
|
|
12
|
+
single copy-paste.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# uv / pipx install from the repo sub-directory
|
|
16
|
+
pipx install git+https://github.com/RevenueClaw/chipradar.git#subdirectory=mcp-chipradar
|
|
17
|
+
|
|
18
|
+
# or clone and install locally
|
|
19
|
+
git clone https://github.com/RevenueClaw/chipradar.git
|
|
20
|
+
cd chipradar/mcp-chipradar
|
|
21
|
+
pip install -e .
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then add an MCP config block below. Without an API key, `get_boards` returns
|
|
25
|
+
sample public boards from `https://chipradar.io/api/products/current`; other tools
|
|
26
|
+
return the same public sample plus a registration note.
|
|
27
|
+
|
|
28
|
+
## API key setup
|
|
29
|
+
|
|
30
|
+
Get a free key instantly at [chipradar.io/api/keys](https://chipradar.io/api/keys)
|
|
31
|
+
(no approval). Paid tiers unlock higher rate limits and features such as
|
|
32
|
+
90-day price history and LLM benchmarks.
|
|
33
|
+
|
|
34
|
+
Prefer marketplace billing? The API is also listed on
|
|
35
|
+
[RapidAPI](https://rapidapi.com/RevenueClaw/api/chipradar-ai-compute-hardware-pricing-api1)
|
|
36
|
+
with matching BASIC/PRO/ULTRA/MEGA plans.
|
|
37
|
+
|
|
38
|
+
| Tier | Price | Monthly cap | Per-minute | Unlocks |
|
|
39
|
+
|---|---|---|---|---|
|
|
40
|
+
| **Sandbox / Free** | `$0/mo` | 100 | 5 | current deals, basic specs |
|
|
41
|
+
| **Indie / Builder** | `$12/mo` | 5,000 | 30 | 90-day history, MCP access, **LLM benchmarks** |
|
|
42
|
+
| **Pro / Growth** | `$49/mo` | 50,000 | 120 | full history, restock webhooks |
|
|
43
|
+
| **Enterprise / Supply Chain** | `$199/mo` | 250,000+ | 600 | bulk exports, priority webhooks, custom SKUs |
|
|
44
|
+
|
|
45
|
+
Set these environment variables wherever you run the server:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
export CHIPRADAR_API_KEY="sk_cr_..." # required for live B2B data
|
|
49
|
+
export CHIPRADAR_API_BASE="https://chipradar.io/api/v1" # optional
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## MCP config snippets
|
|
53
|
+
|
|
54
|
+
### OpenClaw / RockClaw (`~/.openclaw/mcp.json` or Control UI)
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"mcpServers": {
|
|
59
|
+
"chipradar": {
|
|
60
|
+
"command": "mcp-chipradar",
|
|
61
|
+
"env": {
|
|
62
|
+
"CHIPRADAR_API_KEY": "sk_cr_...",
|
|
63
|
+
"CHIPRADAR_API_BASE": "https://chipradar.io/api/v1"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Claude Desktop (`claude_desktop_config.json`)
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"mcpServers": {
|
|
75
|
+
"chipradar": {
|
|
76
|
+
"command": "mcp-chipradar",
|
|
77
|
+
"env": {
|
|
78
|
+
"CHIPRADAR_API_KEY": "sk_cr_...",
|
|
79
|
+
"CHIPRADAR_API_BASE": "https://chipradar.io/api/v1"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Cursor (Settings → MCP → Add server)
|
|
87
|
+
|
|
88
|
+
Use **Type: Command** and paste:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
CHIPRADAR_API_KEY=sk_cr_... CHIPRADAR_API_BASE=https://chipradar.io/api/v1 mcp-chipradar
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Or add to your shell profile and just run `mcp-chipradar`.
|
|
95
|
+
|
|
96
|
+
### n8n (HTTP Request or MCP node)
|
|
97
|
+
|
|
98
|
+
Point the n8n MCP node at the stdio command:
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
Command: mcp-chipradar
|
|
102
|
+
Environment Variables:
|
|
103
|
+
CHIPRADAR_API_KEY = sk_cr_...
|
|
104
|
+
CHIPRADAR_API_BASE = https://chipradar.io/api/v1
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Tools
|
|
108
|
+
|
|
109
|
+
- `get_boards(family=None, brand=None, limit=20)` — list tracked boards with specs and the best in-stock vendor price.
|
|
110
|
+
- `get_board_history(asin, days=30)` — historical vendor price points for a board.
|
|
111
|
+
- `get_deals(min_score=0, limit=20)` — boards priced below MSRP, sorted by deal score.
|
|
112
|
+
- `get_restock_alerts(limit=20)` — aggregated public restock signals.
|
|
113
|
+
- `get_best_inference_provider(model, priority="balanced")` — recommend the best cloud inference provider for a model by cost, latency, or balanced score. Requires a paid API key; keyless mode returns a demo note + static provider list.
|
|
114
|
+
- `calculate_cloud_vs_local_breakeven(daily_tokens, model)` — compare 30-day cloud inference spend vs. buying a local board (cheapest in-stock non-Amazon price + on-device throughput). Requires a paid API key; keyless mode returns demo instructions + a sample board.
|
|
115
|
+
|
|
116
|
+
> **Note:** `get_board_history` and `get_deals` return free-tier limits unless
|
|
117
|
+
the active key is Indie or higher. LLM benchmark data lives at
|
|
118
|
+
`GET /api/v1/benchmarks/llm` and requires the **Indie/Builder tier or above**
|
|
119
|
+
($12/mo); it is available via the API. The two new inference tools call
|
|
120
|
+
`GET /api/v1/inference/recommend` and `GET /api/v1/inference/breakeven`
|
|
121
|
+
respectively.
|
|
122
|
+
|
|
123
|
+
## Example prompts
|
|
124
|
+
|
|
125
|
+
1. *“Find me the cheapest in-stock 8 GB ARM board right now.”*
|
|
126
|
+
→ `get_boards(brand="Raspberry Pi", limit=10)` or `get_deals(limit=10)`
|
|
127
|
+
|
|
128
|
+
2. *“Show me the 90-day price history for Raspberry Pi 5 8 GB.”*
|
|
129
|
+
→ `get_board_history(asin="B0CK2FCG1K", days=90)`
|
|
130
|
+
|
|
131
|
+
3. *“What is the best sub-$500 mini PC for running Qwen 32B by tokens-per-dollar?”*
|
|
132
|
+
→ `get_boards(family="mini_pc", limit=20)`, then use the **Indie+ API**
|
|
133
|
+
`GET /api/v1/benchmarks/llm?platform=mini_pc` to rank by
|
|
134
|
+
`perf_per_dollar` (tokens/sec per dollar) and filter by `usd_price < 500`.
|
|
135
|
+
|
|
136
|
+
## Running keyless (demo mode)
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
CHIPRADAR_API_BASE=https://bad-host.example mcp-chipradar
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
With no `CHIPRADAR_API_KEY`, the server ignores `CHIPRADAR_API_BASE` and serves
|
|
143
|
+
public demo data with registration instructions instead of crashing.
|
|
144
|
+
|
|
145
|
+
## Telemetry / limits
|
|
146
|
+
|
|
147
|
+
Every live response includes `X-RateLimit-*` headers. The free Sandbox tier is
|
|
148
|
+
100 requests/month and 5 requests/minute — plenty for evaluation.
|
|
149
|
+
|
|
150
|
+
## Changelog
|
|
151
|
+
|
|
152
|
+
- **0.2.0** — Added inference telemetry tools:
|
|
153
|
+
- `get_best_inference_provider(model, priority)`
|
|
154
|
+
- `calculate_cloud_vs_local_breakeven(daily_tokens, model)`
|
|
155
|
+
- Keyless demo mode now returns a registration note + static provider/sample-board list so the server boots cleanly without `CHIPRADAR_API_KEY`.
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
Apache-2.0 — see [LICENSE](./LICENSE) in this package.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mcp-chipradar"
|
|
7
|
+
version = "0.2.1"
|
|
8
|
+
description = "MCP server for the ChipRadar hardware pricing API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = {text = "Apache-2.0"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "ChipRadar", email = "dev@chipradar.io"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["mcp", "chipradar", "hardware", "pricing", "sbc"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: Apache Software License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"httpx>=0.27",
|
|
28
|
+
"mcp>=1.12.0,<2.0.0",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
dev = ["pytest>=7.0", "pytest-asyncio>=0.21"]
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://chipradar.io/developers"
|
|
36
|
+
Repository = "https://github.com/RevenueClaw/mcp-chipradar"
|
|
37
|
+
Issues = "https://github.com/RevenueClaw/mcp-chipradar/issues"
|
|
38
|
+
|
|
39
|
+
[project.scripts]
|
|
40
|
+
mcp-chipradar = "mcp_chipradar.server:main"
|
|
41
|
+
|
|
42
|
+
[tool.setuptools.packages.find]
|
|
43
|
+
where = ["src"]
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.package-dir]
|
|
46
|
+
"" = "src"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""mcp-chipradar — MCP server for the ChipRadar hardware pricing API."""
|
|
2
|
+
|
|
3
|
+
from .client import ChipRadarClient
|
|
4
|
+
from .tools import get_boards, get_board_history, get_deals, get_restock_alerts
|
|
5
|
+
|
|
6
|
+
__all__ = [
|
|
7
|
+
"ChipRadarClient",
|
|
8
|
+
"get_boards",
|
|
9
|
+
"get_board_history",
|
|
10
|
+
"get_deals",
|
|
11
|
+
"get_restock_alerts",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
__version__ = "0.2.0"
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"""Low-level async HTTP client for the ChipRadar B2B API."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from typing import Any, Dict, List, Optional
|
|
5
|
+
|
|
6
|
+
import httpx
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
REGISTRATION_INSTRUCTIONS = (
|
|
10
|
+
"This response is running in DEMO mode because CHIPRADAR_API_KEY is not set. "
|
|
11
|
+
"Register for an instant free API key at chipradar.io/api/keys "
|
|
12
|
+
"(100 requests/mo, 5 requests/min) and set CHIPRADAR_API_KEY. "
|
|
13
|
+
"See chipradar.io/developers for paid tiers."
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ChipRadarClient:
|
|
18
|
+
"""Thin async client for ChipRadar B2B endpoints."""
|
|
19
|
+
|
|
20
|
+
def __init__(
|
|
21
|
+
self,
|
|
22
|
+
api_key: Optional[str] = None,
|
|
23
|
+
base_url: Optional[str] = None,
|
|
24
|
+
timeout: float = 30.0,
|
|
25
|
+
public_base: str = "https://chipradar.io",
|
|
26
|
+
):
|
|
27
|
+
self.api_key = api_key or os.environ.get("CHIPRADAR_API_KEY")
|
|
28
|
+
self.base_url = (base_url or os.environ.get(
|
|
29
|
+
"CHIPRADAR_API_BASE", "https://chipradar.io/api/v1"
|
|
30
|
+
)).rstrip("/")
|
|
31
|
+
self.public_base = public_base.rstrip("/")
|
|
32
|
+
self.timeout = timeout
|
|
33
|
+
self.demo_mode = not bool(self.api_key)
|
|
34
|
+
|
|
35
|
+
def _headers(self) -> Dict[str, str]:
|
|
36
|
+
if not self.api_key:
|
|
37
|
+
return {}
|
|
38
|
+
return {"Authorization": f"Bearer {self.api_key}"}
|
|
39
|
+
|
|
40
|
+
async def request(
|
|
41
|
+
self,
|
|
42
|
+
method: str,
|
|
43
|
+
path: str,
|
|
44
|
+
params: Optional[Dict[str, Any]] = None,
|
|
45
|
+
json_body: Optional[Dict[str, Any]] = None,
|
|
46
|
+
) -> Dict[str, Any]:
|
|
47
|
+
if self.demo_mode:
|
|
48
|
+
raise RuntimeError(
|
|
49
|
+
"Authenticated ChipRadar endpoints require CHIPRADAR_API_KEY. "
|
|
50
|
+
"Register at chipradar.io/api/keys for an instant free key."
|
|
51
|
+
)
|
|
52
|
+
async with httpx.AsyncClient(
|
|
53
|
+
base_url=self.base_url, timeout=self.timeout
|
|
54
|
+
) as client:
|
|
55
|
+
response = await client.request(
|
|
56
|
+
method,
|
|
57
|
+
path,
|
|
58
|
+
params=params,
|
|
59
|
+
json=json_body,
|
|
60
|
+
headers=self._headers(),
|
|
61
|
+
)
|
|
62
|
+
if response.status_code == 401:
|
|
63
|
+
raise RuntimeError(
|
|
64
|
+
f"ChipRadar API 401 Unauthorized — check CHIPRADAR_API_KEY. "
|
|
65
|
+
f"{response.text}"
|
|
66
|
+
)
|
|
67
|
+
if response.status_code == 429:
|
|
68
|
+
raise RuntimeError(
|
|
69
|
+
f"ChipRadar API 429 Rate limit exceeded. "
|
|
70
|
+
f"Headers: {dict(response.headers)}"
|
|
71
|
+
)
|
|
72
|
+
response.raise_for_status()
|
|
73
|
+
return response.json()
|
|
74
|
+
|
|
75
|
+
async def _fetch_public_demo_products(self) -> list:
|
|
76
|
+
url = f"{self.public_base}/api/products/current"
|
|
77
|
+
try:
|
|
78
|
+
async with httpx.AsyncClient(timeout=self.timeout) as client:
|
|
79
|
+
response = await client.get(url)
|
|
80
|
+
response.raise_for_status()
|
|
81
|
+
data = response.json() or {}
|
|
82
|
+
products = data.get("products") if isinstance(data, dict) else None
|
|
83
|
+
return products if isinstance(products, list) else []
|
|
84
|
+
except Exception as exc:
|
|
85
|
+
return [{"_demo_fetch_error": str(exc), "source": url}]
|
|
86
|
+
|
|
87
|
+
def _demo_payload(self, products: list) -> Dict[str, Any]:
|
|
88
|
+
return {
|
|
89
|
+
"demo_mode": True,
|
|
90
|
+
"instructions": REGISTRATION_INSTRUCTIONS,
|
|
91
|
+
"public_source": f"{self.public_base}/api/products/current",
|
|
92
|
+
"sample_count": min(len(products), 5),
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@staticmethod
|
|
96
|
+
def _to_demo_board(product: Dict[str, Any]) -> Dict[str, Any]:
|
|
97
|
+
return {
|
|
98
|
+
"name": product.get("name"),
|
|
99
|
+
"sku": product.get("sku"),
|
|
100
|
+
"best_price": product.get("best_price"),
|
|
101
|
+
"stock": product.get("stock"),
|
|
102
|
+
"best_seller": product.get("best_seller"),
|
|
103
|
+
"url": product.get("url"),
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async def get_boards(
|
|
107
|
+
self,
|
|
108
|
+
family: Optional[str] = None,
|
|
109
|
+
brand: Optional[str] = None,
|
|
110
|
+
limit: int = 20,
|
|
111
|
+
offset: int = 0,
|
|
112
|
+
) -> Dict[str, Any]:
|
|
113
|
+
if self.demo_mode:
|
|
114
|
+
products = await self._fetch_public_demo_products()
|
|
115
|
+
payload = self._demo_payload(products)
|
|
116
|
+
filtered = [
|
|
117
|
+
p for p in products
|
|
118
|
+
if not isinstance(p, dict) or not p.get("_demo_fetch_error")
|
|
119
|
+
]
|
|
120
|
+
payload["sample_public_boards"] = [
|
|
121
|
+
self._to_demo_board(p) for p in filtered[:limit]
|
|
122
|
+
]
|
|
123
|
+
payload["note"] = (
|
|
124
|
+
"get_boards demo uses the public product feed. "
|
|
125
|
+
"With CHIPRADAR_API_KEY, this tool returns full board specs and vendor prices."
|
|
126
|
+
)
|
|
127
|
+
return payload
|
|
128
|
+
params: Dict[str, Any] = {"limit": limit, "offset": offset}
|
|
129
|
+
if family:
|
|
130
|
+
params["family"] = family
|
|
131
|
+
if brand:
|
|
132
|
+
params["brand"] = brand
|
|
133
|
+
return await self.request("GET", "/boards", params=params)
|
|
134
|
+
|
|
135
|
+
async def get_board_history(self, asin: str, days: int = 30) -> Dict[str, Any]:
|
|
136
|
+
if self.demo_mode:
|
|
137
|
+
products = await self._fetch_public_demo_products()
|
|
138
|
+
payload = self._demo_payload(products)
|
|
139
|
+
payload["note"] = (
|
|
140
|
+
f"get_board_history({asin!r}, days={days}) requires CHIPRADAR_API_KEY. "
|
|
141
|
+
"Demo returns sample public boards only."
|
|
142
|
+
)
|
|
143
|
+
payload["sample_public_boards"] = [
|
|
144
|
+
self._to_demo_board(p) for p in products[:5]
|
|
145
|
+
]
|
|
146
|
+
return payload
|
|
147
|
+
return await self.request(
|
|
148
|
+
"GET", f"/boards/{asin}/history", params={"days": days}
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
async def get_deals(self, min_score: int = 0, limit: int = 20) -> Dict[str, Any]:
|
|
152
|
+
if self.demo_mode:
|
|
153
|
+
products = await self._fetch_public_demo_products()
|
|
154
|
+
payload = self._demo_payload(products)
|
|
155
|
+
payload["note"] = (
|
|
156
|
+
f"get_deals(min_score={min_score}, limit={limit}) requires CHIPRADAR_API_KEY. "
|
|
157
|
+
"Demo returns sample public boards only."
|
|
158
|
+
)
|
|
159
|
+
payload["sample_public_boards"] = [
|
|
160
|
+
self._to_demo_board(p) for p in products[:limit]
|
|
161
|
+
]
|
|
162
|
+
return payload
|
|
163
|
+
return await self.request(
|
|
164
|
+
"GET", "/deals", params={"min_score": min_score, "limit": limit}
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
async def get_restock_alerts(self, limit: int = 20) -> Dict[str, Any]:
|
|
168
|
+
if self.demo_mode:
|
|
169
|
+
products = await self._fetch_public_demo_products()
|
|
170
|
+
payload = self._demo_payload(products)
|
|
171
|
+
payload["note"] = (
|
|
172
|
+
f"get_restock_alerts(limit={limit}) requires CHIPRADAR_API_KEY. "
|
|
173
|
+
"Demo returns sample public boards only."
|
|
174
|
+
)
|
|
175
|
+
payload["sample_public_boards"] = [
|
|
176
|
+
self._to_demo_board(p) for p in products[:limit]
|
|
177
|
+
]
|
|
178
|
+
return payload
|
|
179
|
+
return await self.request("GET", "/restocks", params={"limit": limit})
|
|
180
|
+
|
|
181
|
+
async def get_best_inference_provider(
|
|
182
|
+
self, model: str, priority: str = "balanced"
|
|
183
|
+
) -> Dict[str, Any]:
|
|
184
|
+
"""GET /api/v1/inference/recommend wrapper."""
|
|
185
|
+
if self.demo_mode:
|
|
186
|
+
return self._inference_demo_payload(
|
|
187
|
+
"get_best_inference_provider",
|
|
188
|
+
model=model,
|
|
189
|
+
priority=priority,
|
|
190
|
+
static_providers=[
|
|
191
|
+
{
|
|
192
|
+
"provider_slug": "openrouter",
|
|
193
|
+
"display_name": "OpenRouter",
|
|
194
|
+
"note": "Live pricing/metrics require a CHIPRADAR_API_KEY.",
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"provider_slug": "together",
|
|
198
|
+
"display_name": "Together AI",
|
|
199
|
+
"note": "Live pricing/metrics require a CHIPRADAR_API_KEY.",
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"provider_slug": "fireworks",
|
|
203
|
+
"display_name": "Fireworks AI",
|
|
204
|
+
"note": "Live pricing/metrics require a CHIPRADAR_API_KEY.",
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
)
|
|
208
|
+
return await self.request(
|
|
209
|
+
"GET",
|
|
210
|
+
"/inference/recommend",
|
|
211
|
+
params={"model": model, "priority": priority},
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
async def calculate_cloud_vs_local_breakeven(
|
|
215
|
+
self, daily_tokens: int, model: str
|
|
216
|
+
) -> Dict[str, Any]:
|
|
217
|
+
"""GET /api/v1/inference/breakeven wrapper."""
|
|
218
|
+
if self.demo_mode:
|
|
219
|
+
return self._inference_demo_payload(
|
|
220
|
+
"calculate_cloud_vs_local_breakeven",
|
|
221
|
+
daily_tokens=daily_tokens,
|
|
222
|
+
model=model,
|
|
223
|
+
static_boards=[
|
|
224
|
+
{
|
|
225
|
+
"asin": "B0CK2FCG1K",
|
|
226
|
+
"name": "Raspberry Pi 5 8GB",
|
|
227
|
+
"note": "Sample board; live prices and benchmarks require a CHIPRADAR_API_KEY.",
|
|
228
|
+
}
|
|
229
|
+
],
|
|
230
|
+
)
|
|
231
|
+
return await self.request(
|
|
232
|
+
"GET",
|
|
233
|
+
"/inference/breakeven",
|
|
234
|
+
params={"daily_tokens": daily_tokens, "model": model},
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
def _inference_demo_payload(
|
|
238
|
+
self,
|
|
239
|
+
tool: str,
|
|
240
|
+
*,
|
|
241
|
+
static_providers: Optional[List[Dict[str, Any]]] = None,
|
|
242
|
+
static_boards: Optional[List[Dict[str, Any]]] = None,
|
|
243
|
+
**kwargs: Any,
|
|
244
|
+
) -> Dict[str, Any]:
|
|
245
|
+
return {
|
|
246
|
+
"demo_mode": True,
|
|
247
|
+
"tool": tool,
|
|
248
|
+
"instructions": REGISTRATION_INSTRUCTIONS,
|
|
249
|
+
"params": kwargs,
|
|
250
|
+
"static_provider_list": static_providers or [],
|
|
251
|
+
"static_sample_boards": static_boards or [],
|
|
252
|
+
"note": (
|
|
253
|
+
f"{tool} requires a paid CHIPRADAR_API_KEY (Indie/Builder tier or above). "
|
|
254
|
+
"This static demo returns placeholder providers/boards, not live metrics or prices."
|
|
255
|
+
),
|
|
256
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""MCP server exposing ChipRadar board tools via stdio."""
|
|
2
|
+
|
|
3
|
+
from mcp.server.fastmcp import FastMCP
|
|
4
|
+
|
|
5
|
+
from . import tools
|
|
6
|
+
|
|
7
|
+
mcp = FastMCP("chipradar")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@mcp.tool()
|
|
11
|
+
async def get_boards(
|
|
12
|
+
family: str | None = None,
|
|
13
|
+
brand: str | None = None,
|
|
14
|
+
limit: int = 20,
|
|
15
|
+
) -> str:
|
|
16
|
+
"""List tracked boards with specs and current best vendor price."""
|
|
17
|
+
return await tools.get_boards(family=family, brand=brand, limit=limit)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@mcp.tool()
|
|
21
|
+
async def get_board_history(asin: str, days: int = 30) -> str:
|
|
22
|
+
"""Get historical vendor price points for a board (ASIN)."""
|
|
23
|
+
return await tools.get_board_history(asin, days=days)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@mcp.tool()
|
|
27
|
+
async def get_deals(min_score: int = 0, limit: int = 20) -> str:
|
|
28
|
+
"""Get current deals sorted by deal score."""
|
|
29
|
+
return await tools.get_deals(min_score=min_score, limit=limit)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@mcp.tool()
|
|
33
|
+
async def get_restock_alerts(limit: int = 20) -> str:
|
|
34
|
+
"""Get aggregated public restock signals."""
|
|
35
|
+
return await tools.get_restock_alerts(limit=limit)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@mcp.tool()
|
|
39
|
+
async def get_best_inference_provider(
|
|
40
|
+
model: str, priority: str = "balanced"
|
|
41
|
+
) -> str:
|
|
42
|
+
"""Recommend the best cloud inference provider for a model."""
|
|
43
|
+
return await tools.get_best_inference_provider(model=model, priority=priority)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@mcp.tool()
|
|
47
|
+
async def calculate_cloud_vs_local_breakeven(
|
|
48
|
+
daily_tokens: int, model: str
|
|
49
|
+
) -> str:
|
|
50
|
+
"""Compare cloud inference cost vs buying and running a local board."""
|
|
51
|
+
return await tools.calculate_cloud_vs_local_breakeven(
|
|
52
|
+
daily_tokens=daily_tokens, model=model
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def main() -> None:
|
|
57
|
+
mcp.run()
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
if __name__ == "__main__":
|
|
61
|
+
main()
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""Tool implementations used by the MCP server."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from typing import Any, Dict, Optional
|
|
5
|
+
|
|
6
|
+
from .client import ChipRadarClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _format_error(tool: str, exc: Exception) -> str:
|
|
10
|
+
payload: Dict[str, Any] = {
|
|
11
|
+
"success": False,
|
|
12
|
+
"tool": tool,
|
|
13
|
+
"error": str(exc),
|
|
14
|
+
"help": (
|
|
15
|
+
"Set CHIPRADAR_API_KEY to use live data (get a free key at "
|
|
16
|
+
"chipradar.io/api/keys). Running keyless returns demo data and "
|
|
17
|
+
"registration instructions."
|
|
18
|
+
),
|
|
19
|
+
}
|
|
20
|
+
return json.dumps(payload, indent=2)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
async def _client() -> ChipRadarClient:
|
|
24
|
+
return ChipRadarClient()
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
async def get_boards(
|
|
28
|
+
family: Optional[str] = None,
|
|
29
|
+
brand: Optional[str] = None,
|
|
30
|
+
limit: int = 20,
|
|
31
|
+
) -> str:
|
|
32
|
+
"""List tracked boards with specs and current best vendor price."""
|
|
33
|
+
try:
|
|
34
|
+
client = await _client()
|
|
35
|
+
data = await client.get_boards(family=family, brand=brand, limit=limit)
|
|
36
|
+
return json.dumps(data, indent=2)
|
|
37
|
+
except Exception as exc:
|
|
38
|
+
return _format_error("get_boards", exc)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
async def get_board_history(asin: str, days: int = 30) -> str:
|
|
42
|
+
"""Get historical vendor price points for a board (ASIN)."""
|
|
43
|
+
try:
|
|
44
|
+
client = await _client()
|
|
45
|
+
data = await client.get_board_history(asin, days=days)
|
|
46
|
+
return json.dumps(data, indent=2)
|
|
47
|
+
except Exception as exc:
|
|
48
|
+
return _format_error("get_board_history", exc)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
async def get_deals(min_score: int = 0, limit: int = 20) -> str:
|
|
52
|
+
"""Get current deals sorted by deal score."""
|
|
53
|
+
try:
|
|
54
|
+
client = await _client()
|
|
55
|
+
data = await client.get_deals(min_score=min_score, limit=limit)
|
|
56
|
+
return json.dumps(data, indent=2)
|
|
57
|
+
except Exception as exc:
|
|
58
|
+
return _format_error("get_deals", exc)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
async def get_restock_alerts(limit: int = 20) -> str:
|
|
62
|
+
"""Get aggregated public restock signals."""
|
|
63
|
+
try:
|
|
64
|
+
client = await _client()
|
|
65
|
+
data = await client.get_restock_alerts(limit=limit)
|
|
66
|
+
return json.dumps(data, indent=2)
|
|
67
|
+
except Exception as exc:
|
|
68
|
+
return _format_error("get_restock_alerts", exc)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
async def get_best_inference_provider(
|
|
72
|
+
model: str, priority: str = "balanced"
|
|
73
|
+
) -> str:
|
|
74
|
+
"""Recommend the best cloud inference provider for a model.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
model: ChipRadar inference model slug, e.g. "llama-3-8b".
|
|
78
|
+
priority: One of "cost", "latency", or "balanced" (default).
|
|
79
|
+
"""
|
|
80
|
+
try:
|
|
81
|
+
client = await _client()
|
|
82
|
+
data = await client.get_best_inference_provider(model=model, priority=priority)
|
|
83
|
+
return json.dumps(data, indent=2)
|
|
84
|
+
except Exception as exc:
|
|
85
|
+
return _format_error("get_best_inference_provider", exc)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
async def calculate_cloud_vs_local_breakeven(
|
|
89
|
+
daily_tokens: int, model: str
|
|
90
|
+
) -> str:
|
|
91
|
+
"""Compare cloud inference cost vs buying a local board.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
daily_tokens: Expected tokens generated per day.
|
|
95
|
+
model: ChipRadar inference model slug, e.g. "llama-3-8b".
|
|
96
|
+
"""
|
|
97
|
+
try:
|
|
98
|
+
client = await _client()
|
|
99
|
+
data = await client.calculate_cloud_vs_local_breakeven(
|
|
100
|
+
daily_tokens=daily_tokens, model=model
|
|
101
|
+
)
|
|
102
|
+
return json.dumps(data, indent=2)
|
|
103
|
+
except Exception as exc:
|
|
104
|
+
return _format_error("calculate_cloud_vs_local_breakeven", exc)
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-chipradar
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: MCP server for the ChipRadar hardware pricing API
|
|
5
|
+
Author-email: ChipRadar <dev@chipradar.io>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://chipradar.io/developers
|
|
8
|
+
Project-URL: Repository, https://github.com/RevenueClaw/mcp-chipradar
|
|
9
|
+
Project-URL: Issues, https://github.com/RevenueClaw/mcp-chipradar/issues
|
|
10
|
+
Keywords: mcp,chipradar,hardware,pricing,sbc
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: httpx>=0.27
|
|
23
|
+
Requires-Dist: mcp<2.0.0,>=1.12.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# mcp-chipradar
|
|
30
|
+
|
|
31
|
+
A Model Context Protocol (MCP) server that turns the [ChipRadar](https://chipradar.io)
|
|
32
|
+
hardware-pricing API into LLM tools. Query single-board computers, mini PCs,
|
|
33
|
+
vendor prices, deal scores, restock alerts, and LLM-on-board benchmarks directly
|
|
34
|
+
from Claude, Cursor, OpenClaw / RockClaw, n8n, or any MCP host.
|
|
35
|
+
|
|
36
|
+
## Quickstart (no API key needed)
|
|
37
|
+
|
|
38
|
+
The server runs in **demo mode** without `CHIPRADAR_API_KEY`, returning public
|
|
39
|
+
demo data and clear setup instructions so registry reviewers can test it in a
|
|
40
|
+
single copy-paste.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# uv / pipx install from the repo sub-directory
|
|
44
|
+
pipx install git+https://github.com/RevenueClaw/chipradar.git#subdirectory=mcp-chipradar
|
|
45
|
+
|
|
46
|
+
# or clone and install locally
|
|
47
|
+
git clone https://github.com/RevenueClaw/chipradar.git
|
|
48
|
+
cd chipradar/mcp-chipradar
|
|
49
|
+
pip install -e .
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Then add an MCP config block below. Without an API key, `get_boards` returns
|
|
53
|
+
sample public boards from `https://chipradar.io/api/products/current`; other tools
|
|
54
|
+
return the same public sample plus a registration note.
|
|
55
|
+
|
|
56
|
+
## API key setup
|
|
57
|
+
|
|
58
|
+
Get a free key instantly at [chipradar.io/api/keys](https://chipradar.io/api/keys)
|
|
59
|
+
(no approval). Paid tiers unlock higher rate limits and features such as
|
|
60
|
+
90-day price history and LLM benchmarks.
|
|
61
|
+
|
|
62
|
+
Prefer marketplace billing? The API is also listed on
|
|
63
|
+
[RapidAPI](https://rapidapi.com/RevenueClaw/api/chipradar-ai-compute-hardware-pricing-api1)
|
|
64
|
+
with matching BASIC/PRO/ULTRA/MEGA plans.
|
|
65
|
+
|
|
66
|
+
| Tier | Price | Monthly cap | Per-minute | Unlocks |
|
|
67
|
+
|---|---|---|---|---|
|
|
68
|
+
| **Sandbox / Free** | `$0/mo` | 100 | 5 | current deals, basic specs |
|
|
69
|
+
| **Indie / Builder** | `$12/mo` | 5,000 | 30 | 90-day history, MCP access, **LLM benchmarks** |
|
|
70
|
+
| **Pro / Growth** | `$49/mo` | 50,000 | 120 | full history, restock webhooks |
|
|
71
|
+
| **Enterprise / Supply Chain** | `$199/mo` | 250,000+ | 600 | bulk exports, priority webhooks, custom SKUs |
|
|
72
|
+
|
|
73
|
+
Set these environment variables wherever you run the server:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
export CHIPRADAR_API_KEY="sk_cr_..." # required for live B2B data
|
|
77
|
+
export CHIPRADAR_API_BASE="https://chipradar.io/api/v1" # optional
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## MCP config snippets
|
|
81
|
+
|
|
82
|
+
### OpenClaw / RockClaw (`~/.openclaw/mcp.json` or Control UI)
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"mcpServers": {
|
|
87
|
+
"chipradar": {
|
|
88
|
+
"command": "mcp-chipradar",
|
|
89
|
+
"env": {
|
|
90
|
+
"CHIPRADAR_API_KEY": "sk_cr_...",
|
|
91
|
+
"CHIPRADAR_API_BASE": "https://chipradar.io/api/v1"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Claude Desktop (`claude_desktop_config.json`)
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"mcpServers": {
|
|
103
|
+
"chipradar": {
|
|
104
|
+
"command": "mcp-chipradar",
|
|
105
|
+
"env": {
|
|
106
|
+
"CHIPRADAR_API_KEY": "sk_cr_...",
|
|
107
|
+
"CHIPRADAR_API_BASE": "https://chipradar.io/api/v1"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Cursor (Settings → MCP → Add server)
|
|
115
|
+
|
|
116
|
+
Use **Type: Command** and paste:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
CHIPRADAR_API_KEY=sk_cr_... CHIPRADAR_API_BASE=https://chipradar.io/api/v1 mcp-chipradar
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Or add to your shell profile and just run `mcp-chipradar`.
|
|
123
|
+
|
|
124
|
+
### n8n (HTTP Request or MCP node)
|
|
125
|
+
|
|
126
|
+
Point the n8n MCP node at the stdio command:
|
|
127
|
+
|
|
128
|
+
```text
|
|
129
|
+
Command: mcp-chipradar
|
|
130
|
+
Environment Variables:
|
|
131
|
+
CHIPRADAR_API_KEY = sk_cr_...
|
|
132
|
+
CHIPRADAR_API_BASE = https://chipradar.io/api/v1
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Tools
|
|
136
|
+
|
|
137
|
+
- `get_boards(family=None, brand=None, limit=20)` — list tracked boards with specs and the best in-stock vendor price.
|
|
138
|
+
- `get_board_history(asin, days=30)` — historical vendor price points for a board.
|
|
139
|
+
- `get_deals(min_score=0, limit=20)` — boards priced below MSRP, sorted by deal score.
|
|
140
|
+
- `get_restock_alerts(limit=20)` — aggregated public restock signals.
|
|
141
|
+
- `get_best_inference_provider(model, priority="balanced")` — recommend the best cloud inference provider for a model by cost, latency, or balanced score. Requires a paid API key; keyless mode returns a demo note + static provider list.
|
|
142
|
+
- `calculate_cloud_vs_local_breakeven(daily_tokens, model)` — compare 30-day cloud inference spend vs. buying a local board (cheapest in-stock non-Amazon price + on-device throughput). Requires a paid API key; keyless mode returns demo instructions + a sample board.
|
|
143
|
+
|
|
144
|
+
> **Note:** `get_board_history` and `get_deals` return free-tier limits unless
|
|
145
|
+
the active key is Indie or higher. LLM benchmark data lives at
|
|
146
|
+
`GET /api/v1/benchmarks/llm` and requires the **Indie/Builder tier or above**
|
|
147
|
+
($12/mo); it is available via the API. The two new inference tools call
|
|
148
|
+
`GET /api/v1/inference/recommend` and `GET /api/v1/inference/breakeven`
|
|
149
|
+
respectively.
|
|
150
|
+
|
|
151
|
+
## Example prompts
|
|
152
|
+
|
|
153
|
+
1. *“Find me the cheapest in-stock 8 GB ARM board right now.”*
|
|
154
|
+
→ `get_boards(brand="Raspberry Pi", limit=10)` or `get_deals(limit=10)`
|
|
155
|
+
|
|
156
|
+
2. *“Show me the 90-day price history for Raspberry Pi 5 8 GB.”*
|
|
157
|
+
→ `get_board_history(asin="B0CK2FCG1K", days=90)`
|
|
158
|
+
|
|
159
|
+
3. *“What is the best sub-$500 mini PC for running Qwen 32B by tokens-per-dollar?”*
|
|
160
|
+
→ `get_boards(family="mini_pc", limit=20)`, then use the **Indie+ API**
|
|
161
|
+
`GET /api/v1/benchmarks/llm?platform=mini_pc` to rank by
|
|
162
|
+
`perf_per_dollar` (tokens/sec per dollar) and filter by `usd_price < 500`.
|
|
163
|
+
|
|
164
|
+
## Running keyless (demo mode)
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
CHIPRADAR_API_BASE=https://bad-host.example mcp-chipradar
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
With no `CHIPRADAR_API_KEY`, the server ignores `CHIPRADAR_API_BASE` and serves
|
|
171
|
+
public demo data with registration instructions instead of crashing.
|
|
172
|
+
|
|
173
|
+
## Telemetry / limits
|
|
174
|
+
|
|
175
|
+
Every live response includes `X-RateLimit-*` headers. The free Sandbox tier is
|
|
176
|
+
100 requests/month and 5 requests/minute — plenty for evaluation.
|
|
177
|
+
|
|
178
|
+
## Changelog
|
|
179
|
+
|
|
180
|
+
- **0.2.0** — Added inference telemetry tools:
|
|
181
|
+
- `get_best_inference_provider(model, priority)`
|
|
182
|
+
- `calculate_cloud_vs_local_breakeven(daily_tokens, model)`
|
|
183
|
+
- Keyless demo mode now returns a registration note + static provider/sample-board list so the server boots cleanly without `CHIPRADAR_API_KEY`.
|
|
184
|
+
|
|
185
|
+
## License
|
|
186
|
+
|
|
187
|
+
Apache-2.0 — see [LICENSE](./LICENSE) in this package.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/mcp_chipradar/__init__.py
|
|
5
|
+
src/mcp_chipradar/client.py
|
|
6
|
+
src/mcp_chipradar/server.py
|
|
7
|
+
src/mcp_chipradar/tools.py
|
|
8
|
+
src/mcp_chipradar.egg-info/PKG-INFO
|
|
9
|
+
src/mcp_chipradar.egg-info/SOURCES.txt
|
|
10
|
+
src/mcp_chipradar.egg-info/dependency_links.txt
|
|
11
|
+
src/mcp_chipradar.egg-info/entry_points.txt
|
|
12
|
+
src/mcp_chipradar.egg-info/requires.txt
|
|
13
|
+
src/mcp_chipradar.egg-info/top_level.txt
|
|
14
|
+
tests/test_tools.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mcp_chipradar
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Tests for MCP tool schemas and demo mode."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from mcp_chipradar.client import ChipRadarClient
|
|
8
|
+
import mcp_chipradar.tools as tools
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@pytest.mark.asyncio
|
|
12
|
+
async def test_keyless_demo_best_provider():
|
|
13
|
+
os.environ.pop("CHIPRADAR_API_KEY", None)
|
|
14
|
+
client = ChipRadarClient()
|
|
15
|
+
assert client.demo_mode is True
|
|
16
|
+
data = await client.get_best_inference_provider("llama-3-8b", "latency")
|
|
17
|
+
assert data["demo_mode"] is True
|
|
18
|
+
assert "instructions" in data
|
|
19
|
+
assert len(data["static_provider_list"]) > 0
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.mark.asyncio
|
|
23
|
+
async def test_keyless_demo_breakeven():
|
|
24
|
+
os.environ.pop("CHIPRADAR_API_KEY", None)
|
|
25
|
+
client = ChipRadarClient()
|
|
26
|
+
data = await client.calculate_cloud_vs_local_breakeven(1_000_000, "llama-3-8b")
|
|
27
|
+
assert data["demo_mode"] is True
|
|
28
|
+
assert "instructions" in data
|
|
29
|
+
assert len(data["static_sample_boards"]) > 0
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@pytest.mark.asyncio
|
|
33
|
+
async def test_tool_outputs_valid_json():
|
|
34
|
+
os.environ.pop("CHIPRADAR_API_KEY", None)
|
|
35
|
+
out = await tools.get_best_inference_provider("llama-3-8b", "balanced")
|
|
36
|
+
json.loads(out) # must parse
|
|
37
|
+
out = await tools.calculate_cloud_vs_local_breakeven(1_000_000, "llama-3-8b")
|
|
38
|
+
json.loads(out) # must parse
|