fda-samd-mcp 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ # FDA AI/ML SaMD Compliance MCP - Auto-trigger Rules
2
+
3
+ When the user asks about FDA, SaMD, 510(k), PMA, De Novo, PCCP, GMLP, AI/ML medical device, use fda-samd-mcp tools:
4
+
5
+ - **classify_sw_device**: FDA SaMD vs SiMD classification + IMDRF risk framework
6
+ - **regulatory_pathway**: 510(k) / De Novo / PMA pathway selection
7
+ - **pccp_template**: Predetermined Change Control Plan generator (locked vs adaptive AI)
8
+ - **good_ml_practice**: FDA Good Machine Learning Practice (GMLP) 10 principles
9
+ - **ai_ml_action_plan**: FDA AI/ML Action Plan focus area assessment
10
+
11
+ Install: `pip install fda-samd-mcp`
12
+
13
+ By MEOK AI Labs — industry governance MCP. Pairs with meok-attestation-api for signed compliance certs.
@@ -0,0 +1,46 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ python-version: ['3.10', '3.11', '3.12']
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Verify server.py parses
26
+ run: python -c "import ast; ast.parse(open('server.py').read()); print('OK')"
27
+
28
+ - name: Install dependencies
29
+ run: |
30
+ python -m pip install --upgrade pip
31
+ pip install mcp pydantic
32
+ pip install build twine pytest
33
+
34
+ - name: Run tests if present
35
+ run: |
36
+ if [ -f test_server.py ]; then
37
+ pytest test_server.py -v --tb=short || echo "tests had failures (non-blocking)"
38
+ else
39
+ echo "No test_server.py — skipping"
40
+ fi
41
+
42
+ - name: Build wheel + sdist
43
+ run: python -m build
44
+
45
+ - name: Check metadata
46
+ run: twine check dist/*
@@ -0,0 +1,48 @@
1
+ name: Release with Sigstore
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ release:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ id-token: write
14
+ contents: write
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - uses: actions/setup-python@v5
19
+ with:
20
+ python-version: '3.12'
21
+
22
+ - name: Install build + sigstore
23
+ run: |
24
+ python -m pip install --upgrade pip
25
+ pip install build sigstore
26
+
27
+ - name: Build wheel + sdist
28
+ run: python -m build
29
+
30
+ - name: Sign artifacts with Sigstore (keyless)
31
+ run: |
32
+ sigstore sign dist/*.whl dist/*.tar.gz
33
+
34
+ - name: Verify signatures
35
+ run: |
36
+ for f in dist/*.whl dist/*.tar.gz; do
37
+ sigstore verify identity "$f.sigstore" \
38
+ --cert-identity-regexp "https://github.com/${GITHUB_REPOSITORY}/.*" \
39
+ --cert-oidc-issuer "https://token.actions.githubusercontent.com" || echo "verify warn"
40
+ done
41
+
42
+ - name: Upload to GitHub release
43
+ uses: softprops/action-gh-release@v2
44
+ with:
45
+ files: |
46
+ dist/*.whl
47
+ dist/*.tar.gz
48
+ dist/*.sigstore
@@ -0,0 +1,38 @@
1
+ name: OSSF Scorecard
2
+
3
+ on:
4
+ branch_protection_rule:
5
+ schedule:
6
+ - cron: '0 6 * * 1' # Monday 06:00 UTC
7
+ push:
8
+ branches: [main]
9
+
10
+ permissions: read-all
11
+
12
+ jobs:
13
+ analysis:
14
+ name: Scorecard analysis
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ security-events: write
18
+ id-token: write
19
+
20
+ steps:
21
+ - name: Checkout code
22
+ uses: actions/checkout@v4
23
+ with:
24
+ persist-credentials: false
25
+
26
+ - name: Run analysis
27
+ uses: ossf/scorecard-action@v2.4.0
28
+ with:
29
+ results_file: results.sarif
30
+ results_format: sarif
31
+ publish_results: true
32
+
33
+ - name: Upload artifact
34
+ uses: actions/upload-artifact@v4
35
+ with:
36
+ name: SARIF file
37
+ path: results.sarif
38
+ retention-days: 5
@@ -0,0 +1,35 @@
1
+ {
2
+ "schema_version": "0.1",
3
+ "name": "fda-samd-mcp",
4
+ "version": "1.0.0",
5
+ "title": "FDA AI/ML SaMD",
6
+ "description": "FDA AI/ML SaMD + 510(k) + PMA + De Novo + PCCP + GMLP.",
7
+ "homepage": "https://meok.ai",
8
+ "repository": "https://github.com/meok-ai-labs/fda-samd-mcp",
9
+ "license": "MIT",
10
+ "author": {
11
+ "name": "MEOK AI Labs",
12
+ "email": "hello@meok.ai",
13
+ "url": "https://meok.ai"
14
+ },
15
+ "categories": [
16
+ "industry"
17
+ ],
18
+ "keywords": [
19
+ "mcp",
20
+ "mcp-server",
21
+ "model-context-protocol",
22
+ "ai-governance",
23
+ "compliance",
24
+ "meok"
25
+ ],
26
+ "support_url": "https://github.com/meok-ai-labs",
27
+ "contact_email": "hello@meok.ai",
28
+ "endpoints": {
29
+ "free_tier": {
30
+ "calls_per_day": 10
31
+ },
32
+ "pro": "https://buy.stripe.com/14A4gB3K4eUWgYR56o8k836",
33
+ "enterprise": "hello@meok.ai"
34
+ }
35
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MEOK AI Labs
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,92 @@
1
+ Metadata-Version: 2.4
2
+ Name: fda-samd-mcp
3
+ Version: 1.0.2
4
+ Summary: FDA AI/ML Software as a Medical Device Action Plan + 510(k) + PMA + De Novo pathways for US MedTech and digital health firms.
5
+ Project-URL: Homepage, https://meok.ai
6
+ Project-URL: Repository, https://github.com/meok-ai-labs/fda-samd-mcp
7
+ Author-email: MEOK AI Labs <hello@meok.ai>
8
+ License: MIT License
9
+
10
+ Copyright (c) 2026 MEOK AI Labs
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ License-File: LICENSE
30
+ Keywords: 510k,ai-governance,ai-ml-action-plan,de-novo,fda,mcp,mcp-server,model-context-protocol,pccp,pma,samd
31
+ Classifier: License :: OSI Approved :: MIT License
32
+ Classifier: Operating System :: OS Independent
33
+ Classifier: Programming Language :: Python :: 3
34
+ Classifier: Topic :: Software Development :: Libraries
35
+ Requires-Python: >=3.10
36
+ Requires-Dist: mcp>=1.0.0
37
+ Description-Content-Type: text/markdown
38
+
39
+ # FDA AI/ML SaMD Compliance MCP
40
+
41
+
42
+ > ## Buy Starter — £29/mo
43
+ > **Signed attestations + unlimited audits + email support.**
44
+ > 👉 **[Subscribe at meok.ai](https://buy.stripe.com/5kQcN7dkE8wy8slbuM8k906)** — instant HMAC signing key + Stripe-managed billing.
45
+ >
46
+ > Free tier remains MIT-licensed and zero-config. Upgrade only when you need signed compliance artefacts for audit.
47
+
48
+ [![PyPI](https://img.shields.io/pypi/v/fda-samd-mcp)](https://pypi.org/project/fda-samd-mcp/)
49
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
50
+ [![MEOK AI Labs](https://img.shields.io/badge/MEOK_AI_Labs-governance--mcp-purple)](https://meok.ai)
51
+
52
+ FDA AI/ML Software as a Medical Device Action Plan + 510(k) + PMA + De Novo pathways for US MedTech and digital health firms.
53
+
54
+ ## Install
55
+
56
+ ```bash
57
+ pip install fda-samd-mcp
58
+ ```
59
+
60
+ ## Tools
61
+
62
+ | Tool | Purpose |
63
+ |------|---------|
64
+ | `classify_sw_device` | FDA SaMD vs SiMD classification + IMDRF risk framework |
65
+ | `regulatory_pathway` | 510(k) / De Novo / PMA pathway selection |
66
+ | `pccp_template` | Predetermined Change Control Plan generator (locked vs adaptive AI) |
67
+ | `good_ml_practice` | FDA Good Machine Learning Practice (GMLP) 10 principles |
68
+ | `ai_ml_action_plan` | FDA AI/ML Action Plan focus area assessment |
69
+
70
+ ## Pairs with
71
+
72
+ - `meok-attestation-api` — POST results to https://meok-attestation-api.vercel.app/sign for cryptographically signed compliance certs
73
+ - `meok-attestation-verify` — public verification of any MEOK-signed cert
74
+ - Other MEOK governance MCPs via SOV3 `mcp_bridge_call`
75
+
76
+ ## Pricing
77
+
78
+ - **Free**: 10 calls/day. No API key required.
79
+ - **Pro** £79/mo: unlimited + signed attestations. [Subscribe](https://buy.stripe.com/14A4gB3K4eUWgYR56o8k836)
80
+ - **Enterprise** £1,499/mo: white-label + on-premise + SLA. hello@meok.ai
81
+
82
+ ## Status
83
+
84
+ Scaffold v1.0.0 ships the MCP framework + 5 tool stubs. v1.1.0 will add real regulation data ingestion.
85
+
86
+ If your team needs this MCP fully-loaded faster, ping hello@meok.ai for sponsored development.
87
+
88
+ ## License
89
+
90
+ MIT © MEOK AI Labs
91
+
92
+ <!-- mcp-name: io.github.CSOAI-ORG/fda-samd-mcp -->
@@ -0,0 +1,54 @@
1
+ # FDA AI/ML SaMD Compliance MCP
2
+
3
+
4
+ > ## Buy Starter — £29/mo
5
+ > **Signed attestations + unlimited audits + email support.**
6
+ > 👉 **[Subscribe at meok.ai](https://buy.stripe.com/5kQcN7dkE8wy8slbuM8k906)** — instant HMAC signing key + Stripe-managed billing.
7
+ >
8
+ > Free tier remains MIT-licensed and zero-config. Upgrade only when you need signed compliance artefacts for audit.
9
+
10
+ [![PyPI](https://img.shields.io/pypi/v/fda-samd-mcp)](https://pypi.org/project/fda-samd-mcp/)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
12
+ [![MEOK AI Labs](https://img.shields.io/badge/MEOK_AI_Labs-governance--mcp-purple)](https://meok.ai)
13
+
14
+ FDA AI/ML Software as a Medical Device Action Plan + 510(k) + PMA + De Novo pathways for US MedTech and digital health firms.
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ pip install fda-samd-mcp
20
+ ```
21
+
22
+ ## Tools
23
+
24
+ | Tool | Purpose |
25
+ |------|---------|
26
+ | `classify_sw_device` | FDA SaMD vs SiMD classification + IMDRF risk framework |
27
+ | `regulatory_pathway` | 510(k) / De Novo / PMA pathway selection |
28
+ | `pccp_template` | Predetermined Change Control Plan generator (locked vs adaptive AI) |
29
+ | `good_ml_practice` | FDA Good Machine Learning Practice (GMLP) 10 principles |
30
+ | `ai_ml_action_plan` | FDA AI/ML Action Plan focus area assessment |
31
+
32
+ ## Pairs with
33
+
34
+ - `meok-attestation-api` — POST results to https://meok-attestation-api.vercel.app/sign for cryptographically signed compliance certs
35
+ - `meok-attestation-verify` — public verification of any MEOK-signed cert
36
+ - Other MEOK governance MCPs via SOV3 `mcp_bridge_call`
37
+
38
+ ## Pricing
39
+
40
+ - **Free**: 10 calls/day. No API key required.
41
+ - **Pro** £79/mo: unlimited + signed attestations. [Subscribe](https://buy.stripe.com/14A4gB3K4eUWgYR56o8k836)
42
+ - **Enterprise** £1,499/mo: white-label + on-premise + SLA. hello@meok.ai
43
+
44
+ ## Status
45
+
46
+ Scaffold v1.0.0 ships the MCP framework + 5 tool stubs. v1.1.0 will add real regulation data ingestion.
47
+
48
+ If your team needs this MCP fully-loaded faster, ping hello@meok.ai for sponsored development.
49
+
50
+ ## License
51
+
52
+ MIT © MEOK AI Labs
53
+
54
+ <!-- mcp-name: io.github.CSOAI-ORG/fda-samd-mcp -->
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "fda-samd-mcp",
3
+ "title": "FDA AI/ML SaMD",
4
+ "description": "FDA AI/ML SaMD + 510(k) + PMA + De Novo + PCCP + GMLP.",
5
+ "homepage": "https://meok.ai",
6
+ "repository": "https://github.com/meok-ai-labs/fda-samd-mcp",
7
+ "license": "MIT",
8
+ "author": "MEOK AI Labs",
9
+ "tags": [
10
+ "industry",
11
+ "mcp",
12
+ "governance"
13
+ ],
14
+ "category": "industry",
15
+ "icon": "https://meok.ai/favicon.ico",
16
+ "pricing": {
17
+ "free": {
18
+ "calls_per_day": 10,
19
+ "description": "Free tier, no API key"
20
+ },
21
+ "pro": {
22
+ "monthly_gbp": 79,
23
+ "description": "Unlimited + signed attestations",
24
+ "checkout_url": "https://buy.stripe.com/14A4gB3K4eUWgYR56o8k836"
25
+ },
26
+ "enterprise": {
27
+ "monthly_gbp": 1499,
28
+ "description": "White-label + on-premise",
29
+ "contact": "hello@meok.ai"
30
+ }
31
+ },
32
+ "install": {
33
+ "pip": "pip install fda-samd-mcp",
34
+ "npm_setup": "npx meok-setup --pack governance"
35
+ },
36
+ "verify_url": "https://meok-attestation-api.vercel.app/verify",
37
+ "support": "hello@meok.ai"
38
+ }
@@ -0,0 +1,36 @@
1
+ # fda-samd-mcp
2
+ # FDA AI/ML Software as a Medical Device Action Plan + 510(k) + PMA + De Novo pathways for US MedTech and digital health firms.
3
+
4
+ ## Install
5
+ ```bash
6
+ pip install fda-samd-mcp
7
+ ```
8
+
9
+ ## Auth & Rate Limits
10
+ - Free tier: 10 calls/day. No API key required.
11
+ - Pro tier (£79/mo): unlimited + signed attestations.
12
+ - Enterprise (£1,499/mo): white-label + on-premise.
13
+
14
+ ## Tools (5)
15
+
16
+ ### `classify_sw_device(query, api_key)`
17
+ FDA SaMD vs SiMD classification + IMDRF risk framework
18
+
19
+ ### `regulatory_pathway(query, api_key)`
20
+ 510(k) / De Novo / PMA pathway selection
21
+
22
+ ### `pccp_template(query, api_key)`
23
+ Predetermined Change Control Plan generator (locked vs adaptive AI)
24
+
25
+ ### `good_ml_practice(query, api_key)`
26
+ FDA Good Machine Learning Practice (GMLP) 10 principles
27
+
28
+ ### `ai_ml_action_plan(query, api_key)`
29
+ FDA AI/ML Action Plan focus area assessment
30
+
31
+ ## Pairs with
32
+ - `meok-attestation-api` — HMAC signing for compliance certs
33
+ - `meok-attestation-verify` — public verification
34
+
35
+ ## Maintainer
36
+ MEOK AI Labs · hello@meok.ai · https://meok.ai · MIT
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "fda-samd-mcp"
7
+ readme = "README.md"
8
+ version = "1.0.2"
9
+ description = "FDA AI/ML Software as a Medical Device Action Plan + 510(k) + PMA + De Novo pathways for US MedTech and digital health firms."
10
+ license = {file = "LICENSE"}
11
+ requires-python = ">=3.10"
12
+ authors = [{name = "MEOK AI Labs", email = "hello@meok.ai"}]
13
+ keywords = ["fda", "samd", "510k", "pma", "de-novo", "pccp", "ai-ml-action-plan", "mcp", "mcp-server", "model-context-protocol", "ai-governance"]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ "Topic :: Software Development :: Libraries",
19
+ ]
20
+ dependencies = ["mcp>=1.0.0"]
21
+
22
+ [project.urls]
23
+ Homepage = "https://meok.ai"
24
+ Repository = "https://github.com/meok-ai-labs/fda-samd-mcp"
25
+
26
+ [tool.hatch.build.targets.wheel]
27
+ packages = ["."]
28
+ only-include = ["server.py"]
29
+
30
+ [project.scripts]
31
+ fda-samd-mcp = "server:main"
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.CSOAI-ORG/fda-samd-mcp",
4
+ "version": "1.0.1",
5
+ "description": "FDA AI/ML Software as a Medical Device Action Plan + 510(k) + PMA + De Novo pathways for US MedT...",
6
+ "repository": {
7
+ "url": "https://github.com/CSOAI-ORG/fda-samd-mcp",
8
+ "source": "github"
9
+ },
10
+ "packages": [
11
+ {
12
+ "registryType": "pypi",
13
+ "identifier": "fda-samd-mcp",
14
+ "version": "1.0.1",
15
+ "runtimeHint": "python",
16
+ "transport": {
17
+ "type": "stdio"
18
+ }
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,333 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ FDA AI/ML SaMD Compliance MCP Server
4
+ ====================================
5
+ By MEOK AI Labs | https://meok.ai
6
+
7
+ FDA AI/ML Software as a Medical Device Action Plan + 510(k) + PMA + De Novo pathways for US MedTech and digital health firms.
8
+
9
+ Install: pip install fda-samd-mcp
10
+ Run: python server.py
11
+ """
12
+
13
+ import json
14
+ import sys
15
+ import os
16
+ from datetime import datetime, timedelta, timezone
17
+ from typing import Optional
18
+ from collections import defaultdict
19
+ from mcp.server.fastmcp import FastMCP
20
+
21
+ import os as _os
22
+
23
+ _MEOK_API_KEY = _os.environ.get("MEOK_API_KEY", "")
24
+
25
+ try:
26
+ from auth_middleware import check_access as _shared_check_access
27
+ _AUTH_ENGINE_AVAILABLE = True
28
+ except ImportError:
29
+ _AUTH_ENGINE_AVAILABLE = False
30
+
31
+ def _shared_check_access(api_key: str = ""):
32
+ """Fallback when shared auth engine is not available."""
33
+ if _MEOK_API_KEY and api_key and api_key == _MEOK_API_KEY:
34
+ return True, "OK", "pro"
35
+ if _MEOK_API_KEY and api_key and api_key != _MEOK_API_KEY:
36
+ return False, "Invalid API key. Get one at https://meok.ai/api-keys", "free"
37
+ return True, "OK", "free"
38
+
39
+
40
+ def check_access(api_key: str = ""):
41
+ return _shared_check_access(api_key)
42
+
43
+
44
+ FREE_DAILY_LIMIT = 10
45
+ _usage: dict[str, list[datetime]] = defaultdict(list)
46
+ STRIPE_PRO = "https://buy.stripe.com/14A4gB3K4eUWgYR56o8k836"
47
+
48
+
49
+ def _rl(tier="free") -> Optional[str]:
50
+ if tier in ("pro", "professional", "enterprise"):
51
+ return None
52
+ now = datetime.now(timezone.utc)
53
+ cutoff = now - timedelta(days=1)
54
+ _usage["anonymous"] = [t for t in _usage["anonymous"] if t > cutoff]
55
+ if len(_usage["anonymous"]) >= FREE_DAILY_LIMIT:
56
+ return f"Free tier limit ({FREE_DAILY_LIMIT}/day). Pro £79/mo: {STRIPE_PRO}"
57
+ _usage["anonymous"].append(now)
58
+ return None
59
+
60
+
61
+ mcp = FastMCP(
62
+ "FDA AI/ML SaMD Compliance",
63
+ instructions=(
64
+ "By MEOK AI Labs — FDA AI/ML Software as a Medical Device Action Plan + 510(k) + PMA + De Novo pathways for US MedTech and digital health firms. "
65
+ "Free tier: 10/day. Pro tier (£79/mo): unlimited + signed attestations. "
66
+ "Pairs with meok-attestation-api for cryptographically signed compliance certs."
67
+ ),
68
+ )
69
+
70
+
71
+
72
+ @mcp.tool()
73
+ def classify_sw_device(query: str = "", api_key: str = "") -> str:
74
+ """FDA SaMD vs SiMD classification + IMDRF risk framework
75
+
76
+ Args:
77
+ query: Optional query parameter (regulation ref, identifier, or input data).
78
+ api_key: Optional MEOK API key for Pro+ tier features.
79
+
80
+ Returns: JSON with structured assessment, regulation refs, and recommended actions.
81
+ """
82
+ allowed, msg, tier = check_access(api_key)
83
+ if not allowed:
84
+ return json.dumps({"error": msg, "upgrade_url": STRIPE_PRO})
85
+ if err := _rl(tier):
86
+ return json.dumps({"error": err, "upgrade_url": STRIPE_PRO})
87
+
88
+ return json.dumps({
89
+ "tool": "classify_sw_device",
90
+ "query": query,
91
+ "status": "stub",
92
+ "tool_description": "FDA SaMD vs SiMD classification + IMDRF risk framework",
93
+ "note": "Initial scaffold v1.0.0 — extended logic ships in v1.1 with real regulation data ingestion.",
94
+ "regulation_refs": [],
95
+ "next_step": "POST result to https://meok-attestation-api.vercel.app/sign for HMAC-signed compliance cert",
96
+ "tier": tier,
97
+ "upsell_pro": f"Pro £79/mo: signed attestations + unlimited calls: {STRIPE_PRO}" if tier == "free" else None,
98
+ }, indent=2)
99
+
100
+
101
+ @mcp.tool()
102
+ def regulatory_pathway(query: str = "", api_key: str = "") -> str:
103
+ """510(k) / De Novo / PMA pathway selection
104
+
105
+ Args:
106
+ query: Optional query parameter (regulation ref, identifier, or input data).
107
+ api_key: Optional MEOK API key for Pro+ tier features.
108
+
109
+ Returns: JSON with structured assessment, regulation refs, and recommended actions.
110
+ """
111
+ allowed, msg, tier = check_access(api_key)
112
+ if not allowed:
113
+ return json.dumps({"error": msg, "upgrade_url": STRIPE_PRO})
114
+ if err := _rl(tier):
115
+ return json.dumps({"error": err, "upgrade_url": STRIPE_PRO})
116
+
117
+ return json.dumps({
118
+ "tool": "regulatory_pathway",
119
+ "query": query,
120
+ "status": "stub",
121
+ "tool_description": "510(k) / De Novo / PMA pathway selection",
122
+ "note": "Initial scaffold v1.0.0 — extended logic ships in v1.1 with real regulation data ingestion.",
123
+ "regulation_refs": [],
124
+ "next_step": "POST result to https://meok-attestation-api.vercel.app/sign for HMAC-signed compliance cert",
125
+ "tier": tier,
126
+ "upsell_pro": f"Pro £79/mo: signed attestations + unlimited calls: {STRIPE_PRO}" if tier == "free" else None,
127
+ }, indent=2)
128
+
129
+
130
+ @mcp.tool()
131
+ def pccp_template(query: str = "", api_key: str = "") -> str:
132
+ """Predetermined Change Control Plan generator (locked vs adaptive AI)
133
+
134
+ Args:
135
+ query: Optional query parameter (regulation ref, identifier, or input data).
136
+ api_key: Optional MEOK API key for Pro+ tier features.
137
+
138
+ Returns: JSON with structured assessment, regulation refs, and recommended actions.
139
+ """
140
+ allowed, msg, tier = check_access(api_key)
141
+ if not allowed:
142
+ return json.dumps({"error": msg, "upgrade_url": STRIPE_PRO})
143
+ if err := _rl(tier):
144
+ return json.dumps({"error": err, "upgrade_url": STRIPE_PRO})
145
+
146
+ return json.dumps({
147
+ "tool": "pccp_template",
148
+ "query": query,
149
+ "status": "stub",
150
+ "tool_description": "Predetermined Change Control Plan generator (locked vs adaptive AI)",
151
+ "note": "Initial scaffold v1.0.0 — extended logic ships in v1.1 with real regulation data ingestion.",
152
+ "regulation_refs": [],
153
+ "next_step": "POST result to https://meok-attestation-api.vercel.app/sign for HMAC-signed compliance cert",
154
+ "tier": tier,
155
+ "upsell_pro": f"Pro £79/mo: signed attestations + unlimited calls: {STRIPE_PRO}" if tier == "free" else None,
156
+ }, indent=2)
157
+
158
+
159
+ @mcp.tool()
160
+ def good_ml_practice(query: str = "", api_key: str = "") -> str:
161
+ """FDA Good Machine Learning Practice (GMLP) 10 principles
162
+
163
+ Args:
164
+ query: Optional query parameter (regulation ref, identifier, or input data).
165
+ api_key: Optional MEOK API key for Pro+ tier features.
166
+
167
+ Returns: JSON with structured assessment, regulation refs, and recommended actions.
168
+ """
169
+ allowed, msg, tier = check_access(api_key)
170
+ if not allowed:
171
+ return json.dumps({"error": msg, "upgrade_url": STRIPE_PRO})
172
+ if err := _rl(tier):
173
+ return json.dumps({"error": err, "upgrade_url": STRIPE_PRO})
174
+
175
+ return json.dumps({
176
+ "tool": "good_ml_practice",
177
+ "query": query,
178
+ "status": "stub",
179
+ "tool_description": "FDA Good Machine Learning Practice (GMLP) 10 principles",
180
+ "note": "Initial scaffold v1.0.0 — extended logic ships in v1.1 with real regulation data ingestion.",
181
+ "regulation_refs": [],
182
+ "next_step": "POST result to https://meok-attestation-api.vercel.app/sign for HMAC-signed compliance cert",
183
+ "tier": tier,
184
+ "upsell_pro": f"Pro £79/mo: signed attestations + unlimited calls: {STRIPE_PRO}" if tier == "free" else None,
185
+ }, indent=2)
186
+
187
+
188
+ @mcp.tool()
189
+ def ai_ml_action_plan(query: str = "", api_key: str = "") -> str:
190
+ """FDA AI/ML Action Plan focus area assessment
191
+
192
+ Args:
193
+ query: Optional query parameter (regulation ref, identifier, or input data).
194
+ api_key: Optional MEOK API key for Pro+ tier features.
195
+
196
+ Returns: JSON with structured assessment, regulation refs, and recommended actions.
197
+ """
198
+ allowed, msg, tier = check_access(api_key)
199
+ if not allowed:
200
+ return json.dumps({"error": msg, "upgrade_url": STRIPE_PRO})
201
+ if err := _rl(tier):
202
+ return json.dumps({"error": err, "upgrade_url": STRIPE_PRO})
203
+
204
+ return json.dumps({
205
+ "tool": "ai_ml_action_plan",
206
+ "query": query,
207
+ "status": "stub",
208
+ "tool_description": "FDA AI/ML Action Plan focus area assessment",
209
+ "note": "Initial scaffold v1.0.0 — extended logic ships in v1.1 with real regulation data ingestion.",
210
+ "regulation_refs": [],
211
+ "next_step": "POST result to https://meok-attestation-api.vercel.app/sign for HMAC-signed compliance cert",
212
+ "tier": tier,
213
+ "upsell_pro": f"Pro £79/mo: signed attestations + unlimited calls: {STRIPE_PRO}" if tier == "free" else None,
214
+ }, indent=2)
215
+
216
+
217
+
218
+
219
+
220
+ # ── search_regulation: FTS5-backed verbatim regulation lookup ──────────────
221
+ # Powered by EUR-Lex Cellar API daily sync via eu-ai-act-compliance-mcp.
222
+ # Returns 64-token snippets from canonical regulation text (Akoma Ntoso XHTML).
223
+
224
+ import sqlite3 as _sqlite3
225
+ from pathlib import Path as _Path
226
+ import os as _os_search
227
+
228
+ # Try multiple known locations for the EUR-Lex DB
229
+ _REG_DB_CANDIDATES = [
230
+ _Path(_os_search.environ.get("MEOK_EURLEX_DB", "")) if _os_search.environ.get("MEOK_EURLEX_DB") else None,
231
+ _Path.home() / "clawd" / "mcp-marketplace" / "eu-ai-act-compliance-mcp" / "data" / "regulations.db",
232
+ _Path(__file__).parent / "data" / "regulations.db",
233
+ ]
234
+ _REG_DB = next((p for p in _REG_DB_CANDIDATES if p and p.exists()), None)
235
+
236
+
237
+ @mcp.tool()
238
+ def search_regulation(query: str, regulation: str = "", limit: int = 10) -> dict:
239
+ """Full-text search across 410+ articles of real EU regulation text (EUR-Lex verified).
240
+
241
+ Args:
242
+ query: Search terms. FTS5 syntax supported (AND, OR, NEAR, phrase quoting).
243
+ regulation: Optional filter - one of: eu-ai-act, dora, nis2, cra, csrd, gdpr.
244
+ limit: Max results (default 10).
245
+
246
+ Returns:
247
+ Snippets from matching articles with regulation + article + relevance score.
248
+ Verbatim from EUR-Lex Cellar — auditor-defensible quotes with `>>>match<<<` highlights.
249
+ """
250
+ if _REG_DB is None or not _REG_DB.exists():
251
+ return {
252
+ "error": "EUR-Lex database not available. Install eu-ai-act-compliance-mcp v1.4.0+ which ships the DB, OR set MEOK_EURLEX_DB env var.",
253
+ "hint": "pip install eu-ai-act-compliance-mcp",
254
+ }
255
+ if not query or len(query.strip()) < 2:
256
+ return {"error": "Query must be at least 2 characters"}
257
+
258
+ celex_map = {
259
+ "eu-ai-act": "32024R1689", "dora": "32022R2554", "nis2": "32022L2555",
260
+ "cra": "32024R2847", "csrd": "32022L2464", "gdpr": "32016R0679",
261
+ }
262
+ celex_filter = celex_map.get(regulation.lower().strip()) if regulation else None
263
+
264
+ safe_query = query.replace('"', '""').strip()
265
+ if " " in safe_query and not any(op in safe_query.upper() for op in [" AND ", " OR ", " NEAR"]):
266
+ safe_query = '"' + safe_query + '"'
267
+
268
+ conn = _sqlite3.connect(str(_REG_DB))
269
+ try:
270
+ if celex_filter:
271
+ sql = ("SELECT celex, article_number, article_id, "
272
+ "snippet(articles_fts, 3, '>>>', '<<<', '...', 64) AS snip, rank "
273
+ "FROM articles_fts WHERE articles_fts MATCH ? AND celex = ? "
274
+ "ORDER BY rank LIMIT ?")
275
+ rows = conn.execute(sql, (safe_query, celex_filter, limit)).fetchall()
276
+ else:
277
+ sql = ("SELECT celex, article_number, article_id, "
278
+ "snippet(articles_fts, 3, '>>>', '<<<', '...', 64) AS snip, rank "
279
+ "FROM articles_fts WHERE articles_fts MATCH ? "
280
+ "ORDER BY rank LIMIT ?")
281
+ rows = conn.execute(sql, (safe_query, limit)).fetchall()
282
+
283
+ name_map = {v: k for k, v in celex_map.items()}
284
+ return {
285
+ "query": query,
286
+ "regulation_filter": regulation or "all",
287
+ "result_count": len(rows),
288
+ "source": "EUR-Lex Cellar API (publications.europa.eu) - verbatim text",
289
+ "disclaimer": "Quotes are auditor-defensible. Not legal advice.",
290
+ "results": [
291
+ {"regulation": name_map.get(r[0], r[0]), "article_number": r[1],
292
+ "snippet": r[3], "relevance_score": round(abs(r[4]), 2)}
293
+ for r in rows
294
+ ],
295
+ }
296
+ except Exception as e:
297
+ return {"error": f"FTS5 search error: {e}"}
298
+ finally:
299
+ conn.close()
300
+
301
+
302
+ @mcp.tool()
303
+ def list_regulations_in_db() -> dict:
304
+ """List all regulations in the local EUR-Lex FTS5 database."""
305
+ if _REG_DB is None or not _REG_DB.exists():
306
+ return {"error": "Database not available", "regulations": []}
307
+ conn = _sqlite3.connect(str(_REG_DB))
308
+ try:
309
+ rows = conn.execute(
310
+ "SELECT celex, name, short_name, type, title, article_count, last_synced "
311
+ "FROM regulations ORDER BY celex"
312
+ ).fetchall()
313
+ return {
314
+ "source": "EUR-Lex Cellar API",
315
+ "total_regulations": len(rows),
316
+ "total_articles": conn.execute("SELECT COUNT(*) FROM articles").fetchone()[0],
317
+ "regulations": [
318
+ {"celex": r[0], "name": r[1], "short_name": r[2], "type": r[3],
319
+ "title": (r[4] or "")[:120], "article_count": r[5],
320
+ "last_synced": r[6]}
321
+ for r in rows
322
+ ],
323
+ }
324
+ finally:
325
+ conn.close()
326
+
327
+
328
+ def main():
329
+ mcp.run()
330
+
331
+
332
+ if __name__ == "__main__":
333
+ main()