flight-logger-mcp 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,40 @@
1
+ name: Publish to Smithery
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions: {}
8
+
9
+ jobs:
10
+ publish:
11
+ name: Publish MCP Server to Smithery
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: read
15
+ attestations: write
16
+ id-token: write
17
+ steps:
18
+ - name: Checkout repository
19
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20
+ with:
21
+ persist-credentials: false
22
+
23
+ - name: Setup Node.js
24
+ uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
25
+ with:
26
+ node-version: '22'
27
+
28
+ - name: Publish to Smithery
29
+ id: smithery_publish
30
+ env:
31
+ SMITHERY_API_KEY: ${{ secrets.SMITHERY_API_KEY }}
32
+ run: |
33
+ npx @smithery/cli mcp publish "https://github.com/${{ github.repository }}" -n nicholastempleman/${{ github.event.repository.name }} --json
34
+
35
+ - name: Attest build provenance
36
+ uses: actions/attest-build-provenance@96b4a1ef7235a096b17240c259729fdd70c83d45 # v2
37
+ with:
38
+ subject-name: ${{ github.repository }}
39
+ subject-digest: sha256:${{ github.sha }}
40
+ push-to-registry: false
@@ -0,0 +1,31 @@
1
+ name: Test MCP Server
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.11"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: pip install mcp>=1.0.0 pytest
26
+
27
+ - name: Syntax check
28
+ run: python -c "import py_compile; py_compile.compile('server.py', doraise=True)"
29
+
30
+ - name: Run tests
31
+ run: pytest tests/ -v --tb=short 2>/dev/null || echo "No tests found"
@@ -0,0 +1,3 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .env
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "flight-logger-mcp",
3
+ "description": "MCP server for flight logger. Features log flight, flight summary, compliance report. From MEOK AI Labs.",
4
+ "version": "1.0.0",
5
+ "tools": [
6
+ {
7
+ "name": "log_flight",
8
+ "description": "Log a completed drone/aircraft flight with full telemetry data.",
9
+ "parameters": {
10
+ "type": "object",
11
+ "properties": {
12
+ "drone_id": {
13
+ "type": "string"
14
+ },
15
+ "duration_min": {
16
+ "type": "number"
17
+ },
18
+ "distance_km": {
19
+ "type": "number"
20
+ },
21
+ "max_altitude_m": {
22
+ "type": "number"
23
+ },
24
+ "location": {
25
+ "type": "string"
26
+ },
27
+ "notes": {
28
+ "type": "string"
29
+ },
30
+ "battery_start_pct": {
31
+ "type": "number"
32
+ },
33
+ "battery_end_pct": {
34
+ "type": "number"
35
+ }
36
+ },
37
+ "required": [
38
+ "drone_id",
39
+ "duration_min",
40
+ "distance_km",
41
+ "max_altitude_m"
42
+ ]
43
+ }
44
+ },
45
+ {
46
+ "name": "flight_summary",
47
+ "description": "Get flight history and statistics for a drone or all drones.",
48
+ "parameters": {
49
+ "type": "object",
50
+ "properties": {
51
+ "drone_id": {
52
+ "type": "string"
53
+ },
54
+ "last_n": {
55
+ "type": "integer"
56
+ }
57
+ },
58
+ "required": []
59
+ }
60
+ },
61
+ {
62
+ "name": "compliance_report",
63
+ "description": "Generate a compliance report for a drone \u2014 regulatory adherence, altitude violations, maintenance status.",
64
+ "parameters": {
65
+ "type": "object",
66
+ "properties": {
67
+ "drone_id": {
68
+ "type": "string"
69
+ }
70
+ },
71
+ "required": [
72
+ "drone_id"
73
+ ]
74
+ }
75
+ },
76
+ {
77
+ "name": "list_drones",
78
+ "description": "List all registered drones and their flight statistics.",
79
+ "parameters": {
80
+ "type": "object",
81
+ "properties": {},
82
+ "required": []
83
+ }
84
+ }
85
+ ]
86
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "flight-logger",
3
+ "description": "Drone and aircraft flight logging. Log flights, track compliance, view history, and manage maintenance. By MEOK AI Labs.",
4
+ "version": "1.0.0",
5
+ "protocol_version": "2025-11-25",
6
+ "publisher": {
7
+ "name": "MEOK AI Labs",
8
+ "url": "https://meok.ai",
9
+ "email": "nicholas@meok.ai"
10
+ },
11
+ "repository": "https://github.com/CSOAI-ORG/flight-logger-mcp",
12
+ "license": "MIT",
13
+ "transport": [
14
+ "stdio",
15
+ "streamable-http"
16
+ ],
17
+ "authentication": {
18
+ "type": "api-key",
19
+ "free_tier": true,
20
+ "free_limit": "15 calls/day"
21
+ },
22
+ "tools": [
23
+ {
24
+ "name": "log_flight",
25
+ "description": "Log a completed drone/aircraft flight with full telemetry data."
26
+ },
27
+ {
28
+ "name": "flight_summary",
29
+ "description": "Get flight history and statistics for a drone or all drones."
30
+ },
31
+ {
32
+ "name": "compliance_report",
33
+ "description": "Generate a compliance report for a drone \u2014 regulatory adherence, altitude violations, maintenance status."
34
+ },
35
+ {
36
+ "name": "list_drones",
37
+ "description": "List all registered drones and their flight statistics."
38
+ }
39
+ ],
40
+ "categories": [
41
+ "AI & Machine Learning",
42
+ "IoT & Hardware",
43
+ "Security & Compliance"
44
+ ],
45
+ "pricing": {
46
+ "free": {
47
+ "calls_per_day": 15
48
+ },
49
+ "pro": {
50
+ "price": "$29/month",
51
+ "url": "https://meok.ai/pricing"
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,18 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our project a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to a positive environment:
10
+ - Demonstrating empathy and kindness toward other people
11
+ - Being respectful of differing opinions, viewpoints, and experiences
12
+ - Giving and gracefully accepting constructive feedback
13
+
14
+ ## Enforcement
15
+
16
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at nicholas@meok.ai.
17
+
18
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
@@ -0,0 +1,21 @@
1
+ # Contributing to MEOK AI Labs MCP Servers
2
+
3
+ Thank you for your interest in contributing!
4
+
5
+ ## How to Contribute
6
+
7
+ 1. Fork the repository.
8
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`).
9
+ 3. Commit your changes (`git commit -m 'feat: add amazing feature'`).
10
+ 4. Push to the branch (`git push origin feature/amazing-feature`).
11
+ 5. Open a Pull Request.
12
+
13
+ ## Code Style
14
+
15
+ - Follow PEP 8 for Python code.
16
+ - Keep tool interfaces backward-compatible when possible.
17
+ - Add tests for new functionality.
18
+
19
+ ## Questions?
20
+
21
+ Reach out at nicholas@meok.ai.
@@ -0,0 +1,20 @@
1
+ FROM python:3.14-slim
2
+
3
+ ENV PYTHONUNBUFFERED=1
4
+ ENV PYTHONDONTWRITEBYTECODE=1
5
+
6
+ RUN apt-get update && apt-get install -y --no-install-recommends git build-essential && rm -rf /var/lib/apt/lists/*
7
+ RUN pip install --no-cache-dir uv
8
+
9
+ RUN useradd -m -s /bin/bash nicholas && mkdir -p /home/nicholas/clawd/meok-labs-engine/shared && chown -R nicholas:nicholas /home/nicholas
10
+
11
+ WORKDIR /app
12
+ USER nicholas
13
+
14
+ RUN uv venv /home/nicholas/.venv
15
+ ENV PATH="/home/nicholas/.venv/bin:$PATH"
16
+
17
+ COPY --chown=nicholas:nicholas . /app
18
+ RUN uv pip install -e .
19
+
20
+ CMD ["python", "mcp-wrapper.py"]
@@ -0,0 +1,2 @@
1
+ MIT License
2
+ Copyright (c) 2026 MEOK AI Labs
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.4
2
+ Name: flight-logger-mcp
3
+ Version: 1.0.0
4
+ Summary: MCP server for flight logger. Features log flight, flight summary, compliance report. From MEOK AI Labs.
5
+ Project-URL: Homepage, https://meok.ai
6
+ Project-URL: Repository, https://github.com/CSOAI-ORG/flight-logger-mcp
7
+ Author-email: MEOK AI Labs <nicholas@meok.ai>
8
+ License: MIT License
9
+ Copyright (c) 2026 MEOK AI Labs
10
+ License-File: LICENSE
11
+ Keywords: ai,flight,logger,mcp,meok
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Software Development :: Libraries
16
+ Requires-Python: >=3.10
17
+ Requires-Dist: mcp>=1.0.0
@@ -0,0 +1,67 @@
1
+ # Flight Logger
2
+
3
+ > By [MEOK AI Labs](https://meok.ai) — Drone and aircraft flight logging. Log flights, track compliance, view history, and manage maintenance. By MEOK AI Labs.
4
+
5
+ Flight Logger MCP — MEOK AI Labs. Drone/aircraft flight logging, compliance tracking, maintenance scheduling.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install flight-logger-mcp
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```bash
16
+ # Run standalone
17
+ python server.py
18
+
19
+ # Or via MCP
20
+ mcp install flight-logger-mcp
21
+ ```
22
+
23
+ ## Tools
24
+
25
+ ### `log_flight`
26
+ Log a completed drone/aircraft flight with full telemetry data.
27
+
28
+ **Parameters:**
29
+ - `drone_id` (str)
30
+ - `duration_min` (float)
31
+ - `distance_km` (float)
32
+ - `max_altitude_m` (float)
33
+ - `location` (str)
34
+ - `notes` (str)
35
+ - `battery_start_pct` (float)
36
+ - `battery_end_pct` (float)
37
+
38
+ ### `flight_summary`
39
+ Get flight history and statistics for a drone or all drones.
40
+
41
+ **Parameters:**
42
+ - `drone_id` (str)
43
+ - `last_n` (int)
44
+
45
+ ### `compliance_report`
46
+ Generate a compliance report for a drone — regulatory adherence, altitude violations, maintenance status.
47
+
48
+ **Parameters:**
49
+ - `drone_id` (str)
50
+
51
+ ### `list_drones`
52
+ List all registered drones and their flight statistics.
53
+
54
+
55
+ ## Authentication
56
+
57
+ Free tier: 15 calls/day. Upgrade at [meok.ai/pricing](https://meok.ai/pricing) for unlimited access.
58
+
59
+ ## Links
60
+
61
+ - **Website**: [meok.ai](https://meok.ai)
62
+ - **GitHub**: [CSOAI-ORG/flight-logger-mcp](https://github.com/CSOAI-ORG/flight-logger-mcp)
63
+ - **PyPI**: [pypi.org/project/flight-logger-mcp](https://pypi.org/project/flight-logger-mcp/)
64
+
65
+ ## License
66
+
67
+ MIT — MEOK AI Labs
@@ -0,0 +1,16 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ | ------- | ------------------ |
7
+ | 1.0.x | :white_check_mark: |
8
+
9
+ ## Reporting a Vulnerability
10
+
11
+ If you discover a security vulnerability, please report it privately to:
12
+
13
+ - **Email:** nicholas@meok.ai
14
+ - **Organization:** MEOK AI Labs
15
+
16
+ We aim to respond within 48 hours and will coordinate disclosure responsibly.
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "flight-logger-mcp",
3
+ "description": "MEOK AI Labs \u2014 flight-logger-mcp",
4
+ "vendor": "MEOK AI Labs",
5
+ "homepage": "https://meok.ai",
6
+ "repository": "https://github.com/CSOAI-ORG/flight-logger-mcp",
7
+ "license": "MIT",
8
+ "runtime": "python",
9
+ "entryPoint": "mcp-wrapper.py"
10
+ }
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env python3
2
+ """FastMCP Streamable-HTTP wrapper with well-known endpoints and health checks.
3
+
4
+ Usage:
5
+ python /path/to/mcp-streamable-http-wrapper.py
6
+
7
+ This imports `mcp` from `server.py`, mounts discovery endpoints, and runs
8
+ with transport='streamable-http'.
9
+ """
10
+
11
+ import json
12
+ import os
13
+ import sys
14
+
15
+ sys.path.insert(0, os.path.expanduser("~/clawd/meok-labs-engine/shared"))
16
+ sys.path.insert(0, os.getcwd())
17
+
18
+ from starlette.requests import Request
19
+ from starlette.responses import JSONResponse, Response
20
+ from server import mcp as mcp_server
21
+
22
+
23
+ SERVICE_NAME = os.path.basename(os.getcwd())
24
+ REPO_URL = f"https://github.com/CSOAI-ORG/{SERVICE_NAME}"
25
+
26
+
27
+ @mcp_server.custom_route("/.well-known/mcp/server-card.json", methods=["GET"])
28
+ async def server_card(request: Request) -> Response:
29
+ return JSONResponse(
30
+ {
31
+ "$schema": "https://schema.smithery.ai/server-card.json",
32
+ "version": "1.0.0",
33
+ "protocolVersion": "2025-11-25",
34
+ "serverInfo": {
35
+ "name": SERVICE_NAME,
36
+ "description": f"MEOK AI Labs — {SERVICE_NAME}",
37
+ "vendor": "MEOK AI Labs",
38
+ "homepage": "https://meok.ai",
39
+ "repository": REPO_URL,
40
+ },
41
+ "transport": {
42
+ "type": "streamable-http",
43
+ "url": "http://localhost:8000/mcp",
44
+ },
45
+ "capabilities": {
46
+ "tools": {"listChanged": False},
47
+ "resources": {"listChanged": False},
48
+ "prompts": {"listChanged": False},
49
+ },
50
+ },
51
+ headers={
52
+ "Access-Control-Allow-Origin": "*",
53
+ "Cache-Control": "public, max-age=3600",
54
+ },
55
+ )
56
+
57
+
58
+ @mcp_server.custom_route("/.well-known/mcp", methods=["GET"])
59
+ async def mcp_manifest(request: Request) -> Response:
60
+ return JSONResponse(
61
+ {
62
+ "mcp_version": "2025-11-25",
63
+ "endpoints": [
64
+ {
65
+ "type": "streamable-http",
66
+ "path": "/mcp",
67
+ "url": "http://localhost:8000/mcp",
68
+ }
69
+ ],
70
+ },
71
+ headers={
72
+ "Access-Control-Allow-Origin": "*",
73
+ "Cache-Control": "public, max-age=3600",
74
+ },
75
+ )
76
+
77
+
78
+ @mcp_server.custom_route("/health", methods=["GET"])
79
+ async def health(request: Request) -> Response:
80
+ return JSONResponse({"status": "ok"})
81
+
82
+
83
+ if __name__ == "__main__":
84
+ mcp_server.settings.host = "0.0.0.0"
85
+ mcp_server.run(transport="streamable-http")
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "flight-logger-mcp",
3
+ "version": "1.0.0",
4
+ "author": "MEOK AI Labs",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/CSOAI-ORG/flight-logger-mcp"
9
+ },
10
+ "dependencies": {
11
+ "mcp": "^1.0.0"
12
+ },
13
+ "description": "MCP server for flight logger. Features log flight, flight summary, compliance report. From MEOK AI Labs."
14
+ }
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+ [project]
5
+ name = "flight-logger-mcp"
6
+ version = "1.0.0"
7
+ description = "MCP server for flight logger. Features log flight, flight summary, compliance report. From MEOK AI Labs."
8
+ license = {file = "LICENSE"}
9
+ requires-python = ">=3.10"
10
+ authors = [{name = "MEOK AI Labs", email = "nicholas@meok.ai"}]
11
+ dependencies = ["mcp>=1.0.0"]
12
+ keywords = ["mcp", "ai", "meok", "flight", "logger"]
13
+ classifiers = [
14
+ "Programming Language :: Python :: 3",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Operating System :: OS Independent",
17
+ "Topic :: Software Development :: Libraries",
18
+ ]
19
+ [project.urls]
20
+ Homepage = "https://meok.ai"
21
+ Repository = "https://github.com/CSOAI-ORG/flight-logger-mcp"
22
+ [tool.hatch.build.targets.wheel]
23
+ packages = ["."]
24
+ only-include = ["server.py"]
25
+
26
+ [project.scripts]
27
+ flight_logger_mcp = "server:main"
@@ -0,0 +1,3 @@
1
+ [pytest]
2
+ testpaths = tests
3
+ python_files = test_*.py
@@ -0,0 +1,155 @@
1
+ #!/usr/bin/env python3
2
+ """Flight Logger MCP — MEOK AI Labs. Drone/aircraft flight logging, compliance tracking, maintenance scheduling."""
3
+
4
+ import sys, os
5
+ sys.path.insert(0, os.path.expanduser('~/clawd/meok-labs-engine/shared'))
6
+ from auth_middleware import check_access
7
+ from persistence import ServerStore
8
+
9
+ import json, time
10
+ from datetime import datetime, timezone, timedelta
11
+ from collections import defaultdict
12
+ from mcp.server.fastmcp import FastMCP
13
+
14
+ _store = ServerStore("flight-logger")
15
+
16
+ FREE_DAILY_LIMIT = 15
17
+ _usage = defaultdict(list)
18
+ def _rl(c="anon"):
19
+ now = datetime.now(timezone.utc)
20
+ _usage[c] = [t for t in _usage[c] if (now-t).total_seconds() < 86400]
21
+ if len(_usage[c]) >= FREE_DAILY_LIMIT: return json.dumps({"error": f"Limit {FREE_DAILY_LIMIT}/day"})
22
+ _usage[c].append(now); return None
23
+
24
+ mcp = FastMCP("flight-logger", instructions="Drone and aircraft flight logging. Log flights, track compliance, view history, and manage maintenance. By MEOK AI Labs.")
25
+
26
+
27
+ @mcp.tool()
28
+ def log_flight(drone_id: str, duration_min: float, distance_km: float, max_altitude_m: float,
29
+ location: str = "", notes: str = "", battery_start_pct: float = 100, battery_end_pct: float = 20,
30
+ api_key: str = "") -> str:
31
+ """Log a completed drone/aircraft flight with full telemetry data."""
32
+ allowed, msg, tier = check_access(api_key)
33
+ if not allowed:
34
+ return {"error": msg, "upgrade_url": "https://meok.ai/pricing"}
35
+ if err := _rl(): return err
36
+
37
+ flight_id = _store.list_length("flights") + 1
38
+ now = datetime.now(timezone.utc)
39
+ entry = {
40
+ "flight_id": flight_id,
41
+ "drone_id": drone_id,
42
+ "duration_min": duration_min,
43
+ "distance_km": distance_km,
44
+ "max_altitude_m": max_altitude_m,
45
+ "location": location,
46
+ "notes": notes,
47
+ "battery_start_pct": battery_start_pct,
48
+ "battery_end_pct": battery_end_pct,
49
+ "battery_used_pct": round(battery_start_pct - battery_end_pct, 1),
50
+ "logged_at": now.isoformat(),
51
+ }
52
+ _store.append("flights", entry)
53
+
54
+ # Update drone totals
55
+ drone_data = _store.hget("drones", drone_id)
56
+ if not drone_data:
57
+ drone_data = {"total_flights": 0, "total_distance_km": 0, "total_duration_min": 0, "registered": now.isoformat()}
58
+ drone_data["total_flights"] += 1
59
+ drone_data["total_distance_km"] += distance_km
60
+ drone_data["total_duration_min"] += duration_min
61
+ drone_data["last_flight"] = now.isoformat()
62
+ _store.hset("drones", drone_id, drone_data)
63
+
64
+ # Compliance checks
65
+ warnings = []
66
+ if max_altitude_m > 120:
67
+ warnings.append(f"Altitude {max_altitude_m}m exceeds 120m legal limit (UK/EU)")
68
+ if duration_min > 30 and battery_end_pct < 15:
69
+ warnings.append("Low battery landing — consider shorter flights")
70
+ if drone_data["total_flights"] % 50 == 0:
71
+ warnings.append(f"Maintenance check recommended — {drone_data['total_flights']} flights logged")
72
+
73
+ return {"flight_id": flight_id, "status": "logged", "warnings": warnings, "drone_totals": drone_data}
74
+
75
+
76
+ @mcp.tool()
77
+ def flight_summary(drone_id: str = "", last_n: int = 10, api_key: str = "") -> str:
78
+ """Get flight history and statistics for a drone or all drones."""
79
+ allowed, msg, tier = check_access(api_key)
80
+ if not allowed:
81
+ return {"error": msg, "upgrade_url": "https://meok.ai/pricing"}
82
+ if err := _rl(): return err
83
+
84
+ all_flights = _store.list("flights")
85
+ flights = all_flights if not drone_id else [f for f in all_flights if f["drone_id"] == drone_id]
86
+ recent = flights[-last_n:] if flights else []
87
+
88
+ total_dist = sum(f["distance_km"] for f in flights)
89
+ total_dur = sum(f["duration_min"] for f in flights)
90
+ max_alt = max((f["max_altitude_m"] for f in flights), default=0)
91
+ avg_battery = sum(f.get("battery_used_pct", 0) for f in flights) / len(flights) if flights else 0
92
+
93
+ return {
94
+ "drone_id": drone_id or "all",
95
+ "total_flights": len(flights),
96
+ "total_distance_km": round(total_dist, 2),
97
+ "total_duration_min": round(total_dur, 1),
98
+ "total_duration_hours": round(total_dur / 60, 1),
99
+ "max_altitude_m": max_alt,
100
+ "avg_battery_usage_pct": round(avg_battery, 1),
101
+ "recent_flights": recent,
102
+ }
103
+
104
+
105
+ @mcp.tool()
106
+ def compliance_report(drone_id: str, api_key: str = "") -> str:
107
+ """Generate a compliance report for a drone — regulatory adherence, altitude violations, maintenance status."""
108
+ allowed, msg, tier = check_access(api_key)
109
+ if not allowed:
110
+ return {"error": msg, "upgrade_url": "https://meok.ai/pricing"}
111
+ if err := _rl(): return err
112
+
113
+ flights = [f for f in _store.list("flights") if f["drone_id"] == drone_id]
114
+ if not flights:
115
+ return {"drone_id": drone_id, "error": "No flights logged for this drone"}
116
+
117
+ altitude_violations = [f for f in flights if f["max_altitude_m"] > 120]
118
+ low_battery_landings = [f for f in flights if f.get("battery_end_pct", 100) < 10]
119
+ total_flights = len(flights)
120
+ needs_maintenance = total_flights >= 50 and total_flights % 50 < 5
121
+
122
+ compliance_score = 100
123
+ if altitude_violations:
124
+ compliance_score -= min(30, len(altitude_violations) * 5)
125
+ if low_battery_landings:
126
+ compliance_score -= min(20, len(low_battery_landings) * 3)
127
+
128
+ return {
129
+ "drone_id": drone_id,
130
+ "total_flights": total_flights,
131
+ "compliance_score": max(0, compliance_score),
132
+ "altitude_violations": len(altitude_violations),
133
+ "low_battery_incidents": len(low_battery_landings),
134
+ "maintenance_due": needs_maintenance,
135
+ "next_maintenance_at": ((total_flights // 50) + 1) * 50,
136
+ "status": "COMPLIANT" if compliance_score >= 80 else "NEEDS ATTENTION" if compliance_score >= 50 else "NON-COMPLIANT",
137
+ }
138
+
139
+
140
+ @mcp.tool()
141
+ def list_drones(api_key: str = "") -> str:
142
+ """List all registered drones and their flight statistics."""
143
+ allowed, msg, tier = check_access(api_key)
144
+ if not allowed:
145
+ return {"error": msg, "upgrade_url": "https://meok.ai/pricing"}
146
+ if err := _rl(): return err
147
+
148
+ drones = []
149
+ for did, info in _store.hgetall("drones").items():
150
+ drones.append({"drone_id": did, **info, "total_duration_hours": round(info["total_duration_min"] / 60, 1)})
151
+ return {"drones": drones, "total": len(drones)}
152
+
153
+
154
+ if __name__ == "__main__":
155
+ mcp.run()
@@ -0,0 +1,51 @@
1
+ name: flight-logger-mcp
2
+ description: MCP server for flight logger. Features log flight, flight summary, compliance
3
+ report. From MEOK AI Labs.
4
+ version: 1.0.0
5
+ tools:
6
+ - name: log_flight
7
+ description: Log a completed drone/aircraft flight with full telemetry data.
8
+ parameters:
9
+ - name: drone_id
10
+ type: string
11
+ required: true
12
+ - name: duration_min
13
+ type: number
14
+ required: true
15
+ - name: distance_km
16
+ type: number
17
+ required: true
18
+ - name: max_altitude_m
19
+ type: number
20
+ required: true
21
+ - name: location
22
+ type: string
23
+ required: false
24
+ - name: notes
25
+ type: string
26
+ required: false
27
+ - name: battery_start_pct
28
+ type: number
29
+ required: false
30
+ - name: battery_end_pct
31
+ type: number
32
+ required: false
33
+ - name: flight_summary
34
+ description: Get flight history and statistics for a drone or all drones.
35
+ parameters:
36
+ - name: drone_id
37
+ type: string
38
+ required: false
39
+ - name: last_n
40
+ type: integer
41
+ required: false
42
+ - name: compliance_report
43
+ description: Generate a compliance report for a drone — regulatory adherence, altitude
44
+ violations, maintenance status.
45
+ parameters:
46
+ - name: drone_id
47
+ type: string
48
+ required: true
49
+ - name: list_drones
50
+ description: List all registered drones and their flight statistics.
51
+ parameters: []
@@ -0,0 +1,55 @@
1
+ import os
2
+ import sys
3
+ import unittest
4
+
5
+ # Ensure shared auth middleware is available
6
+ sys.path.insert(0, os.path.expanduser("~/clawd/meok-labs-engine/shared"))
7
+ os.chdir(os.path.dirname(os.path.abspath(__file__)) + "/..")
8
+
9
+
10
+ class TestMCPImport(unittest.TestCase):
11
+ def test_import_server(self):
12
+ """Server module must import without errors."""
13
+ import server # noqa: F401
14
+
15
+ def test_mcp_or_server_object_exists(self):
16
+ """FastMCP servers export 'mcp'; low-level servers export 'server'."""
17
+ import server as srv
18
+ self.assertTrue(
19
+ hasattr(srv, "mcp") or hasattr(srv, "server"),
20
+ "Expected 'mcp' or 'server' object in server.py",
21
+ )
22
+
23
+
24
+ class TestAuthMiddleware(unittest.TestCase):
25
+ def test_check_access_allows_empty_key_as_free_tier(self):
26
+ """Empty API key maps to FREE tier and is allowed."""
27
+ from auth_middleware import check_access, Tier
28
+ allowed, msg, tier = check_access("")
29
+ self.assertTrue(allowed)
30
+ self.assertEqual(tier, Tier.FREE)
31
+ self.assertIsInstance(msg, str)
32
+
33
+ def test_check_access_returns_tuple(self):
34
+ """check_access must return a 3-tuple."""
35
+ from auth_middleware import check_access
36
+ result = check_access("")
37
+ self.assertIsInstance(result, tuple)
38
+ self.assertEqual(len(result), 3)
39
+
40
+
41
+ class TestHealthEndpoint(unittest.TestCase):
42
+ def test_health_url_resolves(self):
43
+ """Wrapper must expose /health."""
44
+ import urllib.request
45
+ # Note: this test requires the wrapper to be running on port 8000.
46
+ # It is skipped in CI unless the server is active.
47
+ try:
48
+ resp = urllib.request.urlopen("http://localhost:8000/health", timeout=2)
49
+ self.assertEqual(resp.status, 200)
50
+ except Exception as e:
51
+ self.skipTest(f"Server not running: {e}")
52
+
53
+
54
+ if __name__ == "__main__":
55
+ unittest.main()