encoder-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.
- encoder_ai_mcp-1.0.0/.github/workflows/mcp-smithery-publish.yml +40 -0
- encoder_ai_mcp-1.0.0/.gitignore +6 -0
- encoder_ai_mcp-1.0.0/.mcp.json +82 -0
- encoder_ai_mcp-1.0.0/Dockerfile.glama +20 -0
- encoder_ai_mcp-1.0.0/LICENSE +13 -0
- encoder_ai_mcp-1.0.0/PKG-INFO +28 -0
- encoder_ai_mcp-1.0.0/README.md +9 -0
- encoder_ai_mcp-1.0.0/glama.json +10 -0
- encoder_ai_mcp-1.0.0/mcp-wrapper.py +85 -0
- encoder_ai_mcp-1.0.0/package.json +11 -0
- encoder_ai_mcp-1.0.0/pyproject.toml +27 -0
- encoder_ai_mcp-1.0.0/pytest.ini +3 -0
- encoder_ai_mcp-1.0.0/server.py +100 -0
- encoder_ai_mcp-1.0.0/smithery.yaml +35 -0
- encoder_ai_mcp-1.0.0/tests/test_server.py +47 -0
|
@@ -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,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "encoder-ai-mcp",
|
|
3
|
+
"description": "Encoder Ai tools for AI agents. Capabilities: encode base64, decode base64, encode url. Built by MEOK AI Labs.",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"tools": [
|
|
6
|
+
{
|
|
7
|
+
"name": "encode_base64",
|
|
8
|
+
"description": "Encode text to Base64.",
|
|
9
|
+
"parameters": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"text": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": [
|
|
17
|
+
"text"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "decode_base64",
|
|
23
|
+
"description": "Decode Base64 to text.",
|
|
24
|
+
"parameters": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"encoded": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": [
|
|
32
|
+
"encoded"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "encode_url",
|
|
38
|
+
"description": "URL-encode a string.",
|
|
39
|
+
"parameters": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"properties": {
|
|
42
|
+
"text": {
|
|
43
|
+
"type": "string"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": [
|
|
47
|
+
"text"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "encode_html",
|
|
53
|
+
"description": "HTML-encode special characters.",
|
|
54
|
+
"parameters": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"properties": {
|
|
57
|
+
"text": {
|
|
58
|
+
"type": "string"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"required": [
|
|
62
|
+
"text"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "to_hex",
|
|
68
|
+
"description": "Convert text to hexadecimal.",
|
|
69
|
+
"parameters": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"properties": {
|
|
72
|
+
"text": {
|
|
73
|
+
"type": "string"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"required": [
|
|
77
|
+
"text"
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
@@ -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: encoder-ai-mcp
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Encoder Ai tools for AI agents. Capabilities: encode base64, decode base64, encode url. Built by MEOK AI Labs.
|
|
5
|
+
Project-URL: Homepage, https://meok.ai
|
|
6
|
+
Project-URL: Repository, https://github.com/CSOAI-ORG/encoder-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,encoder,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,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "encoder-ai-mcp",
|
|
3
|
+
"description": "MEOK AI Labs \u2014 encoder-ai-mcp",
|
|
4
|
+
"vendor": "MEOK AI Labs",
|
|
5
|
+
"homepage": "https://meok.ai",
|
|
6
|
+
"repository": "https://github.com/CSOAI-ORG/encoder-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": "encoder-ai-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Encoder Ai tools for AI agents. Capabilities: encode base64, decode base64, encode url. Built by MEOK AI Labs.",
|
|
5
|
+
"author": "MEOK AI Labs",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/CSOAI-ORG/encoder-ai-mcp"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
[project]
|
|
5
|
+
name = "encoder-ai-mcp"
|
|
6
|
+
version = "1.0.0"
|
|
7
|
+
description = "Encoder Ai tools for AI agents. Capabilities: encode base64, decode base64, encode url. Built 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", "encoder"]
|
|
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/encoder-ai-mcp"
|
|
22
|
+
[tool.hatch.build.targets.wheel]
|
|
23
|
+
packages = ["."]
|
|
24
|
+
only-include = ["server.py"]
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
encoder_ai_mcp = "server:main"
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Encoding and decoding — Base64, URL, HTML, hex, binary. — 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, os, re, hashlib, math
|
|
9
|
+
from datetime import datetime, timezone
|
|
10
|
+
from typing import Optional
|
|
11
|
+
from collections import defaultdict
|
|
12
|
+
from mcp.server.fastmcp import FastMCP
|
|
13
|
+
|
|
14
|
+
FREE_DAILY_LIMIT = 30
|
|
15
|
+
_usage = defaultdict(list)
|
|
16
|
+
def _rl(c="anon"):
|
|
17
|
+
now = datetime.now(timezone.utc)
|
|
18
|
+
_usage[c] = [t for t in _usage[c] if (now-t).total_seconds() < 86400]
|
|
19
|
+
if len(_usage[c]) >= FREE_DAILY_LIMIT: return json.dumps({"error": "Limit {0}/day. Upgrade: meok.ai".format(FREE_DAILY_LIMIT)})
|
|
20
|
+
_usage[c].append(now); return None
|
|
21
|
+
|
|
22
|
+
mcp = FastMCP("encoder-ai", instructions="MEOK AI Labs — Encoding and decoding — Base64, URL, HTML, hex, binary.")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@mcp.tool()
|
|
26
|
+
def encode_base64(text: str, api_key: str = "") -> str:
|
|
27
|
+
"""Encode text to Base64."""
|
|
28
|
+
allowed, msg, tier = check_access(api_key)
|
|
29
|
+
if not allowed:
|
|
30
|
+
return {"error": msg, "upgrade_url": "https://meok.ai/pricing"}
|
|
31
|
+
|
|
32
|
+
if err := _rl(): return err
|
|
33
|
+
# Real implementation
|
|
34
|
+
result = {"tool": "encode_base64", "input_length": len(str(locals())), "timestamp": datetime.now(timezone.utc).isoformat()}
|
|
35
|
+
import base64
|
|
36
|
+
result["encoded"] = base64.b64encode(text.encode()).decode()
|
|
37
|
+
return result
|
|
38
|
+
|
|
39
|
+
@mcp.tool()
|
|
40
|
+
def decode_base64(encoded: str, api_key: str = "") -> str:
|
|
41
|
+
"""Decode Base64 to text."""
|
|
42
|
+
allowed, msg, tier = check_access(api_key)
|
|
43
|
+
if not allowed:
|
|
44
|
+
return {"error": msg, "upgrade_url": "https://meok.ai/pricing"}
|
|
45
|
+
|
|
46
|
+
if err := _rl(): return err
|
|
47
|
+
# Real implementation
|
|
48
|
+
result = {"tool": "decode_base64", "input_length": len(str(locals())), "timestamp": datetime.now(timezone.utc).isoformat()}
|
|
49
|
+
import base64
|
|
50
|
+
try:
|
|
51
|
+
result["decoded"] = base64.b64decode(encoded.encode()).decode()
|
|
52
|
+
except: result["error"] = "Invalid base64"
|
|
53
|
+
return result
|
|
54
|
+
|
|
55
|
+
@mcp.tool()
|
|
56
|
+
def encode_url(text: str, api_key: str = "") -> str:
|
|
57
|
+
"""URL-encode a string."""
|
|
58
|
+
allowed, msg, tier = check_access(api_key)
|
|
59
|
+
if not allowed:
|
|
60
|
+
return {"error": msg, "upgrade_url": "https://meok.ai/pricing"}
|
|
61
|
+
|
|
62
|
+
if err := _rl(): return err
|
|
63
|
+
# Real implementation
|
|
64
|
+
result = {"tool": "encode_url", "input_length": len(str(locals())), "timestamp": datetime.now(timezone.utc).isoformat()}
|
|
65
|
+
import base64
|
|
66
|
+
from urllib.parse import quote
|
|
67
|
+
result["encoded"] = quote(text)
|
|
68
|
+
return result
|
|
69
|
+
|
|
70
|
+
@mcp.tool()
|
|
71
|
+
def encode_html(text: str, api_key: str = "") -> str:
|
|
72
|
+
"""HTML-encode special characters."""
|
|
73
|
+
allowed, msg, tier = check_access(api_key)
|
|
74
|
+
if not allowed:
|
|
75
|
+
return {"error": msg, "upgrade_url": "https://meok.ai/pricing"}
|
|
76
|
+
|
|
77
|
+
if err := _rl(): return err
|
|
78
|
+
# Real implementation
|
|
79
|
+
result = {"tool": "encode_html", "input_length": len(str(locals())), "timestamp": datetime.now(timezone.utc).isoformat()}
|
|
80
|
+
import base64
|
|
81
|
+
import html as h
|
|
82
|
+
result["encoded"] = h.escape(text)
|
|
83
|
+
return result
|
|
84
|
+
|
|
85
|
+
@mcp.tool()
|
|
86
|
+
def to_hex(text: str, api_key: str = "") -> str:
|
|
87
|
+
"""Convert text to hexadecimal."""
|
|
88
|
+
allowed, msg, tier = check_access(api_key)
|
|
89
|
+
if not allowed:
|
|
90
|
+
return {"error": msg, "upgrade_url": "https://meok.ai/pricing"}
|
|
91
|
+
|
|
92
|
+
if err := _rl(): return err
|
|
93
|
+
# Real implementation
|
|
94
|
+
result = {"tool": "to_hex", "input_length": len(str(locals())), "timestamp": datetime.now(timezone.utc).isoformat()}
|
|
95
|
+
result["status"] = "processed"
|
|
96
|
+
return result
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
if __name__ == "__main__":
|
|
100
|
+
mcp.run()
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: encoder-ai-mcp
|
|
2
|
+
description: 'Encoder Ai tools for AI agents. Capabilities: encode base64, decode
|
|
3
|
+
base64, encode url. Built by MEOK AI Labs.'
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tools:
|
|
6
|
+
- name: encode_base64
|
|
7
|
+
description: Encode text to Base64.
|
|
8
|
+
parameters:
|
|
9
|
+
- name: text
|
|
10
|
+
type: string
|
|
11
|
+
required: true
|
|
12
|
+
- name: decode_base64
|
|
13
|
+
description: Decode Base64 to text.
|
|
14
|
+
parameters:
|
|
15
|
+
- name: encoded
|
|
16
|
+
type: string
|
|
17
|
+
required: true
|
|
18
|
+
- name: encode_url
|
|
19
|
+
description: URL-encode a string.
|
|
20
|
+
parameters:
|
|
21
|
+
- name: text
|
|
22
|
+
type: string
|
|
23
|
+
required: true
|
|
24
|
+
- name: encode_html
|
|
25
|
+
description: HTML-encode special characters.
|
|
26
|
+
parameters:
|
|
27
|
+
- name: text
|
|
28
|
+
type: string
|
|
29
|
+
required: true
|
|
30
|
+
- name: to_hex
|
|
31
|
+
description: Convert text to hexadecimal.
|
|
32
|
+
parameters:
|
|
33
|
+
- name: text
|
|
34
|
+
type: string
|
|
35
|
+
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()
|