mcp-server-akf 1.5.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.
- mcp_server_akf-1.5.0/PKG-INFO +116 -0
- mcp_server_akf-1.5.0/README.md +96 -0
- mcp_server_akf-1.5.0/mcp_server_akf/__init__.py +13 -0
- mcp_server_akf-1.5.0/mcp_server_akf/__main__.py +6 -0
- mcp_server_akf-1.5.0/mcp_server_akf/server.py +354 -0
- mcp_server_akf-1.5.0/mcp_server_akf.egg-info/PKG-INFO +116 -0
- mcp_server_akf-1.5.0/mcp_server_akf.egg-info/SOURCES.txt +11 -0
- mcp_server_akf-1.5.0/mcp_server_akf.egg-info/dependency_links.txt +1 -0
- mcp_server_akf-1.5.0/mcp_server_akf.egg-info/entry_points.txt +2 -0
- mcp_server_akf-1.5.0/mcp_server_akf.egg-info/requires.txt +5 -0
- mcp_server_akf-1.5.0/mcp_server_akf.egg-info/top_level.txt +1 -0
- mcp_server_akf-1.5.0/pyproject.toml +36 -0
- mcp_server_akf-1.5.0/setup.cfg +4 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-server-akf
|
|
3
|
+
Version: 1.5.0
|
|
4
|
+
Summary: MCP server for AKF — check, stamp, and audit trust metadata on any file
|
|
5
|
+
Author: AKF Project
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://akf.dev
|
|
8
|
+
Project-URL: Repository, https://github.com/HMAKT99/AKF
|
|
9
|
+
Project-URL: Documentation, https://github.com/HMAKT99/AKF/tree/main/packages/mcp-server-akf
|
|
10
|
+
Keywords: mcp,model-context-protocol,akf,trust,provenance,ai-agents
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: akf>=1.5.0
|
|
17
|
+
Requires-Dist: mcp>=1.0.0
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
20
|
+
|
|
21
|
+
# mcp-server-akf
|
|
22
|
+
|
|
23
|
+
mcp-name: io.github.HMAKT99/akf
|
|
24
|
+
|
|
25
|
+
MCP (Model Context Protocol) server that exposes 10 AKF tools to AI agents.
|
|
26
|
+
Any MCP-compatible client (Claude Desktop, Claude Code, Cursor, Windsurf, etc.)
|
|
27
|
+
can check, stamp, validate, audit, and scan files using the Agent Knowledge Format.
|
|
28
|
+
|
|
29
|
+
**A stamp costs ~15 tokens. Re-verifying costs 15,000.** Agents stamp what they
|
|
30
|
+
verify; the next agent calls `check_file` and builds on it instead of redoing
|
|
31
|
+
the work.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install mcp-server-akf
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
### Claude Desktop
|
|
42
|
+
|
|
43
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"akf": {
|
|
49
|
+
"command": "python",
|
|
50
|
+
"args": ["-m", "mcp_server_akf"]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Cursor
|
|
57
|
+
|
|
58
|
+
Add to `.cursor/mcp.json` in your project root:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"mcpServers": {
|
|
63
|
+
"akf": {
|
|
64
|
+
"command": "python",
|
|
65
|
+
"args": ["-m", "mcp_server_akf"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Tools
|
|
72
|
+
|
|
73
|
+
| Tool | Description |
|
|
74
|
+
|------|-------------|
|
|
75
|
+
| `check_file` | One-line trust check — can an agent build on this file without re-verifying? (OK / LOW / STALE / UNSTAMPED) |
|
|
76
|
+
| `create_claim` | Create an AKF claim with trust metadata |
|
|
77
|
+
| `validate_file` | Validate an `.akf` file against the spec |
|
|
78
|
+
| `scan_file` | Security scan any file for AKF metadata |
|
|
79
|
+
| `trust_score` | Compute effective trust score for a claim |
|
|
80
|
+
| `stamp_file` | Stamp trust metadata onto any file (20+ formats) |
|
|
81
|
+
| `audit_file` | Compliance audit (EU AI Act, SOX, HIPAA, GDPR, NIST, ISO 42001) |
|
|
82
|
+
| `embed_file` | Embed AKF metadata into DOCX, PDF, HTML, images, etc. |
|
|
83
|
+
| `extract_file` | Extract AKF metadata from any supported format |
|
|
84
|
+
| `detect_threats` | Run 10 AI-specific security detections |
|
|
85
|
+
|
|
86
|
+
## Quick usage
|
|
87
|
+
|
|
88
|
+
Once configured, ask your AI agent:
|
|
89
|
+
|
|
90
|
+
> "Stamp `report.docx` with AKF trust metadata, confidence 0.9, evidence 'quarterly review complete'"
|
|
91
|
+
|
|
92
|
+
The agent will call `stamp_file` through MCP and attach provenance automatically.
|
|
93
|
+
|
|
94
|
+
You can also run the server directly for testing:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
python -m mcp_server_akf
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Multi-Agent Support
|
|
101
|
+
|
|
102
|
+
The MCP server works seamlessly with multi-agent orchestration platforms:
|
|
103
|
+
|
|
104
|
+
- **Agent Identity**: Create and verify agent cards via `akf agent create` / `akf agent verify`
|
|
105
|
+
- **A2A Protocol**: Export/import agent cards for cross-platform discovery via `akf agent export-a2a`
|
|
106
|
+
- **Team Certification**: Use `akf certify --team` for per-agent trust breakdowns in CI
|
|
107
|
+
- **Delegation**: Trust ceilings cap delegate output when agents hand off work
|
|
108
|
+
- **Team Streaming**: Multi-agent sessions with per-agent claim attribution
|
|
109
|
+
|
|
110
|
+
Supports: Claude Agent Teams, Copilot Cowork, Codex multi-agent, and any A2A-compatible platform.
|
|
111
|
+
|
|
112
|
+
## Requirements
|
|
113
|
+
|
|
114
|
+
- Python >= 3.10
|
|
115
|
+
- `akf >= 1.0.0`
|
|
116
|
+
- `mcp >= 1.0.0`
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# mcp-server-akf
|
|
2
|
+
|
|
3
|
+
mcp-name: io.github.HMAKT99/akf
|
|
4
|
+
|
|
5
|
+
MCP (Model Context Protocol) server that exposes 10 AKF tools to AI agents.
|
|
6
|
+
Any MCP-compatible client (Claude Desktop, Claude Code, Cursor, Windsurf, etc.)
|
|
7
|
+
can check, stamp, validate, audit, and scan files using the Agent Knowledge Format.
|
|
8
|
+
|
|
9
|
+
**A stamp costs ~15 tokens. Re-verifying costs 15,000.** Agents stamp what they
|
|
10
|
+
verify; the next agent calls `check_file` and builds on it instead of redoing
|
|
11
|
+
the work.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install mcp-server-akf
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Configuration
|
|
20
|
+
|
|
21
|
+
### Claude Desktop
|
|
22
|
+
|
|
23
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"akf": {
|
|
29
|
+
"command": "python",
|
|
30
|
+
"args": ["-m", "mcp_server_akf"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Cursor
|
|
37
|
+
|
|
38
|
+
Add to `.cursor/mcp.json` in your project root:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"mcpServers": {
|
|
43
|
+
"akf": {
|
|
44
|
+
"command": "python",
|
|
45
|
+
"args": ["-m", "mcp_server_akf"]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Tools
|
|
52
|
+
|
|
53
|
+
| Tool | Description |
|
|
54
|
+
|------|-------------|
|
|
55
|
+
| `check_file` | One-line trust check — can an agent build on this file without re-verifying? (OK / LOW / STALE / UNSTAMPED) |
|
|
56
|
+
| `create_claim` | Create an AKF claim with trust metadata |
|
|
57
|
+
| `validate_file` | Validate an `.akf` file against the spec |
|
|
58
|
+
| `scan_file` | Security scan any file for AKF metadata |
|
|
59
|
+
| `trust_score` | Compute effective trust score for a claim |
|
|
60
|
+
| `stamp_file` | Stamp trust metadata onto any file (20+ formats) |
|
|
61
|
+
| `audit_file` | Compliance audit (EU AI Act, SOX, HIPAA, GDPR, NIST, ISO 42001) |
|
|
62
|
+
| `embed_file` | Embed AKF metadata into DOCX, PDF, HTML, images, etc. |
|
|
63
|
+
| `extract_file` | Extract AKF metadata from any supported format |
|
|
64
|
+
| `detect_threats` | Run 10 AI-specific security detections |
|
|
65
|
+
|
|
66
|
+
## Quick usage
|
|
67
|
+
|
|
68
|
+
Once configured, ask your AI agent:
|
|
69
|
+
|
|
70
|
+
> "Stamp `report.docx` with AKF trust metadata, confidence 0.9, evidence 'quarterly review complete'"
|
|
71
|
+
|
|
72
|
+
The agent will call `stamp_file` through MCP and attach provenance automatically.
|
|
73
|
+
|
|
74
|
+
You can also run the server directly for testing:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
python -m mcp_server_akf
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Multi-Agent Support
|
|
81
|
+
|
|
82
|
+
The MCP server works seamlessly with multi-agent orchestration platforms:
|
|
83
|
+
|
|
84
|
+
- **Agent Identity**: Create and verify agent cards via `akf agent create` / `akf agent verify`
|
|
85
|
+
- **A2A Protocol**: Export/import agent cards for cross-platform discovery via `akf agent export-a2a`
|
|
86
|
+
- **Team Certification**: Use `akf certify --team` for per-agent trust breakdowns in CI
|
|
87
|
+
- **Delegation**: Trust ceilings cap delegate output when agents hand off work
|
|
88
|
+
- **Team Streaming**: Multi-agent sessions with per-agent claim attribution
|
|
89
|
+
|
|
90
|
+
Supports: Claude Agent Teams, Copilot Cowork, Codex multi-agent, and any A2A-compatible platform.
|
|
91
|
+
|
|
92
|
+
## Requirements
|
|
93
|
+
|
|
94
|
+
- Python >= 3.10
|
|
95
|
+
- `akf >= 1.0.0`
|
|
96
|
+
- `mcp >= 1.0.0`
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""MCP Server for AKF — Agent Knowledge Format.
|
|
2
|
+
|
|
3
|
+
Exposes AKF trust metadata operations via Model Context Protocol (MCP).
|
|
4
|
+
Compatible with Claude Desktop, Cursor, and any MCP-compatible client.
|
|
5
|
+
|
|
6
|
+
Tools:
|
|
7
|
+
create_claim — Create an AKF claim with trust metadata
|
|
8
|
+
validate_file — Validate an .akf file against the spec
|
|
9
|
+
scan_file — Security scan any file for AKF metadata
|
|
10
|
+
trust_score — Compute effective trust score for a claim
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
"""MCP server implementation for AKF — Agent Knowledge Format.
|
|
2
|
+
|
|
3
|
+
Exposes 10 tools via Model Context Protocol:
|
|
4
|
+
- check_file: One-line trust check — can an agent build on this file?
|
|
5
|
+
- create_claim: Create AKF trust metadata
|
|
6
|
+
- validate_file: Validate an .akf file
|
|
7
|
+
- scan_file: Security scan any file
|
|
8
|
+
- trust_score: Compute effective trust score
|
|
9
|
+
- stamp_file: Stamp trust metadata onto any file
|
|
10
|
+
- audit_file: Run compliance audit
|
|
11
|
+
- embed_file: Embed AKF metadata into any format
|
|
12
|
+
- extract_file: Extract AKF metadata from any format
|
|
13
|
+
- detect_threats: Run security detections
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
import asyncio
|
|
19
|
+
import json
|
|
20
|
+
import sys
|
|
21
|
+
|
|
22
|
+
import akf
|
|
23
|
+
from mcp.server import Server
|
|
24
|
+
from mcp.server.stdio import stdio_server
|
|
25
|
+
from mcp.types import Tool, TextContent
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# ---------------------------------------------------------------------------
|
|
29
|
+
# Tool implementations
|
|
30
|
+
# ---------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
def check_file(path: str, threshold: float = 0.6) -> dict:
|
|
33
|
+
"""One-line trust check: can an agent build on this file without re-verifying?"""
|
|
34
|
+
from akf.check import check_file as _check
|
|
35
|
+
|
|
36
|
+
result = _check(path, threshold=threshold)
|
|
37
|
+
payload = result.to_dict()
|
|
38
|
+
payload["summary"] = result.summary_line()
|
|
39
|
+
return payload
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def create_claim(content: str, confidence: float, source: str | None = None, ai_generated: bool = True) -> dict:
|
|
43
|
+
"""Create an AKF claim and return as JSON."""
|
|
44
|
+
unit = akf.create(
|
|
45
|
+
content,
|
|
46
|
+
confidence=confidence,
|
|
47
|
+
source=source or "mcp-tool",
|
|
48
|
+
ai_generated=ai_generated,
|
|
49
|
+
)
|
|
50
|
+
return unit.to_dict()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def validate_file(path: str) -> dict:
|
|
54
|
+
"""Validate an .akf file."""
|
|
55
|
+
result = akf.validate(path)
|
|
56
|
+
return {
|
|
57
|
+
"valid": result.valid,
|
|
58
|
+
"level": result.level,
|
|
59
|
+
"errors": result.errors,
|
|
60
|
+
"warnings": result.warnings,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def scan_file(path: str) -> dict:
|
|
65
|
+
"""Security scan any file for AKF metadata."""
|
|
66
|
+
from akf import universal
|
|
67
|
+
report = universal.scan(path)
|
|
68
|
+
return {
|
|
69
|
+
"enriched": report.enriched,
|
|
70
|
+
"format": report.format,
|
|
71
|
+
"claim_count": report.claim_count,
|
|
72
|
+
"classification": report.classification,
|
|
73
|
+
"overall_trust": report.overall_trust,
|
|
74
|
+
"ai_contribution": report.ai_contribution,
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def trust_score(content: str, confidence: float, authority_tier: int = 3) -> dict:
|
|
79
|
+
"""Compute effective trust score for a claim."""
|
|
80
|
+
from akf.models import Claim
|
|
81
|
+
from akf.trust import effective_trust
|
|
82
|
+
|
|
83
|
+
claim = Claim(content=content, confidence=confidence, authority_tier=authority_tier)
|
|
84
|
+
result = effective_trust(claim)
|
|
85
|
+
return {
|
|
86
|
+
"score": result.score,
|
|
87
|
+
"decision": result.decision,
|
|
88
|
+
"breakdown": result.breakdown,
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def stamp_file(path: str, agent: str = "mcp-agent", classification: str = "internal",
|
|
93
|
+
confidence: float = 0.85, evidence: str | None = None) -> dict:
|
|
94
|
+
"""Stamp trust metadata onto any file."""
|
|
95
|
+
from akf.stamp import stamp_file as _stamp
|
|
96
|
+
|
|
97
|
+
evidence_list = [e.strip() for e in evidence.split(",")] if evidence else []
|
|
98
|
+
result = _stamp(
|
|
99
|
+
path,
|
|
100
|
+
agent=agent,
|
|
101
|
+
classification=classification,
|
|
102
|
+
trust_score=confidence,
|
|
103
|
+
evidence=evidence_list,
|
|
104
|
+
)
|
|
105
|
+
return {"stamped": True, "path": str(path), "agent": agent, "classification": classification}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def audit_file(path: str, regulation: str | None = None) -> dict:
|
|
109
|
+
"""Run compliance audit on an AKF file."""
|
|
110
|
+
result = akf.audit(path, regulation=regulation)
|
|
111
|
+
return {
|
|
112
|
+
"compliant": result.compliant,
|
|
113
|
+
"regulation": regulation or "general",
|
|
114
|
+
"score": getattr(result, "score", None),
|
|
115
|
+
"findings": [str(f) for f in getattr(result, "findings", [])],
|
|
116
|
+
"recommendations": getattr(result, "recommendations", []),
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def embed_file(path: str, content: str, confidence: float = 0.85,
|
|
121
|
+
source: str | None = None, classification: str = "internal") -> dict:
|
|
122
|
+
"""Embed AKF metadata into any supported file format."""
|
|
123
|
+
from akf import universal
|
|
124
|
+
|
|
125
|
+
claim_dict = {"c": content, "t": confidence}
|
|
126
|
+
if source:
|
|
127
|
+
claim_dict["src"] = source
|
|
128
|
+
universal.embed(path, claims=[claim_dict], classification=classification)
|
|
129
|
+
return {"embedded": True, "path": str(path), "format": path.rsplit(".", 1)[-1]}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def extract_file(path: str) -> dict:
|
|
133
|
+
"""Extract AKF metadata from any supported file format."""
|
|
134
|
+
from akf import universal
|
|
135
|
+
|
|
136
|
+
meta = universal.extract(path)
|
|
137
|
+
if meta is None:
|
|
138
|
+
return {"found": False, "path": str(path)}
|
|
139
|
+
return {"found": True, "path": str(path), "metadata": meta}
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def detect_threats(path: str) -> dict:
|
|
143
|
+
"""Run security detections on an AKF file."""
|
|
144
|
+
unit = akf.load(path)
|
|
145
|
+
from akf.detection import run_all_detections
|
|
146
|
+
report = run_all_detections(unit)
|
|
147
|
+
return {
|
|
148
|
+
"path": str(path),
|
|
149
|
+
"triggered_count": report.triggered_count,
|
|
150
|
+
"critical_count": report.critical_count,
|
|
151
|
+
"high_count": report.high_count,
|
|
152
|
+
"clean": report.clean,
|
|
153
|
+
"results": [
|
|
154
|
+
{
|
|
155
|
+
"detection": r.detection_class,
|
|
156
|
+
"triggered": r.triggered,
|
|
157
|
+
"severity": r.severity,
|
|
158
|
+
"findings": r.findings,
|
|
159
|
+
"recommendation": r.recommendation,
|
|
160
|
+
}
|
|
161
|
+
for r in report.results
|
|
162
|
+
if r.triggered
|
|
163
|
+
],
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
# ---------------------------------------------------------------------------
|
|
168
|
+
# MCP tool definitions
|
|
169
|
+
# ---------------------------------------------------------------------------
|
|
170
|
+
|
|
171
|
+
TOOLS = [
|
|
172
|
+
Tool(
|
|
173
|
+
name="check_file",
|
|
174
|
+
description="One-line trust check before building on a file. Returns OK (fresh stamp, trust above threshold — skip re-verification), LOW (trust below threshold), STALE (modified after stamping or claims expired — re-verify), or UNSTAMPED (no metadata). Use this before re-reading, re-testing, or re-deriving work another agent already verified.",
|
|
175
|
+
inputSchema={
|
|
176
|
+
"type": "object",
|
|
177
|
+
"required": ["path"],
|
|
178
|
+
"properties": {
|
|
179
|
+
"path": {"type": "string", "description": "Path to the file to check"},
|
|
180
|
+
"threshold": {"type": "number", "minimum": 0, "maximum": 1, "default": 0.6, "description": "Trust threshold for OK vs LOW"},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
),
|
|
184
|
+
Tool(
|
|
185
|
+
name="create_claim",
|
|
186
|
+
description="Create an AKF claim with trust metadata. Returns a JSON object with the claim, trust score, and provenance.",
|
|
187
|
+
inputSchema={
|
|
188
|
+
"type": "object",
|
|
189
|
+
"required": ["content", "confidence"],
|
|
190
|
+
"properties": {
|
|
191
|
+
"content": {"type": "string", "description": "The factual claim to create"},
|
|
192
|
+
"confidence": {"type": "number", "minimum": 0, "maximum": 1, "description": "Trust score 0.0-1.0"},
|
|
193
|
+
"source": {"type": "string", "description": "Information source (e.g., 'SEC 10-Q')"},
|
|
194
|
+
"ai_generated": {"type": "boolean", "default": True, "description": "Whether this claim is AI-generated"},
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
),
|
|
198
|
+
Tool(
|
|
199
|
+
name="validate_file",
|
|
200
|
+
description="Validate an .akf file against the AKF specification. Returns validity status, validation level (0-3), errors, and warnings.",
|
|
201
|
+
inputSchema={
|
|
202
|
+
"type": "object",
|
|
203
|
+
"required": ["path"],
|
|
204
|
+
"properties": {
|
|
205
|
+
"path": {"type": "string", "description": "Path to the .akf file to validate"},
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
),
|
|
209
|
+
Tool(
|
|
210
|
+
name="scan_file",
|
|
211
|
+
description="Security scan any file for AKF trust metadata. Works with .akf, .docx, .pdf, .html, .md, .json, images, and any format with a sidecar.",
|
|
212
|
+
inputSchema={
|
|
213
|
+
"type": "object",
|
|
214
|
+
"required": ["path"],
|
|
215
|
+
"properties": {
|
|
216
|
+
"path": {"type": "string", "description": "Path to the file to scan"},
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
),
|
|
220
|
+
Tool(
|
|
221
|
+
name="trust_score",
|
|
222
|
+
description="Compute the effective trust score for a claim using AKF's trust computation engine. Factors in confidence, authority tier, and temporal decay.",
|
|
223
|
+
inputSchema={
|
|
224
|
+
"type": "object",
|
|
225
|
+
"required": ["content", "confidence"],
|
|
226
|
+
"properties": {
|
|
227
|
+
"content": {"type": "string", "description": "The claim to score"},
|
|
228
|
+
"confidence": {"type": "number", "minimum": 0, "maximum": 1, "description": "Base confidence score"},
|
|
229
|
+
"authority_tier": {"type": "integer", "minimum": 1, "maximum": 5, "default": 3, "description": "Authority tier 1-5 (1=official records, 5=AI inference)"},
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
),
|
|
233
|
+
Tool(
|
|
234
|
+
name="stamp_file",
|
|
235
|
+
description="Stamp AKF trust metadata onto any file. Supports DOCX, PDF, images, Markdown, code, and 20+ formats. Use this after creating or modifying files.",
|
|
236
|
+
inputSchema={
|
|
237
|
+
"type": "object",
|
|
238
|
+
"required": ["path"],
|
|
239
|
+
"properties": {
|
|
240
|
+
"path": {"type": "string", "description": "Path to the file to stamp"},
|
|
241
|
+
"agent": {"type": "string", "default": "mcp-agent", "description": "Agent identity (e.g., 'claude-code', 'copilot')"},
|
|
242
|
+
"classification": {"type": "string", "default": "internal", "description": "Security classification: public, internal, confidential, restricted"},
|
|
243
|
+
"confidence": {"type": "number", "minimum": 0, "maximum": 1, "default": 0.85, "description": "Confidence score"},
|
|
244
|
+
"evidence": {"type": "string", "description": "Comma-separated evidence (e.g., 'tests pass, docs reviewed')"},
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
),
|
|
248
|
+
Tool(
|
|
249
|
+
name="audit_file",
|
|
250
|
+
description="Run compliance audit on an AKF file against regulatory frameworks (EU AI Act, SOX, HIPAA, GDPR, NIST AI RMF, ISO 42001).",
|
|
251
|
+
inputSchema={
|
|
252
|
+
"type": "object",
|
|
253
|
+
"required": ["path"],
|
|
254
|
+
"properties": {
|
|
255
|
+
"path": {"type": "string", "description": "Path to the .akf file to audit"},
|
|
256
|
+
"regulation": {"type": "string", "description": "Target regulation: eu_ai_act, sox, hipaa, gdpr, nist_ai, iso_42001"},
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
),
|
|
260
|
+
Tool(
|
|
261
|
+
name="embed_file",
|
|
262
|
+
description="Embed AKF trust metadata into any supported file format (DOCX, PDF, HTML, images, Markdown, etc.).",
|
|
263
|
+
inputSchema={
|
|
264
|
+
"type": "object",
|
|
265
|
+
"required": ["path", "content"],
|
|
266
|
+
"properties": {
|
|
267
|
+
"path": {"type": "string", "description": "Path to the file to embed metadata into"},
|
|
268
|
+
"content": {"type": "string", "description": "The factual claim to embed"},
|
|
269
|
+
"confidence": {"type": "number", "minimum": 0, "maximum": 1, "default": 0.85, "description": "Confidence score"},
|
|
270
|
+
"source": {"type": "string", "description": "Information source"},
|
|
271
|
+
"classification": {"type": "string", "default": "internal", "description": "Security classification"},
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
),
|
|
275
|
+
Tool(
|
|
276
|
+
name="extract_file",
|
|
277
|
+
description="Extract AKF trust metadata from any supported file format. Returns claims, classification, provenance, and trust scores.",
|
|
278
|
+
inputSchema={
|
|
279
|
+
"type": "object",
|
|
280
|
+
"required": ["path"],
|
|
281
|
+
"properties": {
|
|
282
|
+
"path": {"type": "string", "description": "Path to the file to extract metadata from"},
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
),
|
|
286
|
+
Tool(
|
|
287
|
+
name="detect_threats",
|
|
288
|
+
description="Run 10 AI-specific security detections on an AKF file: hallucination risk, knowledge laundering, classification downgrade, trust degradation, and more.",
|
|
289
|
+
inputSchema={
|
|
290
|
+
"type": "object",
|
|
291
|
+
"required": ["path"],
|
|
292
|
+
"properties": {
|
|
293
|
+
"path": {"type": "string", "description": "Path to the .akf file to analyze"},
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
),
|
|
297
|
+
]
|
|
298
|
+
|
|
299
|
+
# Map tool names to handler functions
|
|
300
|
+
HANDLERS = {
|
|
301
|
+
"check_file": check_file,
|
|
302
|
+
"create_claim": create_claim,
|
|
303
|
+
"validate_file": validate_file,
|
|
304
|
+
"scan_file": scan_file,
|
|
305
|
+
"trust_score": trust_score,
|
|
306
|
+
"stamp_file": stamp_file,
|
|
307
|
+
"audit_file": audit_file,
|
|
308
|
+
"embed_file": embed_file,
|
|
309
|
+
"extract_file": extract_file,
|
|
310
|
+
"detect_threats": detect_threats,
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
# ---------------------------------------------------------------------------
|
|
315
|
+
# MCP Server
|
|
316
|
+
# ---------------------------------------------------------------------------
|
|
317
|
+
|
|
318
|
+
def create_server() -> Server:
|
|
319
|
+
"""Create and configure the MCP server."""
|
|
320
|
+
server = Server("akf")
|
|
321
|
+
|
|
322
|
+
@server.list_tools()
|
|
323
|
+
async def list_tools() -> list[Tool]:
|
|
324
|
+
return TOOLS
|
|
325
|
+
|
|
326
|
+
@server.call_tool()
|
|
327
|
+
async def call_tool(name: str, arguments: dict) -> list[TextContent]:
|
|
328
|
+
handler = HANDLERS.get(name)
|
|
329
|
+
if not handler:
|
|
330
|
+
return [TextContent(type="text", text=json.dumps({"error": f"Unknown tool: {name}"}))]
|
|
331
|
+
|
|
332
|
+
try:
|
|
333
|
+
result = handler(**arguments)
|
|
334
|
+
return [TextContent(type="text", text=json.dumps(result, indent=2, default=str))]
|
|
335
|
+
except Exception as e:
|
|
336
|
+
return [TextContent(type="text", text=json.dumps({"error": str(e)}))]
|
|
337
|
+
|
|
338
|
+
return server
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
async def run_server():
|
|
342
|
+
"""Run the MCP server over stdio."""
|
|
343
|
+
server = create_server()
|
|
344
|
+
async with stdio_server() as (read_stream, write_stream):
|
|
345
|
+
await server.run(read_stream, write_stream, server.create_initialization_options())
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
def main():
|
|
349
|
+
"""Entry point for the MCP server."""
|
|
350
|
+
asyncio.run(run_server())
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
if __name__ == "__main__":
|
|
354
|
+
main()
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-server-akf
|
|
3
|
+
Version: 1.5.0
|
|
4
|
+
Summary: MCP server for AKF — check, stamp, and audit trust metadata on any file
|
|
5
|
+
Author: AKF Project
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://akf.dev
|
|
8
|
+
Project-URL: Repository, https://github.com/HMAKT99/AKF
|
|
9
|
+
Project-URL: Documentation, https://github.com/HMAKT99/AKF/tree/main/packages/mcp-server-akf
|
|
10
|
+
Keywords: mcp,model-context-protocol,akf,trust,provenance,ai-agents
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: akf>=1.5.0
|
|
17
|
+
Requires-Dist: mcp>=1.0.0
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
20
|
+
|
|
21
|
+
# mcp-server-akf
|
|
22
|
+
|
|
23
|
+
mcp-name: io.github.HMAKT99/akf
|
|
24
|
+
|
|
25
|
+
MCP (Model Context Protocol) server that exposes 10 AKF tools to AI agents.
|
|
26
|
+
Any MCP-compatible client (Claude Desktop, Claude Code, Cursor, Windsurf, etc.)
|
|
27
|
+
can check, stamp, validate, audit, and scan files using the Agent Knowledge Format.
|
|
28
|
+
|
|
29
|
+
**A stamp costs ~15 tokens. Re-verifying costs 15,000.** Agents stamp what they
|
|
30
|
+
verify; the next agent calls `check_file` and builds on it instead of redoing
|
|
31
|
+
the work.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install mcp-server-akf
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
### Claude Desktop
|
|
42
|
+
|
|
43
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"akf": {
|
|
49
|
+
"command": "python",
|
|
50
|
+
"args": ["-m", "mcp_server_akf"]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Cursor
|
|
57
|
+
|
|
58
|
+
Add to `.cursor/mcp.json` in your project root:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"mcpServers": {
|
|
63
|
+
"akf": {
|
|
64
|
+
"command": "python",
|
|
65
|
+
"args": ["-m", "mcp_server_akf"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Tools
|
|
72
|
+
|
|
73
|
+
| Tool | Description |
|
|
74
|
+
|------|-------------|
|
|
75
|
+
| `check_file` | One-line trust check — can an agent build on this file without re-verifying? (OK / LOW / STALE / UNSTAMPED) |
|
|
76
|
+
| `create_claim` | Create an AKF claim with trust metadata |
|
|
77
|
+
| `validate_file` | Validate an `.akf` file against the spec |
|
|
78
|
+
| `scan_file` | Security scan any file for AKF metadata |
|
|
79
|
+
| `trust_score` | Compute effective trust score for a claim |
|
|
80
|
+
| `stamp_file` | Stamp trust metadata onto any file (20+ formats) |
|
|
81
|
+
| `audit_file` | Compliance audit (EU AI Act, SOX, HIPAA, GDPR, NIST, ISO 42001) |
|
|
82
|
+
| `embed_file` | Embed AKF metadata into DOCX, PDF, HTML, images, etc. |
|
|
83
|
+
| `extract_file` | Extract AKF metadata from any supported format |
|
|
84
|
+
| `detect_threats` | Run 10 AI-specific security detections |
|
|
85
|
+
|
|
86
|
+
## Quick usage
|
|
87
|
+
|
|
88
|
+
Once configured, ask your AI agent:
|
|
89
|
+
|
|
90
|
+
> "Stamp `report.docx` with AKF trust metadata, confidence 0.9, evidence 'quarterly review complete'"
|
|
91
|
+
|
|
92
|
+
The agent will call `stamp_file` through MCP and attach provenance automatically.
|
|
93
|
+
|
|
94
|
+
You can also run the server directly for testing:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
python -m mcp_server_akf
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Multi-Agent Support
|
|
101
|
+
|
|
102
|
+
The MCP server works seamlessly with multi-agent orchestration platforms:
|
|
103
|
+
|
|
104
|
+
- **Agent Identity**: Create and verify agent cards via `akf agent create` / `akf agent verify`
|
|
105
|
+
- **A2A Protocol**: Export/import agent cards for cross-platform discovery via `akf agent export-a2a`
|
|
106
|
+
- **Team Certification**: Use `akf certify --team` for per-agent trust breakdowns in CI
|
|
107
|
+
- **Delegation**: Trust ceilings cap delegate output when agents hand off work
|
|
108
|
+
- **Team Streaming**: Multi-agent sessions with per-agent claim attribution
|
|
109
|
+
|
|
110
|
+
Supports: Claude Agent Teams, Copilot Cowork, Codex multi-agent, and any A2A-compatible platform.
|
|
111
|
+
|
|
112
|
+
## Requirements
|
|
113
|
+
|
|
114
|
+
- Python >= 3.10
|
|
115
|
+
- `akf >= 1.0.0`
|
|
116
|
+
- `mcp >= 1.0.0`
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
mcp_server_akf/__init__.py
|
|
4
|
+
mcp_server_akf/__main__.py
|
|
5
|
+
mcp_server_akf/server.py
|
|
6
|
+
mcp_server_akf.egg-info/PKG-INFO
|
|
7
|
+
mcp_server_akf.egg-info/SOURCES.txt
|
|
8
|
+
mcp_server_akf.egg-info/dependency_links.txt
|
|
9
|
+
mcp_server_akf.egg-info/entry_points.txt
|
|
10
|
+
mcp_server_akf.egg-info/requires.txt
|
|
11
|
+
mcp_server_akf.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mcp_server_akf
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mcp-server-akf"
|
|
7
|
+
version = "1.5.0"
|
|
8
|
+
description = "MCP server for AKF — check, stamp, and audit trust metadata on any file"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
authors = [{ name = "AKF Project" }]
|
|
12
|
+
keywords = ["mcp", "model-context-protocol", "akf", "trust", "provenance", "ai-agents"]
|
|
13
|
+
requires-python = ">=3.10"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Topic :: Software Development :: Libraries",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"akf>=1.5.0",
|
|
21
|
+
"mcp>=1.0.0",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Homepage = "https://akf.dev"
|
|
26
|
+
Repository = "https://github.com/HMAKT99/AKF"
|
|
27
|
+
Documentation = "https://github.com/HMAKT99/AKF/tree/main/packages/mcp-server-akf"
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
mcp-server-akf = "mcp_server_akf.server:main"
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
dev = ["pytest>=7.0"]
|
|
34
|
+
|
|
35
|
+
[tool.setuptools]
|
|
36
|
+
packages = ["mcp_server_akf"]
|