decimalai-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.
Potentially problematic release.
This version of decimalai-mcp might be problematic. Click here for more details.
- decimalai_mcp-0.1.0/.github/workflows/ci.yml +42 -0
- decimalai_mcp-0.1.0/.github/workflows/publish.yml +75 -0
- decimalai_mcp-0.1.0/.gitignore +6 -0
- decimalai_mcp-0.1.0/LICENSE +21 -0
- decimalai_mcp-0.1.0/LISTINGS.md +105 -0
- decimalai_mcp-0.1.0/PKG-INFO +110 -0
- decimalai_mcp-0.1.0/README.md +82 -0
- decimalai_mcp-0.1.0/RELEASING.md +101 -0
- decimalai_mcp-0.1.0/decimalai_mcp/__init__.py +3 -0
- decimalai_mcp-0.1.0/decimalai_mcp/api.py +263 -0
- decimalai_mcp-0.1.0/decimalai_mcp/server.py +90 -0
- decimalai_mcp-0.1.0/glama.json +4 -0
- decimalai_mcp-0.1.0/pyproject.toml +61 -0
- decimalai_mcp-0.1.0/server.io-github.json +31 -0
- decimalai_mcp-0.1.0/server.json +31 -0
- decimalai_mcp-0.1.0/smithery.yaml +16 -0
- decimalai_mcp-0.1.0/tests/test_api.py +232 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Tests (Python ${{ matrix.python-version }})
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
# Matches requires-python = ">=3.10".
|
|
17
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v6
|
|
20
|
+
|
|
21
|
+
- uses: actions/setup-python@v6
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
|
|
25
|
+
- name: Install
|
|
26
|
+
run: pip install -e ".[dev]"
|
|
27
|
+
|
|
28
|
+
- name: Run tests
|
|
29
|
+
run: pytest tests/ -v
|
|
30
|
+
|
|
31
|
+
# The `mcp<2` cap is load-bearing: mcp 2.0.0 removed `mcp.server.fastmcp`
|
|
32
|
+
# entirely, so a widened cap breaks the server at IMPORT time — which unit
|
|
33
|
+
# tests that mock the transport would not necessarily catch. Assert the
|
|
34
|
+
# resolved dependency still provides the interface server.py is written against.
|
|
35
|
+
- name: Assert the pinned mcp still provides FastMCP
|
|
36
|
+
run: |
|
|
37
|
+
python - <<'PY'
|
|
38
|
+
from mcp.server.fastmcp import FastMCP # noqa: F401
|
|
39
|
+
import decimalai_mcp.server # noqa: F401
|
|
40
|
+
import importlib.metadata as md
|
|
41
|
+
print("OK — mcp", md.version("mcp"), "provides FastMCP; server imports clean")
|
|
42
|
+
PY
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
id-token: write # Required for Trusted Publisher (OIDC)
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
name: Run Tests
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v6
|
|
20
|
+
|
|
21
|
+
- uses: actions/setup-python@v6
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: pip install -e ".[dev]"
|
|
27
|
+
|
|
28
|
+
- name: Run tests
|
|
29
|
+
run: pytest tests/ -v
|
|
30
|
+
|
|
31
|
+
publish:
|
|
32
|
+
name: Publish to PyPI
|
|
33
|
+
needs: test # Only publish if tests pass
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
environment: pypi
|
|
36
|
+
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v6
|
|
39
|
+
|
|
40
|
+
- name: Set up Python
|
|
41
|
+
uses: actions/setup-python@v6
|
|
42
|
+
with:
|
|
43
|
+
python-version: "3.12"
|
|
44
|
+
|
|
45
|
+
- name: Install build tools
|
|
46
|
+
run: pip install build
|
|
47
|
+
|
|
48
|
+
- name: Build package
|
|
49
|
+
run: python -m build
|
|
50
|
+
|
|
51
|
+
- name: Verify package version matches release tag
|
|
52
|
+
run: |
|
|
53
|
+
PKG_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
|
54
|
+
TAG_VERSION="${GITHUB_REF_NAME#v}"
|
|
55
|
+
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
|
|
56
|
+
echo "❌ Version mismatch: pyproject.toml=$PKG_VERSION, tag=$TAG_VERSION"
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
59
|
+
echo "✅ Version match: $PKG_VERSION"
|
|
60
|
+
|
|
61
|
+
# The MCP registry verifies PyPI ownership by finding `mcp-name: <server>`
|
|
62
|
+
# in the PUBLISHED README. PyPI is append-only, so a missing or mismatched
|
|
63
|
+
# marker cannot be fixed in place — it costs a whole version. Fail first.
|
|
64
|
+
- name: Verify the mcp-name marker matches server.json
|
|
65
|
+
run: |
|
|
66
|
+
NAME=$(python -c "import json; print(json.load(open('server.json'))['name'])")
|
|
67
|
+
grep -q "mcp-name: ${NAME}" README.md || {
|
|
68
|
+
echo "❌ README.md is missing 'mcp-name: ${NAME}' — the MCP registry will reject the listing"; exit 1; }
|
|
69
|
+
echo "✅ mcp-name marker present: ${NAME}"
|
|
70
|
+
|
|
71
|
+
- name: Publish to PyPI
|
|
72
|
+
# SHA-pinned (not a mutable tag): this job holds OIDC id-token:write →
|
|
73
|
+
# PyPI publish authority. Same pin as decimalai-python.
|
|
74
|
+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
|
|
75
|
+
# No API token needed — uses Trusted Publisher (OIDC)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DecimalAI
|
|
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,105 @@
|
|
|
1
|
+
# Directory listings — prepared submissions
|
|
2
|
+
|
|
3
|
+
**Current state (2026-07-23): NOTHING submitted.** This directory is local-only — not git-init'ed, no GitHub repo, `decimalai-mcp` NOT on PyPI, zero directory listings. Everything below is copy-paste-ready but owner-gated: steps marked **[founder]** need your accounts (GitHub org owner / PyPI / DNS / directory logins) plus the per-repo public-visibility go-ahead (standing policy).
|
|
4
|
+
|
|
5
|
+
## Shared listing copy (reuse everywhere)
|
|
6
|
+
|
|
7
|
+
**One-liner:**
|
|
8
|
+
> Search agent skills ranked by measured effectiveness — verified A/B benchmark lift, live pass rates, and safety-scan status — from the DecimalAI registry.
|
|
9
|
+
|
|
10
|
+
**Short description (≤50 words):**
|
|
11
|
+
> Read-only MCP server for the DecimalAI skills registry. Three tools: search skills, get a skill's full trust and benchmark evidence (including its SKILL.md body), and read the effectiveness leaderboard. No API key required; `DECIMAL_API_KEY` optionally adds per-org enrichment.
|
|
12
|
+
|
|
13
|
+
**Longer description:**
|
|
14
|
+
> Most skill directories rank by stars or downloads. DecimalAI ranks by evidence: every public skill carries a safety-scan verdict, an LLM intent review, and — where it has been benchmarked — a verified A/B lift against a no-skill baseline. This MCP server puts that registry inside any MCP client: `search_skills` (hybrid keyword/semantic search), `get_skill` (trust band, scanner status, benchmark verdict + lift, SkillScore, ratings, SKILL.md body), and `get_leaderboard` (skill_score / biggest_improvement / efficiency / top_rated). Read-only, key-optional, stdio transport, Python 3.10+.
|
|
15
|
+
|
|
16
|
+
- Tool count: 3 (all read-only)
|
|
17
|
+
- Transport: stdio
|
|
18
|
+
- Repo: `https://github.com/decimal-labs/decimalai-mcp` *(create when shipping; repo is currently local-only)*
|
|
19
|
+
- Package: `decimalai-mcp` on PyPI *(publish before any registry submission — the official registry verifies package existence)*
|
|
20
|
+
- Homepage: `https://app.decimal.ai/skills`
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 1. Official MCP registry (registry.modelcontextprotocol.io)
|
|
25
|
+
|
|
26
|
+
### Namespace decision (both prepared)
|
|
27
|
+
|
|
28
|
+
| Option | server.json file | Auth requirement |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| `ai.decimal/registry` (preferred — brand) | `server.json` | Domain auth: DNS TXT record on the **apex** of `decimal.ai` (SPF-style placement, NOT a `_mcp-auth.` selector), generated by `mcp-publisher login dns`; Ed25519 needs OpenSSL 3 (`brew install openssl@3` on macOS). HTTP-based domain auth also exists. |
|
|
31
|
+
| `io.github.decimal-labs/registry` | `server.io-github.json` | GitHub auth: you must be an **Owner** of the `decimal-labs` org (member is not enough). `mcp-publisher login github` device flow. |
|
|
32
|
+
|
|
33
|
+
The `mcp-name` comment in README.md is currently `ai.decimal/registry`. **If you choose the io.github namespace, change that comment to match before publishing to PyPI** — the registry verifies PyPI ownership by finding `mcp-name: <server name>` in the package README (it may live in an HTML comment; it must be followed by a boundary such as `-->` or a newline).
|
|
34
|
+
|
|
35
|
+
### Exact CLI steps **[founder]**
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# 0. Prereqs: git init + repo pushed to github.com/decimal-labs/decimalai-mcp,
|
|
39
|
+
# package published to PyPI:
|
|
40
|
+
python -m build && twine upload dist/*
|
|
41
|
+
|
|
42
|
+
# 1. Install the publisher CLI
|
|
43
|
+
brew install mcp-publisher
|
|
44
|
+
# (or: curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher && sudo mv mcp-publisher /usr/local/bin/)
|
|
45
|
+
|
|
46
|
+
# 2. Authenticate — pick ONE, matching the server.json you'll publish
|
|
47
|
+
mcp-publisher login github # for io.github.decimal-labs/registry
|
|
48
|
+
# or
|
|
49
|
+
mcp-publisher login dns # for ai.decimal/registry (after adding the TXT record it prints)
|
|
50
|
+
|
|
51
|
+
# 3. Publish (from this directory; swap in server.io-github.json if using GitHub auth)
|
|
52
|
+
mcp-publisher publish
|
|
53
|
+
|
|
54
|
+
# 4. Verify
|
|
55
|
+
curl "https://registry.modelcontextprotocol.io/v0.1/servers?search=decimal"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Note: the MCP Registry is in preview — breaking changes/data resets are possible; re-verify the schema URL (`2025-12-11` snapshot at time of writing) before publishing.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 2. mcp.so
|
|
63
|
+
|
|
64
|
+
- **Where:** https://mcp.so/submit (requires a public GitHub repo — push first). Complete the draft after submitting; saving publishes it.
|
|
65
|
+
- **Fields to paste:**
|
|
66
|
+
- Name: `DecimalAI Skills Registry`
|
|
67
|
+
- Description: the one-liner above
|
|
68
|
+
- GitHub URL: `https://github.com/decimal-labs/decimalai-mcp`
|
|
69
|
+
- Homepage: `https://app.decimal.ai/skills`
|
|
70
|
+
- Transport: stdio · Tools: 3
|
|
71
|
+
- **[founder]** needs a GitHub login on mcp.so.
|
|
72
|
+
|
|
73
|
+
## 3. Smithery (smithery.ai)
|
|
74
|
+
|
|
75
|
+
- **Where:** https://smithery.ai — sign in with GitHub, "Add server", point it at the repo.
|
|
76
|
+
- Smithery favors servers it can host/inspect; for a local stdio server the repo should carry a `smithery.yaml` (included in this repo) describing the start command. Re-verify their current schema at submission time — it has churned.
|
|
77
|
+
- **Copy:** one-liner + short description above.
|
|
78
|
+
- **[founder]** GitHub sign-in; claiming the `decimal-labs` org namespace on Smithery.
|
|
79
|
+
|
|
80
|
+
## 4. Glama (glama.ai/mcp/servers)
|
|
81
|
+
|
|
82
|
+
- **Where:** Glama auto-indexes public GitHub MCP servers; after the repo is public it will typically appear on its own. To claim + enrich: sign in at https://glama.ai, claim the server, and/or add the included `glama.json` to the repo root (maintainers field) so the listing links your account.
|
|
83
|
+
- **Fields:** name, description (short description above), repository URL, install snippet (`uvx decimalai-mcp`), transport stdio, 3 tools.
|
|
84
|
+
- **[founder]** Glama account to claim the listing.
|
|
85
|
+
|
|
86
|
+
## 5. PulseMCP (pulsemcp.com)
|
|
87
|
+
|
|
88
|
+
- **Where:** https://www.pulsemcp.com — "Submit a server" form (they also auto-ingest the official registry, so completing step 1 usually gets you listed here automatically; the form just speeds it up / adds metadata).
|
|
89
|
+
- **Fields to paste:** name `DecimalAI Skills Registry`, the short description, repo URL, homepage, `uvx decimalai-mcp` install snippet.
|
|
90
|
+
- **[founder]** form submission (email confirmation).
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Also worth 10 minutes each (not in scope, listed for later)
|
|
95
|
+
|
|
96
|
+
- `punkpeye/awesome-mcp-servers` — PR adding one line under an appropriate section.
|
|
97
|
+
- Cline marketplace — issue on `cline/mcp-marketplace`.
|
|
98
|
+
|
|
99
|
+
## Pre-submission checklist — none started as of 2026-07-23
|
|
100
|
+
|
|
101
|
+
- [ ] `git init` this directory and create GitHub repo `decimal-labs/decimalai-mcp` (private repos can't be listed — this one is intentionally launch-public, unlike the rest of the org; get the per-repo go-ahead first)
|
|
102
|
+
- [ ] Publish `decimalai-mcp` 0.1.0 to PyPI
|
|
103
|
+
- [ ] Decide namespace; if io.github, update the `mcp-name` comment in README.md and use `server.io-github.json` (renamed to `server.json`)
|
|
104
|
+
- [ ] `mcp-publisher publish`
|
|
105
|
+
- [ ] Submit the four directories above
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: decimalai-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for the DecimalAI skills registry — search skills, inspect trust/benchmark evidence, and read the leaderboard from any MCP client.
|
|
5
|
+
Project-URL: Homepage, https://github.com/decimal-labs/decimalai-mcp
|
|
6
|
+
Project-URL: Documentation, https://docs.decimal.ai
|
|
7
|
+
Project-URL: Repository, https://github.com/decimal-labs/decimalai-mcp
|
|
8
|
+
Author: Decimal AI
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agents,decimalai,mcp,model-context-protocol,skills
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: httpx>=0.28.1
|
|
24
|
+
Requires-Dist: mcp<2,>=1.2.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# decimalai-mcp
|
|
30
|
+
|
|
31
|
+
MCP server for the [DecimalAI](https://decimal.ai) skills registry — the registry that ranks agent skills by **measured effectiveness** (verified A/B benchmarks, live pass rates, AI rater scores), not download counts.
|
|
32
|
+
|
|
33
|
+
<!-- mcp-name: ai.decimal/registry -->
|
|
34
|
+
|
|
35
|
+
Gives any MCP client (Claude Desktop, Claude Code, Cursor, …) three read-only tools:
|
|
36
|
+
|
|
37
|
+
| Tool | What it does |
|
|
38
|
+
|---|---|
|
|
39
|
+
| `search_skills(query, category?, sort?, limit?)` | Hybrid keyword/semantic search over the public registry |
|
|
40
|
+
| `get_skill(slug)` | Full record: trust & safety-scan status, verified benchmark lift, SkillScore, ratings, SKILL.md body |
|
|
41
|
+
| `get_leaderboard(sort?, category?, window_days?, limit?)` | Ranked leaderboard: `skill_score`, `biggest_improvement`, `efficiency`, `top_rated` |
|
|
42
|
+
|
|
43
|
+
**No API key required** — all three tools read public registry endpoints. If you set `DECIMAL_API_KEY` (from [app.decimal.ai/settings](https://app.decimal.ai/settings)), the same tools additionally show which skills your org has already installed (`installed_as`).
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install decimalai-mcp
|
|
49
|
+
# or, no install needed at config time:
|
|
50
|
+
uvx decimalai-mcp
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Requires Python 3.10+.
|
|
54
|
+
|
|
55
|
+
## Claude Code
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
claude mcp add decimalai -- uvx decimalai-mcp
|
|
59
|
+
# with an API key:
|
|
60
|
+
claude mcp add decimalai -e DECIMAL_API_KEY=dai_sk_... -- uvx decimalai-mcp
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Claude Desktop
|
|
64
|
+
|
|
65
|
+
Add to `claude_desktop_config.json` (Settings → Developer → Edit Config):
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mcpServers": {
|
|
70
|
+
"decimalai": {
|
|
71
|
+
"command": "uvx",
|
|
72
|
+
"args": ["decimalai-mcp"],
|
|
73
|
+
"env": {
|
|
74
|
+
"DECIMAL_API_KEY": "dai_sk_optional"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Omit the `env` block entirely for anonymous read-only access.
|
|
82
|
+
|
|
83
|
+
## Configuration
|
|
84
|
+
|
|
85
|
+
| Env var | Default | Purpose |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| `DECIMAL_API_KEY` | *(unset)* | Optional. Unlocks per-org enrichment (e.g. `installed_as`) on the same public endpoints. |
|
|
88
|
+
| `DECIMAL_API_URL` | `https://api.decimal.ai` | Point at a self-hosted / local backend. |
|
|
89
|
+
|
|
90
|
+
## Why no `check_manifest_impact` tool?
|
|
91
|
+
|
|
92
|
+
The manifest-impact endpoint (`POST /api/v1/regression-check`) is authenticated on the platform — it analyzes **your org's** production traces against a candidate manifest, so there is no public variant to expose. This server is deliberately a read-only, key-optional public-registry surface. If demand shows up, an authed `check_manifest_impact` (requiring `DECIMAL_API_KEY`) is a natural v0.2 addition; the [regression-check GitHub Action](https://github.com/decimal-labs/regression-check) covers the CI use-case today.
|
|
93
|
+
|
|
94
|
+
## Endpoints used (all public)
|
|
95
|
+
|
|
96
|
+
- `GET /api/v1/registry/skills` — browse/search
|
|
97
|
+
- `GET /api/v1/registry/skills/{slug}` — detail
|
|
98
|
+
- `GET /api/v1/registry/leaderboard` — ranked leaderboard (`category` filtering falls back to the browse endpoint's documented `view=ranks` mode, because the leaderboard endpoint is uncategorized)
|
|
99
|
+
|
|
100
|
+
## Development
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pip install -e ".[dev]"
|
|
104
|
+
pytest # all HTTP mocked; no network
|
|
105
|
+
python -m decimalai_mcp.server # run over stdio
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
MIT
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# decimalai-mcp
|
|
2
|
+
|
|
3
|
+
MCP server for the [DecimalAI](https://decimal.ai) skills registry — the registry that ranks agent skills by **measured effectiveness** (verified A/B benchmarks, live pass rates, AI rater scores), not download counts.
|
|
4
|
+
|
|
5
|
+
<!-- mcp-name: ai.decimal/registry -->
|
|
6
|
+
|
|
7
|
+
Gives any MCP client (Claude Desktop, Claude Code, Cursor, …) three read-only tools:
|
|
8
|
+
|
|
9
|
+
| Tool | What it does |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `search_skills(query, category?, sort?, limit?)` | Hybrid keyword/semantic search over the public registry |
|
|
12
|
+
| `get_skill(slug)` | Full record: trust & safety-scan status, verified benchmark lift, SkillScore, ratings, SKILL.md body |
|
|
13
|
+
| `get_leaderboard(sort?, category?, window_days?, limit?)` | Ranked leaderboard: `skill_score`, `biggest_improvement`, `efficiency`, `top_rated` |
|
|
14
|
+
|
|
15
|
+
**No API key required** — all three tools read public registry endpoints. If you set `DECIMAL_API_KEY` (from [app.decimal.ai/settings](https://app.decimal.ai/settings)), the same tools additionally show which skills your org has already installed (`installed_as`).
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install decimalai-mcp
|
|
21
|
+
# or, no install needed at config time:
|
|
22
|
+
uvx decimalai-mcp
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Requires Python 3.10+.
|
|
26
|
+
|
|
27
|
+
## Claude Code
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
claude mcp add decimalai -- uvx decimalai-mcp
|
|
31
|
+
# with an API key:
|
|
32
|
+
claude mcp add decimalai -e DECIMAL_API_KEY=dai_sk_... -- uvx decimalai-mcp
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Claude Desktop
|
|
36
|
+
|
|
37
|
+
Add to `claude_desktop_config.json` (Settings → Developer → Edit Config):
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"mcpServers": {
|
|
42
|
+
"decimalai": {
|
|
43
|
+
"command": "uvx",
|
|
44
|
+
"args": ["decimalai-mcp"],
|
|
45
|
+
"env": {
|
|
46
|
+
"DECIMAL_API_KEY": "dai_sk_optional"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Omit the `env` block entirely for anonymous read-only access.
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
| Env var | Default | Purpose |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `DECIMAL_API_KEY` | *(unset)* | Optional. Unlocks per-org enrichment (e.g. `installed_as`) on the same public endpoints. |
|
|
60
|
+
| `DECIMAL_API_URL` | `https://api.decimal.ai` | Point at a self-hosted / local backend. |
|
|
61
|
+
|
|
62
|
+
## Why no `check_manifest_impact` tool?
|
|
63
|
+
|
|
64
|
+
The manifest-impact endpoint (`POST /api/v1/regression-check`) is authenticated on the platform — it analyzes **your org's** production traces against a candidate manifest, so there is no public variant to expose. This server is deliberately a read-only, key-optional public-registry surface. If demand shows up, an authed `check_manifest_impact` (requiring `DECIMAL_API_KEY`) is a natural v0.2 addition; the [regression-check GitHub Action](https://github.com/decimal-labs/regression-check) covers the CI use-case today.
|
|
65
|
+
|
|
66
|
+
## Endpoints used (all public)
|
|
67
|
+
|
|
68
|
+
- `GET /api/v1/registry/skills` — browse/search
|
|
69
|
+
- `GET /api/v1/registry/skills/{slug}` — detail
|
|
70
|
+
- `GET /api/v1/registry/leaderboard` — ranked leaderboard (`category` filtering falls back to the browse endpoint's documented `view=ranks` mode, because the leaderboard endpoint is uncategorized)
|
|
71
|
+
|
|
72
|
+
## Development
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install -e ".[dev]"
|
|
76
|
+
pytest # all HTTP mocked; no network
|
|
77
|
+
python -m decimalai_mcp.server # run over stdio
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Releasing decimalai-mcp
|
|
2
|
+
|
|
3
|
+
How to publish a new version of the `decimalai-mcp` package to PyPI.
|
|
4
|
+
|
|
5
|
+
> **PyPI is append-only.** A version number can never be reused, overwritten, or re-uploaded — even after
|
|
6
|
+
> you "delete" a release. If you ship a mistake, the only remedy is a *new* version. Treat the publish as
|
|
7
|
+
> irreversible. That matters more here than in the sibling packages, because the **`mcp-name` marker in
|
|
8
|
+
> `README.md` is what the official MCP registry reads to verify PyPI ownership** — a wrong marker costs a
|
|
9
|
+
> whole version to fix.
|
|
10
|
+
|
|
11
|
+
## How publishing works
|
|
12
|
+
|
|
13
|
+
Same model as [`decimalai`](../decimalai-python/RELEASING.md): **[PyPI Trusted Publishing](https://docs.pypi.org/trusted-publishers/)**
|
|
14
|
+
(OIDC). There is no stored token in CI — a *published GitHub Release* triggers `.github/workflows/publish.yml`,
|
|
15
|
+
which runs the tests, verifies the version and the `mcp-name` marker, builds, and uploads via OIDC.
|
|
16
|
+
|
|
17
|
+
| Gate | Where | Checks | Blocks the release? |
|
|
18
|
+
|---|---|---|---|
|
|
19
|
+
| Tests | CI — `publish.yml` `test` job | unit + contract tests on Python 3.10–3.13 | yes (before the upload step) |
|
|
20
|
+
| Version ↔ tag match | CI — `publish` job | `pyproject.toml` version == `v<tag>` | yes |
|
|
21
|
+
| `mcp-name` marker | CI — `publish` job | `README.md` contains `mcp-name: <server.json name>` | yes |
|
|
22
|
+
| Live registry smoke | **Local — see below** | the three tools against production | yes — run it yourself first |
|
|
23
|
+
|
|
24
|
+
Unlike `decimalai`, there is no live-LLM gate: this server makes **no model calls**. It is a read-only HTTP
|
|
25
|
+
client over the public registry API, so the meaningful pre-release check is that the three tools still return
|
|
26
|
+
sane output against production.
|
|
27
|
+
|
|
28
|
+
## Prerequisites
|
|
29
|
+
|
|
30
|
+
1. `gh` installed and authenticated (`gh auth status`).
|
|
31
|
+
2. Push access to `decimal-labs/decimalai-mcp`.
|
|
32
|
+
3. **One-time, owner-only:** the PyPI Trusted Publisher must be configured for this project at
|
|
33
|
+
<https://pypi.org/manage/project/decimalai-mcp/settings/publishing/> —
|
|
34
|
+
owner `decimal-labs`, repository `decimalai-mcp`, workflow `publish.yml`, environment `pypi`.
|
|
35
|
+
Until that exists, CI publishing will fail and you must fall back to a token upload (below).
|
|
36
|
+
|
|
37
|
+
## Versioning model
|
|
38
|
+
|
|
39
|
+
The version lives in **two places that must match**:
|
|
40
|
+
|
|
41
|
+
| Number | Lives in |
|
|
42
|
+
|---|---|
|
|
43
|
+
| `version` | `pyproject.toml` |
|
|
44
|
+
| `__version__` | `decimalai_mcp/__init__.py` |
|
|
45
|
+
|
|
46
|
+
Bump **both** to the same SemVer string. CI asserts `pyproject.toml` matches the release tag; keep
|
|
47
|
+
`__version__` in step by hand.
|
|
48
|
+
|
|
49
|
+
## Release steps
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# 1. Bump both version numbers, commit.
|
|
53
|
+
# pyproject.toml: version = "0.2.0"
|
|
54
|
+
# decimalai_mcp/__init__.py: __version__ = "0.2.0"
|
|
55
|
+
|
|
56
|
+
# 2. Tests green locally, on the pinned mcp.
|
|
57
|
+
pip install -e ".[dev]" && pytest tests/ -v
|
|
58
|
+
|
|
59
|
+
# 3. Live smoke against PRODUCTION — the three tools must return real data.
|
|
60
|
+
python - <<'PY'
|
|
61
|
+
from decimalai_mcp import api
|
|
62
|
+
assert "SkillScore" in api.search_skills("pdf extraction", limit=3)
|
|
63
|
+
assert "playwright-cli" in api.get_skill("playwright-cli")
|
|
64
|
+
assert api.get_leaderboard(limit=3)
|
|
65
|
+
print("live smoke OK")
|
|
66
|
+
PY
|
|
67
|
+
|
|
68
|
+
# 4. The cap is load-bearing — confirm the resolved mcp still has FastMCP.
|
|
69
|
+
python -c "from mcp.server.fastmcp import FastMCP; import decimalai_mcp.server; print('FastMCP OK')"
|
|
70
|
+
|
|
71
|
+
# 5. Cut the Release. CI does the rest.
|
|
72
|
+
gh release create v0.2.0 --title "v0.2.0" --notes "..."
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Fallback: token upload
|
|
76
|
+
|
|
77
|
+
If the Trusted Publisher is not yet configured (or you are publishing the very first version before the
|
|
78
|
+
GitHub repo is public), upload directly with an **account-scoped** PyPI token in `~/.pypirc`:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
python -m build
|
|
82
|
+
twine check dist/*
|
|
83
|
+
twine upload dist/*
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
> A **project-scoped** token cannot create a *new* PyPI project — it returns 403. The first-ever upload of
|
|
87
|
+
> `decimalai-mcp` therefore needs an account-scoped token; after that, a project-scoped one is enough.
|
|
88
|
+
|
|
89
|
+
## Repository visibility
|
|
90
|
+
|
|
91
|
+
The repo is currently **private**. Everything is prepared for it to be flipped public — MIT `LICENSE`,
|
|
92
|
+
no secrets in the tree, listing metadata in `server.json` / `server.io-github.json` / `smithery.yaml` /
|
|
93
|
+
`glama.json`, and copy-paste submissions in [`LISTINGS.md`](LISTINGS.md).
|
|
94
|
+
|
|
95
|
+
Two things only become possible once it is public:
|
|
96
|
+
|
|
97
|
+
- The `Repository` / `Homepage` URLs in the PyPI metadata resolve for the public.
|
|
98
|
+
- The MCP directory listings (official registry, Smithery, Glama), which verify a readable repo.
|
|
99
|
+
|
|
100
|
+
Neither blocks a PyPI release. See `LISTINGS.md` for the namespace decision — the published README is
|
|
101
|
+
already marked `ai.decimal/registry`, which requires a DNS TXT record on the **apex** of `decimal.ai`.
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"""HTTP layer + formatting for the DecimalAI MCP server.
|
|
2
|
+
|
|
3
|
+
Kept separate from ``server.py`` so the logic is testable without the
|
|
4
|
+
``mcp`` package: every tool in ``server.py`` is a thin wrapper around a
|
|
5
|
+
function in this module.
|
|
6
|
+
|
|
7
|
+
All three tools read PUBLIC endpoints of the DecimalAI registry
|
|
8
|
+
(verified against the platform backend, 2026-07-14):
|
|
9
|
+
|
|
10
|
+
GET /api/v1/registry/skills — browse/search (anonymous OK)
|
|
11
|
+
GET /api/v1/registry/skills/{slug} — detail incl. trust + benchmarks (anonymous OK)
|
|
12
|
+
GET /api/v1/registry/leaderboard — ranked leaderboard (anonymous OK)
|
|
13
|
+
|
|
14
|
+
No API key is required. If ``DECIMAL_API_KEY`` is set, requests carry
|
|
15
|
+
``Authorization: Bearer …`` and the same endpoints enrich results with
|
|
16
|
+
per-user fields (e.g. ``installed_as`` — whether your org already forked
|
|
17
|
+
the skill).
|
|
18
|
+
|
|
19
|
+
Deliberately ABSENT: ``check_manifest_impact``. The impact endpoint
|
|
20
|
+
(``POST /api/v1/regression-check``) requires authentication on the
|
|
21
|
+
platform — there is no public variant — and this server is read-only
|
|
22
|
+
public-registry surface. See README "Why no manifest-impact tool?".
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from __future__ import annotations
|
|
26
|
+
|
|
27
|
+
import os
|
|
28
|
+
from typing import Any, Optional
|
|
29
|
+
from urllib.parse import quote
|
|
30
|
+
|
|
31
|
+
import httpx
|
|
32
|
+
|
|
33
|
+
DEFAULT_BASE_URL = "https://api.decimal.ai"
|
|
34
|
+
|
|
35
|
+
# Test seam: tests assign an ``httpx.MockTransport`` here so no real
|
|
36
|
+
# network traffic happens. ``None`` → httpx default transport.
|
|
37
|
+
_transport: Optional[httpx.BaseTransport] = None
|
|
38
|
+
|
|
39
|
+
_LEADERBOARD_SORTS = {"skill_score", "biggest_improvement", "efficiency", "top_rated"}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _base_url() -> str:
|
|
43
|
+
return os.environ.get("DECIMAL_API_URL", DEFAULT_BASE_URL).rstrip("/")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _headers() -> dict[str, str]:
|
|
47
|
+
headers = {"User-Agent": "decimalai-mcp/0.1.0"}
|
|
48
|
+
api_key = os.environ.get("DECIMAL_API_KEY")
|
|
49
|
+
if api_key:
|
|
50
|
+
headers["Authorization"] = f"Bearer {api_key}"
|
|
51
|
+
return headers
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _client() -> httpx.Client:
|
|
55
|
+
return httpx.Client(
|
|
56
|
+
base_url=_base_url(),
|
|
57
|
+
headers=_headers(),
|
|
58
|
+
timeout=15.0,
|
|
59
|
+
transport=_transport,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _get(path: str, params: Optional[dict[str, Any]] = None) -> Any:
|
|
64
|
+
with _client() as client:
|
|
65
|
+
resp = client.get(path, params=params or {})
|
|
66
|
+
resp.raise_for_status()
|
|
67
|
+
return resp.json()
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# ── Formatting helpers ─────────────────────────────────────────
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _fmt_score(value: Any) -> str:
|
|
74
|
+
"""SkillScore is 0..1; None means 'New' (no evidence yet)."""
|
|
75
|
+
if value is None:
|
|
76
|
+
return "—"
|
|
77
|
+
try:
|
|
78
|
+
return f"{float(value):.2f}"
|
|
79
|
+
except (TypeError, ValueError):
|
|
80
|
+
return str(value)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _fmt_pct(value: Any, signed: bool = False) -> str:
|
|
84
|
+
if value is None:
|
|
85
|
+
return "—"
|
|
86
|
+
try:
|
|
87
|
+
v = float(value)
|
|
88
|
+
except (TypeError, ValueError):
|
|
89
|
+
return str(value)
|
|
90
|
+
return f"{v:+.1f}" if signed else f"{v:.1f}"
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def _skill_line(item: dict[str, Any], rank: Optional[int] = None) -> str:
|
|
94
|
+
name = item.get("name", "?")
|
|
95
|
+
eff = item.get("effectiveness") or {}
|
|
96
|
+
parts = [
|
|
97
|
+
f"{rank}. **{name}**" if rank is not None else f"- **{name}**",
|
|
98
|
+
]
|
|
99
|
+
desc = (item.get("description") or "").strip()
|
|
100
|
+
if desc:
|
|
101
|
+
parts.append(desc if len(desc) <= 140 else desc[:137] + "...")
|
|
102
|
+
meta = []
|
|
103
|
+
metric = item.get("metric") or {}
|
|
104
|
+
if metric.get("label"):
|
|
105
|
+
# Leaderboard rows carry a headline metric ("+12 pts pass rate", …)
|
|
106
|
+
meta.append(metric["label"])
|
|
107
|
+
score = eff.get("skill_score")
|
|
108
|
+
if score is not None:
|
|
109
|
+
meta.append(f"SkillScore {_fmt_score(score)}")
|
|
110
|
+
bench = item.get("benchmark_summary") or {}
|
|
111
|
+
if bench.get("pass_rate_delta_pts") is not None:
|
|
112
|
+
meta.append(f"benchmark lift {_fmt_pct(bench['pass_rate_delta_pts'], signed=True)} pts")
|
|
113
|
+
if item.get("skill_safety"):
|
|
114
|
+
meta.append(f"safety: {item['skill_safety']}")
|
|
115
|
+
if item.get("skill_badge"):
|
|
116
|
+
meta.append(f"badge: {item['skill_badge']}")
|
|
117
|
+
installs = item.get("install_count")
|
|
118
|
+
if installs:
|
|
119
|
+
meta.append(f"{installs} installs")
|
|
120
|
+
if item.get("installed_as"):
|
|
121
|
+
meta.append(f"already installed as `{item['installed_as']}`")
|
|
122
|
+
if meta:
|
|
123
|
+
parts.append("(" + ", ".join(meta) + ")")
|
|
124
|
+
return " — ".join(parts[:2]) + (" " + parts[2] if len(parts) > 2 else "")
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# ── Tool implementations ───────────────────────────────────────
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def search_skills(
|
|
131
|
+
query: str,
|
|
132
|
+
category: Optional[str] = None,
|
|
133
|
+
sort: str = "recommended",
|
|
134
|
+
limit: int = 10,
|
|
135
|
+
) -> str:
|
|
136
|
+
"""Search the public DecimalAI skills registry."""
|
|
137
|
+
params: dict[str, Any] = {
|
|
138
|
+
"q": query,
|
|
139
|
+
"sort": sort,
|
|
140
|
+
"limit": max(1, min(int(limit), 50)),
|
|
141
|
+
}
|
|
142
|
+
if category:
|
|
143
|
+
params["category"] = category
|
|
144
|
+
data = _get("/api/v1/registry/skills", params=params)
|
|
145
|
+
items = data.get("items", [])
|
|
146
|
+
if not items:
|
|
147
|
+
return f"No public skills matched {query!r}."
|
|
148
|
+
total = data.get("total_hint") or data.get("total") or len(items)
|
|
149
|
+
lines = [f"## Registry results for {query!r} ({len(items)} of {total})", ""]
|
|
150
|
+
lines += [_skill_line(item) for item in items]
|
|
151
|
+
lines += ["", "Use `get_skill(<name>)` for trust/scan status, benchmark evidence, and the skill body."]
|
|
152
|
+
return "\n".join(lines)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def get_skill(slug: str) -> str:
|
|
156
|
+
"""Full detail for one registry skill: trust, safety scan, benchmarks, body."""
|
|
157
|
+
try:
|
|
158
|
+
# quote() the model-supplied slug: unencoded '/'/'?' would let a
|
|
159
|
+
# prompt-injected value reach arbitrary same-host paths (with the
|
|
160
|
+
# user's bearer header when DECIMAL_API_KEY is set).
|
|
161
|
+
skill = _get(f"/api/v1/registry/skills/{quote(slug, safe='')}")
|
|
162
|
+
except httpx.HTTPStatusError as exc:
|
|
163
|
+
if exc.response.status_code == 404:
|
|
164
|
+
return (
|
|
165
|
+
f"No public registry skill named {slug!r}. "
|
|
166
|
+
"Try search_skills() first — the slug is the `name` field."
|
|
167
|
+
)
|
|
168
|
+
raise
|
|
169
|
+
|
|
170
|
+
eff = skill.get("effectiveness") or {}
|
|
171
|
+
bench = skill.get("benchmark_summary") or {}
|
|
172
|
+
safety = skill.get("safety") or {}
|
|
173
|
+
|
|
174
|
+
lines = [f"# {skill.get('display_name') or skill.get('name', slug)}"]
|
|
175
|
+
desc = (skill.get("description") or "").strip()
|
|
176
|
+
if desc:
|
|
177
|
+
lines += ["", desc]
|
|
178
|
+
|
|
179
|
+
lines += ["", "## Trust & safety"]
|
|
180
|
+
lines.append(f"- Unified safety band: **{skill.get('skill_safety', 'unreviewed')}** "
|
|
181
|
+
"(worst-of: scanner / intent review / content review)")
|
|
182
|
+
lines.append(f"- Scanner: {skill.get('safety_status', 'unscanned')}"
|
|
183
|
+
+ (f" — {safety.get('summary')}" if safety.get("summary") else ""))
|
|
184
|
+
lines.append(f"- Intent review: {skill.get('intent_status', 'unreviewed')}")
|
|
185
|
+
lines.append(f"- Content review: {skill.get('content_status', 'unreviewed')}")
|
|
186
|
+
if skill.get("skill_badge"):
|
|
187
|
+
lines.append(f"- Badge: {skill['skill_badge']}")
|
|
188
|
+
|
|
189
|
+
lines += ["", "## Evidence"]
|
|
190
|
+
lines.append(f"- SkillScore (v2, evidence-tiered): {_fmt_score(eff.get('skill_score'))}")
|
|
191
|
+
if eff.get("avg_pass_rate") is not None:
|
|
192
|
+
lines.append(f"- Live pass rate: {_fmt_pct(100 * float(eff['avg_pass_rate']))}%")
|
|
193
|
+
if bench:
|
|
194
|
+
lines.append(
|
|
195
|
+
f"- Latest verified benchmark: verdict **{bench.get('verdict', '?')}**, "
|
|
196
|
+
f"lift {_fmt_pct(bench.get('pass_rate_delta_pts'), signed=True)} pts "
|
|
197
|
+
f"({bench.get('passed_cases', '?')}/{bench.get('total_cases', '?')} cases)"
|
|
198
|
+
)
|
|
199
|
+
if bench.get("never_hurt") is not None:
|
|
200
|
+
lines.append(f"- Never-hurt (zero regressed cases): {bench['never_hurt']}")
|
|
201
|
+
history = skill.get("verification_history") or []
|
|
202
|
+
if history:
|
|
203
|
+
latest = history[0]
|
|
204
|
+
lines.append(
|
|
205
|
+
f"- Last re-verified: {latest.get('verified_at', '?')} "
|
|
206
|
+
f"({latest.get('verification_method', 'verified')} on {latest.get('runner_model', '?')})"
|
|
207
|
+
)
|
|
208
|
+
lines.append(f"- Installs: {skill.get('install_count', 0)}; "
|
|
209
|
+
f"rating: {skill.get('avg_rating') or '—'} ({skill.get('rating_count', 0)} ratings)")
|
|
210
|
+
if skill.get("installed_as"):
|
|
211
|
+
lines.append(f"- Already installed in your org as `{skill['installed_as']}`")
|
|
212
|
+
|
|
213
|
+
body = (skill.get("body_markdown") or "").strip()
|
|
214
|
+
if body:
|
|
215
|
+
truncated = body if len(body) <= 4000 else body[:4000] + "\n\n… [truncated]"
|
|
216
|
+
lines += ["", "## SKILL.md body", "", truncated]
|
|
217
|
+
|
|
218
|
+
lines += ["", f"Web page: https://app.decimal.ai/skills/{skill.get('name', slug)}"]
|
|
219
|
+
return "\n".join(lines)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def get_leaderboard(
|
|
223
|
+
sort: str = "biggest_improvement",
|
|
224
|
+
category: Optional[str] = None,
|
|
225
|
+
window_days: int = 30,
|
|
226
|
+
limit: int = 10,
|
|
227
|
+
) -> str:
|
|
228
|
+
"""Ranked skills leaderboard.
|
|
229
|
+
|
|
230
|
+
Without ``category``: the dedicated public leaderboard endpoint
|
|
231
|
+
(axes: skill_score | biggest_improvement | efficiency | top_rated).
|
|
232
|
+
With ``category``: the leaderboard endpoint does not support category
|
|
233
|
+
filtering server-side, so we fall back to the registry browse endpoint
|
|
234
|
+
in its documented ranked view (``view=ranks``) filtered by category.
|
|
235
|
+
"""
|
|
236
|
+
limit = max(1, min(int(limit), 50))
|
|
237
|
+
if category:
|
|
238
|
+
data = _get(
|
|
239
|
+
"/api/v1/registry/skills",
|
|
240
|
+
params={"category": category, "sort": sort, "view": "ranks", "limit": limit},
|
|
241
|
+
)
|
|
242
|
+
items = data.get("items", [])
|
|
243
|
+
title = f"## Top skills in category {category!r} (sorted by {sort})"
|
|
244
|
+
else:
|
|
245
|
+
if sort not in _LEADERBOARD_SORTS:
|
|
246
|
+
return (
|
|
247
|
+
f"Unsupported sort {sort!r}. The public leaderboard supports: "
|
|
248
|
+
+ ", ".join(sorted(_LEADERBOARD_SORTS))
|
|
249
|
+
)
|
|
250
|
+
data = _get(
|
|
251
|
+
"/api/v1/registry/leaderboard",
|
|
252
|
+
params={"sort": sort, "window_days": window_days, "limit": limit},
|
|
253
|
+
)
|
|
254
|
+
items = data.get("items", [])
|
|
255
|
+
title = f"## Skills leaderboard — {sort} (last {window_days} days)"
|
|
256
|
+
|
|
257
|
+
if not items:
|
|
258
|
+
return "The leaderboard returned no entries for these filters."
|
|
259
|
+
lines = [title, ""]
|
|
260
|
+
lines += [_skill_line(item, rank=i + 1) for i, item in enumerate(items)]
|
|
261
|
+
lines += ["", "Every axis is an earned place — gates: ≥2 evidence legs for skill_score; "
|
|
262
|
+
"verified runs only for biggest_improvement."]
|
|
263
|
+
return "\n".join(lines)
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""MCP server entry point.
|
|
2
|
+
|
|
3
|
+
Written against the FastMCP interface of the official ``mcp`` Python SDK
|
|
4
|
+
(``mcp>=1.2,<2``). All tool logic lives in :mod:`decimalai_mcp.api` so it
|
|
5
|
+
is unit-testable without the ``mcp`` package installed.
|
|
6
|
+
|
|
7
|
+
Run directly (stdio transport, the default for Claude Desktop / Claude
|
|
8
|
+
Code)::
|
|
9
|
+
|
|
10
|
+
decimalai-mcp
|
|
11
|
+
# or: python -m decimalai_mcp.server
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
from typing import Optional
|
|
17
|
+
|
|
18
|
+
from mcp.server.fastmcp import FastMCP
|
|
19
|
+
|
|
20
|
+
from . import api
|
|
21
|
+
|
|
22
|
+
mcp = FastMCP(
|
|
23
|
+
"decimalai",
|
|
24
|
+
instructions=(
|
|
25
|
+
"Read-only access to the DecimalAI public skills registry "
|
|
26
|
+
"(https://app.decimal.ai/skills). Skills are ranked by measured "
|
|
27
|
+
"effectiveness (verified A/B benchmarks, live pass rates, AI rater), "
|
|
28
|
+
"not download counts. No API key needed; set DECIMAL_API_KEY to see "
|
|
29
|
+
"which skills your org already installed."
|
|
30
|
+
),
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@mcp.tool()
|
|
35
|
+
def search_skills(
|
|
36
|
+
query: str,
|
|
37
|
+
category: Optional[str] = None,
|
|
38
|
+
sort: str = "recommended",
|
|
39
|
+
limit: int = 10,
|
|
40
|
+
) -> str:
|
|
41
|
+
"""Search the public DecimalAI skills registry.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
query: Keyword or natural-language query (hybrid keyword/semantic search).
|
|
45
|
+
category: Optional category filter (e.g. "retrieval", "code-review").
|
|
46
|
+
sort: recommended (SkillScore v2, default) | lift | popular | top_rated |
|
|
47
|
+
efficiency | rating | recent.
|
|
48
|
+
limit: Max results (1-50).
|
|
49
|
+
"""
|
|
50
|
+
return api.search_skills(query, category=category, sort=sort, limit=limit)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@mcp.tool()
|
|
54
|
+
def get_skill(slug: str) -> str:
|
|
55
|
+
"""Get one skill's full record: trust/safety-scan status, verified benchmark
|
|
56
|
+
evidence (lift vs no-skill baseline), SkillScore, ratings, and the SKILL.md body.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
slug: The skill's registry name (the `name` field from search results).
|
|
60
|
+
"""
|
|
61
|
+
return api.get_skill(slug)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@mcp.tool()
|
|
65
|
+
def get_leaderboard(
|
|
66
|
+
sort: str = "biggest_improvement",
|
|
67
|
+
category: Optional[str] = None,
|
|
68
|
+
window_days: int = 30,
|
|
69
|
+
limit: int = 10,
|
|
70
|
+
) -> str:
|
|
71
|
+
"""Ranked skills leaderboard.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
sort: skill_score | biggest_improvement | efficiency | top_rated.
|
|
75
|
+
category: Optional category filter (uses the registry's ranked browse
|
|
76
|
+
view — the dedicated leaderboard endpoint is uncategorized).
|
|
77
|
+
window_days: Ranking window in days (1-3650; ignored for skill_score).
|
|
78
|
+
limit: Max entries (1-50).
|
|
79
|
+
"""
|
|
80
|
+
return api.get_leaderboard(
|
|
81
|
+
sort=sort, category=category, window_days=window_days, limit=limit
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def main() -> None:
|
|
86
|
+
mcp.run()
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if __name__ == "__main__":
|
|
90
|
+
main()
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "decimalai-mcp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "MCP server for the DecimalAI skills registry — search skills, inspect trust/benchmark evidence, and read the leaderboard from any MCP client."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [{name = "Decimal AI"}]
|
|
13
|
+
keywords = ["mcp", "model-context-protocol", "agents", "skills", "decimalai"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
|
+
"Typing :: Typed",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
dependencies = [
|
|
28
|
+
# Official MCP Python SDK. Written against the FastMCP interface
|
|
29
|
+
# (`mcp.server.fastmcp.FastMCP`), stable since mcp 1.2.0.
|
|
30
|
+
#
|
|
31
|
+
# The `<2` cap is LOAD-BEARING, not precautionary — verified 2026-07-31:
|
|
32
|
+
# mcp 2.0.0 REMOVED the module outright. Under mcp 2.0.0,
|
|
33
|
+
# `from mcp.server.fastmcp import FastMCP` raises
|
|
34
|
+
# ModuleNotFoundError: No module named 'mcp.server.fastmcp',
|
|
35
|
+
# and decimalai_mcp.server fails at import. Do not widen this cap without
|
|
36
|
+
# porting server.py to the 2.x server API first.
|
|
37
|
+
"mcp>=1.2.0,<2",
|
|
38
|
+
# Same floor as decimalai-python (H32-adjacent): 0.28.1 is the modern
|
|
39
|
+
# httpx line; MockTransport + BaseTransport used by the tests exist
|
|
40
|
+
# well before it, so the floor is driven by co-installability.
|
|
41
|
+
"httpx>=0.28.1",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.optional-dependencies]
|
|
45
|
+
dev = [
|
|
46
|
+
"pytest>=7.0",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[project.scripts]
|
|
50
|
+
decimalai-mcp = "decimalai_mcp.server:main"
|
|
51
|
+
|
|
52
|
+
[project.urls]
|
|
53
|
+
Homepage = "https://github.com/decimal-labs/decimalai-mcp"
|
|
54
|
+
Documentation = "https://docs.decimal.ai"
|
|
55
|
+
Repository = "https://github.com/decimal-labs/decimalai-mcp"
|
|
56
|
+
|
|
57
|
+
[tool.hatch.build.targets.wheel]
|
|
58
|
+
packages = ["decimalai_mcp"]
|
|
59
|
+
|
|
60
|
+
[tool.pytest.ini_options]
|
|
61
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.decimal-labs/registry",
|
|
4
|
+
"title": "DecimalAI Skills Registry",
|
|
5
|
+
"description": "Search the DecimalAI skills registry, inspect trust/scan status and verified benchmark evidence, and read the effectiveness leaderboard.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/decimal-labs/decimalai-mcp",
|
|
8
|
+
"source": "github"
|
|
9
|
+
},
|
|
10
|
+
"version": "0.1.0",
|
|
11
|
+
"websiteUrl": "https://app.decimal.ai/skills",
|
|
12
|
+
"packages": [
|
|
13
|
+
{
|
|
14
|
+
"registryType": "pypi",
|
|
15
|
+
"identifier": "decimalai-mcp",
|
|
16
|
+
"version": "0.1.0",
|
|
17
|
+
"transport": {
|
|
18
|
+
"type": "stdio"
|
|
19
|
+
},
|
|
20
|
+
"environmentVariables": [
|
|
21
|
+
{
|
|
22
|
+
"name": "DECIMAL_API_KEY",
|
|
23
|
+
"description": "Optional DecimalAI API key (dai_sk_...). All tools work anonymously; the key adds per-org enrichment such as installed_as.",
|
|
24
|
+
"isRequired": false,
|
|
25
|
+
"isSecret": true,
|
|
26
|
+
"format": "string"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "ai.decimal/registry",
|
|
4
|
+
"title": "DecimalAI Skills Registry",
|
|
5
|
+
"description": "Search the DecimalAI skills registry, inspect trust/scan status and verified benchmark evidence, and read the effectiveness leaderboard.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/decimal-labs/decimalai-mcp",
|
|
8
|
+
"source": "github"
|
|
9
|
+
},
|
|
10
|
+
"version": "0.1.0",
|
|
11
|
+
"websiteUrl": "https://app.decimal.ai/skills",
|
|
12
|
+
"packages": [
|
|
13
|
+
{
|
|
14
|
+
"registryType": "pypi",
|
|
15
|
+
"identifier": "decimalai-mcp",
|
|
16
|
+
"version": "0.1.0",
|
|
17
|
+
"transport": {
|
|
18
|
+
"type": "stdio"
|
|
19
|
+
},
|
|
20
|
+
"environmentVariables": [
|
|
21
|
+
{
|
|
22
|
+
"name": "DECIMAL_API_KEY",
|
|
23
|
+
"description": "Optional DecimalAI API key (dai_sk_...). All tools work anonymously; the key adds per-org enrichment such as installed_as.",
|
|
24
|
+
"isRequired": false,
|
|
25
|
+
"isSecret": true,
|
|
26
|
+
"format": "string"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Smithery configuration — verify current schema at https://smithery.ai/docs before submitting.
|
|
2
|
+
startCommand:
|
|
3
|
+
type: stdio
|
|
4
|
+
configSchema:
|
|
5
|
+
type: object
|
|
6
|
+
properties:
|
|
7
|
+
decimalApiKey:
|
|
8
|
+
type: string
|
|
9
|
+
description: Optional DecimalAI API key (dai_sk_...). All tools work anonymously.
|
|
10
|
+
required: []
|
|
11
|
+
commandFunction: |-
|
|
12
|
+
(config) => ({
|
|
13
|
+
command: "decimalai-mcp",
|
|
14
|
+
args: [],
|
|
15
|
+
env: config.decimalApiKey ? { DECIMAL_API_KEY: config.decimalApiKey } : {}
|
|
16
|
+
})
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"""Unit tests for the DecimalAI MCP server's tool logic.
|
|
2
|
+
|
|
3
|
+
All HTTP is mocked with ``httpx.MockTransport`` — no network. The response
|
|
4
|
+
shapes mirror the real backend's documented examples
|
|
5
|
+
(platform/backend/app/api/registry.py: _BROWSE_RESPONSE_EXAMPLE /
|
|
6
|
+
_GET_REGISTRY_RESPONSE_EXAMPLE and the /leaderboard payload).
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
|
|
13
|
+
import httpx
|
|
14
|
+
import pytest
|
|
15
|
+
|
|
16
|
+
from decimalai_mcp import api
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
BROWSE_RESPONSE = {
|
|
20
|
+
"items": [
|
|
21
|
+
{
|
|
22
|
+
"id": "sk_pub123",
|
|
23
|
+
"name": "semantic-search",
|
|
24
|
+
"description": "Semantic search over knowledge bases",
|
|
25
|
+
"category": "retrieval",
|
|
26
|
+
"skill_badge": "verified",
|
|
27
|
+
"skill_safety": "passed",
|
|
28
|
+
"install_count": 230,
|
|
29
|
+
"effectiveness": {"skill_score": 0.85},
|
|
30
|
+
"benchmark_summary": {"verdict": "pass", "pass_rate_delta_pts": 12.0},
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
# Live browse payload keys (verified 2026-07-23): items / next_cursor /
|
|
34
|
+
# has_next / total_hint — there is no top-level "total".
|
|
35
|
+
"total_hint": 45,
|
|
36
|
+
"has_next": True,
|
|
37
|
+
"next_cursor": None,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
DETAIL_RESPONSE = {
|
|
41
|
+
"id": "sk_pub123",
|
|
42
|
+
"name": "semantic-search",
|
|
43
|
+
"display_name": "Semantic Search",
|
|
44
|
+
"description": "Semantic search over knowledge bases",
|
|
45
|
+
"category": "retrieval",
|
|
46
|
+
"skill_badge": "verified",
|
|
47
|
+
"skill_safety": "passed",
|
|
48
|
+
"safety_status": "clean",
|
|
49
|
+
"safety": {"status": "clean", "summary": "No findings"},
|
|
50
|
+
"intent_status": "approved",
|
|
51
|
+
"content_status": "approved",
|
|
52
|
+
"install_count": 230,
|
|
53
|
+
"avg_rating": 4.5,
|
|
54
|
+
"rating_count": 18,
|
|
55
|
+
"effectiveness": {"skill_score": 0.85, "avg_pass_rate": 0.92},
|
|
56
|
+
"benchmark_summary": {
|
|
57
|
+
"verdict": "pass",
|
|
58
|
+
"total_cases": 24,
|
|
59
|
+
"passed_cases": 22,
|
|
60
|
+
"pass_rate_delta_pts": 12.0,
|
|
61
|
+
"never_hurt": True,
|
|
62
|
+
},
|
|
63
|
+
"verification_history": [
|
|
64
|
+
{
|
|
65
|
+
"runner_model": "gemini-3.5-flash",
|
|
66
|
+
"verified_at": "2026-07-01T00:00:00Z",
|
|
67
|
+
"verification_method": "replay",
|
|
68
|
+
"delta_pts": 12.0,
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"body_markdown": "## When to use\n\nUse this skill for KB questions.",
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
LEADERBOARD_RESPONSE = {
|
|
75
|
+
"sort": "biggest_improvement",
|
|
76
|
+
"window_days": 30,
|
|
77
|
+
"items": [
|
|
78
|
+
{
|
|
79
|
+
"rank": 1,
|
|
80
|
+
"name": "sql-analyst",
|
|
81
|
+
"description": "Exec-graded SQL answering",
|
|
82
|
+
"skill_badge": "verified",
|
|
83
|
+
"install_count": 90,
|
|
84
|
+
"metric": {"label": "+66 pts pass rate", "value": 66.0, "kind": "pass_rate_improvement"},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"rank": 2,
|
|
88
|
+
"name": "semantic-search",
|
|
89
|
+
"description": "Semantic search over knowledge bases",
|
|
90
|
+
"install_count": 230,
|
|
91
|
+
"metric": {"label": "+12 pts pass rate", "value": 12.0, "kind": "pass_rate_improvement"},
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
"total": 2,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@pytest.fixture
|
|
99
|
+
def capture(monkeypatch):
|
|
100
|
+
"""Install a MockTransport; captured[0] is the last request seen."""
|
|
101
|
+
captured: list[httpx.Request] = []
|
|
102
|
+
|
|
103
|
+
def make_handler(payload, status_code=200):
|
|
104
|
+
def handler(request: httpx.Request) -> httpx.Response:
|
|
105
|
+
captured.append(request)
|
|
106
|
+
return httpx.Response(status_code, json=payload)
|
|
107
|
+
return handler
|
|
108
|
+
|
|
109
|
+
def install(payload, status_code=200):
|
|
110
|
+
monkeypatch.setattr(
|
|
111
|
+
api, "_transport", httpx.MockTransport(make_handler(payload, status_code))
|
|
112
|
+
)
|
|
113
|
+
return captured
|
|
114
|
+
|
|
115
|
+
return install
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class TestSearchSkills:
|
|
119
|
+
def test_hits_public_registry_endpoint_with_query(self, capture):
|
|
120
|
+
captured = capture(BROWSE_RESPONSE)
|
|
121
|
+
out = api.search_skills("semantic search")
|
|
122
|
+
req = captured[0]
|
|
123
|
+
assert req.url.path == "/api/v1/registry/skills"
|
|
124
|
+
assert req.url.params["q"] == "semantic search"
|
|
125
|
+
assert req.url.params["sort"] == "recommended"
|
|
126
|
+
assert "semantic-search" in out
|
|
127
|
+
assert "(1 of 45)" in out # total_hint, not the absent "total" key
|
|
128
|
+
assert "SkillScore 0.85" in out
|
|
129
|
+
assert "+12.0 pts" in out # benchmark lift surfaced
|
|
130
|
+
|
|
131
|
+
def test_no_auth_header_without_api_key(self, capture, monkeypatch):
|
|
132
|
+
monkeypatch.delenv("DECIMAL_API_KEY", raising=False)
|
|
133
|
+
captured = capture(BROWSE_RESPONSE)
|
|
134
|
+
api.search_skills("x")
|
|
135
|
+
assert "authorization" not in captured[0].headers
|
|
136
|
+
|
|
137
|
+
def test_api_key_env_unlocks_bearer_auth(self, capture, monkeypatch):
|
|
138
|
+
monkeypatch.setenv("DECIMAL_API_KEY", "dai_sk_test")
|
|
139
|
+
captured = capture(BROWSE_RESPONSE)
|
|
140
|
+
api.search_skills("x")
|
|
141
|
+
assert captured[0].headers["authorization"] == "Bearer dai_sk_test"
|
|
142
|
+
|
|
143
|
+
def test_base_url_override(self, capture, monkeypatch):
|
|
144
|
+
monkeypatch.setenv("DECIMAL_API_URL", "http://localhost:8000")
|
|
145
|
+
captured = capture(BROWSE_RESPONSE)
|
|
146
|
+
api.search_skills("x")
|
|
147
|
+
assert captured[0].url.host == "localhost"
|
|
148
|
+
|
|
149
|
+
def test_category_filter_and_limit_clamp(self, capture):
|
|
150
|
+
captured = capture(BROWSE_RESPONSE)
|
|
151
|
+
api.search_skills("x", category="retrieval", limit=500)
|
|
152
|
+
params = captured[0].url.params
|
|
153
|
+
assert params["category"] == "retrieval"
|
|
154
|
+
assert params["limit"] == "50"
|
|
155
|
+
|
|
156
|
+
def test_empty_results(self, capture):
|
|
157
|
+
capture({"items": [], "total": 0})
|
|
158
|
+
out = api.search_skills("no-such-thing")
|
|
159
|
+
assert "No public skills matched" in out
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class TestGetSkill:
|
|
163
|
+
def test_detail_includes_trust_and_benchmark(self, capture):
|
|
164
|
+
captured = capture(DETAIL_RESPONSE)
|
|
165
|
+
out = api.get_skill("semantic-search")
|
|
166
|
+
assert captured[0].url.path == "/api/v1/registry/skills/semantic-search"
|
|
167
|
+
assert "**passed**" in out # unified safety band
|
|
168
|
+
assert "Scanner: clean" in out
|
|
169
|
+
assert "Intent review: approved" in out
|
|
170
|
+
assert "verdict **pass**" in out # benchmark verdict
|
|
171
|
+
assert "+12.0 pts" in out
|
|
172
|
+
assert "Never-hurt" in out
|
|
173
|
+
assert "replay" in out # verification history method
|
|
174
|
+
assert "## SKILL.md body" in out
|
|
175
|
+
assert "app.decimal.ai/skills/semantic-search" in out
|
|
176
|
+
|
|
177
|
+
def test_slug_is_percent_encoded_in_path(self, capture):
|
|
178
|
+
captured = capture(DETAIL_RESPONSE)
|
|
179
|
+
api.get_skill("../../api-keys?x=1")
|
|
180
|
+
raw = captured[0].url.raw_path.decode()
|
|
181
|
+
assert raw == "/api/v1/registry/skills/..%2F..%2Fapi-keys%3Fx%3D1"
|
|
182
|
+
|
|
183
|
+
def test_404_returns_helpful_message(self, capture):
|
|
184
|
+
capture({"detail": "Registry skill not found"}, status_code=404)
|
|
185
|
+
out = api.get_skill("nope")
|
|
186
|
+
assert "No public registry skill named 'nope'" in out
|
|
187
|
+
|
|
188
|
+
def test_long_body_truncated(self, capture):
|
|
189
|
+
detail = dict(DETAIL_RESPONSE, body_markdown="x" * 10000)
|
|
190
|
+
capture(detail)
|
|
191
|
+
out = api.get_skill("semantic-search")
|
|
192
|
+
assert "[truncated]" in out
|
|
193
|
+
assert len(out) < 9000
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class TestGetLeaderboard:
|
|
197
|
+
def test_default_uses_leaderboard_endpoint(self, capture):
|
|
198
|
+
captured = capture(LEADERBOARD_RESPONSE)
|
|
199
|
+
out = api.get_leaderboard()
|
|
200
|
+
req = captured[0]
|
|
201
|
+
assert req.url.path == "/api/v1/registry/leaderboard"
|
|
202
|
+
assert req.url.params["sort"] == "biggest_improvement"
|
|
203
|
+
assert req.url.params["window_days"] == "30"
|
|
204
|
+
assert "1. **sql-analyst**" in out
|
|
205
|
+
assert "+66 pts pass rate" in out
|
|
206
|
+
|
|
207
|
+
def test_category_falls_back_to_ranked_browse(self, capture):
|
|
208
|
+
captured = capture(BROWSE_RESPONSE)
|
|
209
|
+
api.get_leaderboard(category="retrieval", sort="skill_score")
|
|
210
|
+
req = captured[0]
|
|
211
|
+
assert req.url.path == "/api/v1/registry/skills"
|
|
212
|
+
assert req.url.params["view"] == "ranks"
|
|
213
|
+
assert req.url.params["category"] == "retrieval"
|
|
214
|
+
|
|
215
|
+
def test_invalid_sort_rejected_client_side(self, capture):
|
|
216
|
+
captured = capture(LEADERBOARD_RESPONSE)
|
|
217
|
+
out = api.get_leaderboard(sort="installs")
|
|
218
|
+
assert "Unsupported sort" in out
|
|
219
|
+
assert not captured # never hit the network
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
class TestServerModule:
|
|
223
|
+
def test_tools_registered(self):
|
|
224
|
+
"""The FastMCP server exposes exactly the three read-only tools."""
|
|
225
|
+
mcp_pkg = pytest.importorskip("mcp") # noqa: F841 — skip if mcp absent
|
|
226
|
+
from decimalai_mcp.server import mcp as server
|
|
227
|
+
|
|
228
|
+
import anyio
|
|
229
|
+
|
|
230
|
+
tools = anyio.run(server.list_tools)
|
|
231
|
+
names = {t.name for t in tools}
|
|
232
|
+
assert names == {"search_skills", "get_skill", "get_leaderboard"}
|