diff-ai-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@v2
37
+ with:
38
+ subject-name: ${{ github.repository }}
39
+ subject-digest: sha256:${{ github.sha }}
40
+ push-to-registry: false
@@ -0,0 +1,6 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .dist/
5
+ build/
6
+
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "diff-ai-mcp",
3
+ "description": "AI-powered diff ai MCP server for agents. Supports diff texts, diff summary, word diff. By MEOK AI Labs.",
4
+ "version": "1.0.0",
5
+ "tools": [
6
+ {
7
+ "name": "diff_texts",
8
+ "description": "MEOK AI Labs tool.",
9
+ "parameters": {
10
+ "type": "object",
11
+ "properties": {
12
+ "text_a": {
13
+ "type": "string"
14
+ },
15
+ "text_b": {
16
+ "type": "string"
17
+ }
18
+ },
19
+ "required": [
20
+ "text_a",
21
+ "text_b"
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "name": "diff_summary",
27
+ "description": "MEOK AI Labs tool.",
28
+ "parameters": {
29
+ "type": "object",
30
+ "properties": {
31
+ "text_a": {
32
+ "type": "string"
33
+ },
34
+ "text_b": {
35
+ "type": "string"
36
+ }
37
+ },
38
+ "required": [
39
+ "text_a",
40
+ "text_b"
41
+ ]
42
+ }
43
+ },
44
+ {
45
+ "name": "word_diff",
46
+ "description": "MEOK AI Labs tool.",
47
+ "parameters": {
48
+ "type": "object",
49
+ "properties": {
50
+ "text_a": {
51
+ "type": "string"
52
+ },
53
+ "text_b": {
54
+ "type": "string"
55
+ }
56
+ },
57
+ "required": [
58
+ "text_a",
59
+ "text_b"
60
+ ]
61
+ }
62
+ },
63
+ {
64
+ "name": "similarity_score",
65
+ "description": "MEOK AI Labs tool.",
66
+ "parameters": {
67
+ "type": "object",
68
+ "properties": {
69
+ "text_a": {
70
+ "type": "string"
71
+ },
72
+ "text_b": {
73
+ "type": "string"
74
+ }
75
+ },
76
+ "required": [
77
+ "text_a",
78
+ "text_b"
79
+ ]
80
+ }
81
+ }
82
+ ]
83
+ }
@@ -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,13 @@
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.
@@ -0,0 +1,28 @@
1
+ Metadata-Version: 2.4
2
+ Name: diff-ai-mcp
3
+ Version: 1.0.0
4
+ Summary: AI-powered diff ai MCP server for agents. Supports diff texts, diff summary, word diff. By MEOK AI Labs.
5
+ Project-URL: Homepage, https://meok.ai
6
+ Project-URL: Repository, https://github.com/CSOAI-ORG/diff-ai-mcp
7
+ Author-email: MEOK AI Labs <nicholas@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
+ License-File: LICENSE
22
+ Keywords: ai,diff,mcp,meok
23
+ Classifier: License :: OSI Approved :: MIT License
24
+ Classifier: Operating System :: OS Independent
25
+ Classifier: Programming Language :: Python :: 3
26
+ Classifier: Topic :: Software Development :: Libraries
27
+ Requires-Python: >=3.10
28
+ Requires-Dist: mcp>=1.0.0
@@ -0,0 +1,39 @@
1
+ # Diff AI MCP Server
2
+
3
+ > By [MEOK AI Labs](https://meok.ai) — Compare texts and show differences with detailed change analysis
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install diff-ai-mcp
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ python server.py
15
+ ```
16
+
17
+ ## Tools
18
+
19
+ ### `diff_texts`
20
+ Compare two texts and show line-by-line differences.
21
+
22
+ **Parameters:**
23
+ - `text_a` (str): First text
24
+ - `text_b` (str): Second text
25
+
26
+ ### `diff_summary`
27
+ Generate a summary of differences between two texts.
28
+
29
+ **Parameters:**
30
+ - `text_a` (str): First text
31
+ - `text_b` (str): Second text
32
+
33
+ ## Authentication
34
+
35
+ Free tier: 30 calls/day. Upgrade at [meok.ai/pricing](https://meok.ai/pricing) for unlimited access.
36
+
37
+ ## License
38
+
39
+ MIT — MEOK AI Labs
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "diff-ai-mcp",
3
+ "description": "MEOK AI Labs \u2014 diff-ai-mcp",
4
+ "vendor": "MEOK AI Labs",
5
+ "homepage": "https://meok.ai",
6
+ "repository": "https://github.com/CSOAI-ORG/diff-ai-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,11 @@
1
+ {
2
+ "name": "diff-ai-mcp",
3
+ "version": "1.0.0",
4
+ "description": "AI-powered diff ai MCP server for agents. Supports diff texts, diff summary, word diff. By MEOK AI Labs.",
5
+ "author": "MEOK AI Labs",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/CSOAI-ORG/diff-ai-mcp"
10
+ }
11
+ }
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+ [project]
5
+ name = "diff-ai-mcp"
6
+ version = "1.0.0"
7
+ description = "AI-powered diff ai MCP server for agents. Supports diff texts, diff summary, word diff. By 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", "diff"]
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/diff-ai-mcp"
22
+ [tool.hatch.build.targets.wheel]
23
+ packages = ["."]
24
+ only-include = ["server.py"]
25
+
26
+ [project.scripts]
27
+ diff_ai_mcp = "server:main"
@@ -0,0 +1,3 @@
1
+ [pytest]
2
+ testpaths = tests
3
+ python_files = test_*.py
@@ -0,0 +1,242 @@
1
+ #!/usr/bin/env python3
2
+ """Compare texts, generate diffs, and create/apply patches. — MEOK AI Labs."""
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
+
8
+ import json, difflib, hashlib
9
+ from datetime import datetime, timezone
10
+ from collections import defaultdict
11
+ from mcp.server.fastmcp import FastMCP
12
+
13
+ FREE_DAILY_LIMIT = 30
14
+ _usage = defaultdict(list)
15
+ def _rl(c="anon"):
16
+ now = datetime.now(timezone.utc)
17
+ _usage[c] = [t for t in _usage[c] if (now - t).total_seconds() < 86400]
18
+ if len(_usage[c]) >= FREE_DAILY_LIMIT:
19
+ return json.dumps({"error": f"Limit {FREE_DAILY_LIMIT}/day. Upgrade: meok.ai"})
20
+ _usage[c].append(now)
21
+ return None
22
+
23
+ mcp = FastMCP("diff-ai", instructions="Compare texts, generate unified/context diffs, and create/apply patches. By MEOK AI Labs.")
24
+
25
+
26
+ @mcp.tool()
27
+ def diff_texts(text_a: str, text_b: str, context_lines: int = 3, label_a: str = "original", label_b: str = "modified", api_key: str = "") -> str:
28
+ """Generate a unified diff between two text inputs."""
29
+ allowed, msg, tier = check_access(api_key)
30
+ if not allowed:
31
+ return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
32
+ if err := _rl():
33
+ return err
34
+
35
+ lines_a = text_a.splitlines(keepends=True)
36
+ lines_b = text_b.splitlines(keepends=True)
37
+ context_lines = max(0, min(context_lines, 20))
38
+
39
+ unified = list(difflib.unified_diff(lines_a, lines_b, fromfile=label_a, tofile=label_b, n=context_lines))
40
+ unified_str = ''.join(unified)
41
+
42
+ additions = sum(1 for line in unified if line.startswith('+') and not line.startswith('+++'))
43
+ deletions = sum(1 for line in unified if line.startswith('-') and not line.startswith('---'))
44
+
45
+ ratio = difflib.SequenceMatcher(None, text_a, text_b).ratio()
46
+
47
+ return json.dumps({
48
+ "diff": unified_str,
49
+ "additions": additions,
50
+ "deletions": deletions,
51
+ "total_changes": additions + deletions,
52
+ "similarity": round(ratio, 4),
53
+ "lines_a": len(lines_a),
54
+ "lines_b": len(lines_b),
55
+ "identical": text_a == text_b,
56
+ "timestamp": datetime.now(timezone.utc).isoformat(),
57
+ })
58
+
59
+
60
+ @mcp.tool()
61
+ def diff_files(content_a: str, content_b: str, filename_a: str = "file_a", filename_b: str = "file_b", output_format: str = "unified", api_key: str = "") -> str:
62
+ """Generate a diff between two file contents in unified, context, or ndiff format."""
63
+ allowed, msg, tier = check_access(api_key)
64
+ if not allowed:
65
+ return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
66
+ if err := _rl():
67
+ return err
68
+
69
+ lines_a = content_a.splitlines(keepends=True)
70
+ lines_b = content_b.splitlines(keepends=True)
71
+ output_format = output_format.lower().strip()
72
+
73
+ if output_format == "context":
74
+ diff_lines = list(difflib.context_diff(lines_a, lines_b, fromfile=filename_a, tofile=filename_b))
75
+ elif output_format == "ndiff":
76
+ diff_lines = list(difflib.ndiff(lines_a, lines_b))
77
+ elif output_format == "html":
78
+ differ = difflib.HtmlDiff()
79
+ html_table = differ.make_table(
80
+ lines_a, lines_b,
81
+ fromdesc=filename_a, todesc=filename_b,
82
+ context=True, numlines=3
83
+ )
84
+ return json.dumps({
85
+ "format": "html",
86
+ "html": html_table,
87
+ "lines_a": len(lines_a),
88
+ "lines_b": len(lines_b),
89
+ "timestamp": datetime.now(timezone.utc).isoformat(),
90
+ })
91
+ else:
92
+ diff_lines = list(difflib.unified_diff(lines_a, lines_b, fromfile=filename_a, tofile=filename_b))
93
+
94
+ diff_str = ''.join(diff_lines)
95
+ hash_a = hashlib.sha256(content_a.encode()).hexdigest()[:16]
96
+ hash_b = hashlib.sha256(content_b.encode()).hexdigest()[:16]
97
+
98
+ hunks = 0
99
+ for line in diff_lines:
100
+ if line.startswith('@@') or line.startswith('***'):
101
+ hunks += 1
102
+
103
+ return json.dumps({
104
+ "format": output_format,
105
+ "diff": diff_str,
106
+ "hunks": hunks,
107
+ "lines_a": len(lines_a),
108
+ "lines_b": len(lines_b),
109
+ "hash_a": hash_a,
110
+ "hash_b": hash_b,
111
+ "identical": content_a == content_b,
112
+ "timestamp": datetime.now(timezone.utc).isoformat(),
113
+ })
114
+
115
+
116
+ @mcp.tool()
117
+ def generate_patch(original: str, modified: str, filename: str = "file.txt", api_key: str = "") -> str:
118
+ """Generate a patch file from original and modified text that can be applied with the apply_patch tool."""
119
+ allowed, msg, tier = check_access(api_key)
120
+ if not allowed:
121
+ return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
122
+ if err := _rl():
123
+ return err
124
+
125
+ lines_orig = original.splitlines(keepends=True)
126
+ lines_mod = modified.splitlines(keepends=True)
127
+
128
+ if not lines_orig or not lines_orig[-1].endswith('\n'):
129
+ lines_orig = [l if l.endswith('\n') else l + '\n' for l in original.splitlines()]
130
+ if not lines_mod or not lines_mod[-1].endswith('\n'):
131
+ lines_mod = [l if l.endswith('\n') else l + '\n' for l in modified.splitlines()]
132
+
133
+ patch_lines = list(difflib.unified_diff(
134
+ lines_orig, lines_mod,
135
+ fromfile=f"a/{filename}",
136
+ tofile=f"b/{filename}",
137
+ n=3
138
+ ))
139
+ patch_str = ''.join(patch_lines)
140
+
141
+ additions = sum(1 for l in patch_lines if l.startswith('+') and not l.startswith('+++'))
142
+ deletions = sum(1 for l in patch_lines if l.startswith('-') and not l.startswith('---'))
143
+ hunks = sum(1 for l in patch_lines if l.startswith('@@'))
144
+
145
+ return json.dumps({
146
+ "patch": patch_str,
147
+ "filename": filename,
148
+ "hunks": hunks,
149
+ "additions": additions,
150
+ "deletions": deletions,
151
+ "original_lines": len(lines_orig),
152
+ "modified_lines": len(lines_mod),
153
+ "patch_size_bytes": len(patch_str.encode()),
154
+ "timestamp": datetime.now(timezone.utc).isoformat(),
155
+ })
156
+
157
+
158
+ @mcp.tool()
159
+ def apply_patch(original: str, patch_text: str, api_key: str = "") -> str:
160
+ """Apply a unified diff patch to the original text and return the result."""
161
+ allowed, msg, tier = check_access(api_key)
162
+ if not allowed:
163
+ return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
164
+ if err := _rl():
165
+ return err
166
+
167
+ original_lines = original.splitlines(keepends=True)
168
+ if original_lines and not original_lines[-1].endswith('\n'):
169
+ original_lines[-1] += '\n'
170
+
171
+ patch_lines = patch_text.splitlines(keepends=True)
172
+
173
+ result_lines = list(original_lines)
174
+ hunks = []
175
+ current_hunk = None
176
+
177
+ for line in patch_lines:
178
+ if line.startswith('@@'):
179
+ import re
180
+ match = re.match(r'^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@', line)
181
+ if match:
182
+ if current_hunk:
183
+ hunks.append(current_hunk)
184
+ current_hunk = {
185
+ "orig_start": int(match.group(1)) - 1,
186
+ "orig_count": int(match.group(2) or 1),
187
+ "new_start": int(match.group(3)) - 1,
188
+ "new_count": int(match.group(4) or 1),
189
+ "removals": [],
190
+ "additions": [],
191
+ }
192
+ elif current_hunk is not None:
193
+ if line.startswith('-') and not line.startswith('---'):
194
+ current_hunk["removals"].append(line[1:])
195
+ elif line.startswith('+') and not line.startswith('+++'):
196
+ current_hunk["additions"].append(line[1:])
197
+
198
+ if current_hunk:
199
+ hunks.append(current_hunk)
200
+
201
+ offset = 0
202
+ applied_hunks = 0
203
+ failed_hunks = 0
204
+
205
+ for hunk in hunks:
206
+ start = hunk["orig_start"] + offset
207
+ removals = hunk["removals"]
208
+ additions = hunk["additions"]
209
+
210
+ can_apply = True
211
+ for i, rem_line in enumerate(removals):
212
+ idx = start + i
213
+ if idx >= len(result_lines):
214
+ can_apply = False
215
+ break
216
+ if result_lines[idx].rstrip('\n') != rem_line.rstrip('\n'):
217
+ can_apply = False
218
+ break
219
+
220
+ if can_apply:
221
+ result_lines[start:start + len(removals)] = additions
222
+ offset += len(additions) - len(removals)
223
+ applied_hunks += 1
224
+ else:
225
+ failed_hunks += 1
226
+
227
+ result_text = ''.join(result_lines)
228
+
229
+ return json.dumps({
230
+ "result": result_text,
231
+ "applied_hunks": applied_hunks,
232
+ "failed_hunks": failed_hunks,
233
+ "total_hunks": len(hunks),
234
+ "success": failed_hunks == 0,
235
+ "original_lines": len(original_lines),
236
+ "result_lines": len(result_lines),
237
+ "timestamp": datetime.now(timezone.utc).isoformat(),
238
+ })
239
+
240
+
241
+ if __name__ == "__main__":
242
+ mcp.run()
@@ -0,0 +1,41 @@
1
+ name: diff-ai-mcp
2
+ description: AI-powered diff ai MCP server for agents. Supports diff texts, diff summary,
3
+ word diff. By MEOK AI Labs.
4
+ version: 1.0.0
5
+ tools:
6
+ - name: diff_texts
7
+ description: MEOK AI Labs tool.
8
+ parameters:
9
+ - name: text_a
10
+ type: string
11
+ required: true
12
+ - name: text_b
13
+ type: string
14
+ required: true
15
+ - name: diff_summary
16
+ description: MEOK AI Labs tool.
17
+ parameters:
18
+ - name: text_a
19
+ type: string
20
+ required: true
21
+ - name: text_b
22
+ type: string
23
+ required: true
24
+ - name: word_diff
25
+ description: MEOK AI Labs tool.
26
+ parameters:
27
+ - name: text_a
28
+ type: string
29
+ required: true
30
+ - name: text_b
31
+ type: string
32
+ required: true
33
+ - name: similarity_score
34
+ description: MEOK AI Labs tool.
35
+ parameters:
36
+ - name: text_a
37
+ type: string
38
+ required: true
39
+ - name: text_b
40
+ type: string
41
+ required: true
@@ -0,0 +1,47 @@
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_blocks_empty_key(self):
26
+ """Empty API key should be rejected on free tier."""
27
+ from auth_middleware import check_access
28
+ allowed, msg, tier = check_access("")
29
+ self.assertFalse(allowed)
30
+ self.assertIn("upgrade", msg.lower() or tier.lower())
31
+
32
+
33
+ class TestHealthEndpoint(unittest.TestCase):
34
+ def test_health_url_resolves(self):
35
+ """Wrapper must expose /health."""
36
+ import urllib.request
37
+ # Note: this test requires the wrapper to be running on port 8000.
38
+ # It is skipped in CI unless the server is active.
39
+ try:
40
+ resp = urllib.request.urlopen("http://localhost:8000/health", timeout=2)
41
+ self.assertEqual(resp.status, 200)
42
+ except Exception as e:
43
+ self.skipTest(f"Server not running: {e}")
44
+
45
+
46
+ if __name__ == "__main__":
47
+ unittest.main()