string-utils-ai-mcp 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- string_utils_ai_mcp-1.0.2/.cursorrules +9 -0
- string_utils_ai_mcp-1.0.2/.github/FUNDING.yml +8 -0
- string_utils_ai_mcp-1.0.2/.github/workflows/mcp-smithery-publish.yml +40 -0
- string_utils_ai_mcp-1.0.2/.github/workflows/test.yml +31 -0
- string_utils_ai_mcp-1.0.2/.gitignore +4 -0
- string_utils_ai_mcp-1.0.2/.mcp.json +94 -0
- string_utils_ai_mcp-1.0.2/.well-known/mcp/server-card.json +52 -0
- string_utils_ai_mcp-1.0.2/CODE_OF_CONDUCT.md +18 -0
- string_utils_ai_mcp-1.0.2/CONTRIBUTING.md +21 -0
- string_utils_ai_mcp-1.0.2/Dockerfile +16 -0
- string_utils_ai_mcp-1.0.2/Dockerfile.glama +20 -0
- string_utils_ai_mcp-1.0.2/LICENSE +13 -0
- string_utils_ai_mcp-1.0.2/PKG-INFO +28 -0
- string_utils_ai_mcp-1.0.2/README.md +92 -0
- string_utils_ai_mcp-1.0.2/SECURITY.md +16 -0
- string_utils_ai_mcp-1.0.2/glama.json +10 -0
- string_utils_ai_mcp-1.0.2/llms.txt +33 -0
- string_utils_ai_mcp-1.0.2/mcp-wrapper.py +85 -0
- string_utils_ai_mcp-1.0.2/package.json +30 -0
- string_utils_ai_mcp-1.0.2/pyproject.toml +27 -0
- string_utils_ai_mcp-1.0.2/pytest.ini +3 -0
- string_utils_ai_mcp-1.0.2/server.py +175 -0
- string_utils_ai_mcp-1.0.2/smithery.yaml +56 -0
- string_utils_ai_mcp-1.0.2/tests/test_server.py +55 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# string-utils-ai-mcp - Auto-trigger Rules
|
|
2
|
+
|
|
3
|
+
When the user asks about string utils, use string-utils-ai-mcp tools: slugify, camel_to_snake, truncate_smart, extract_numbers
|
|
4
|
+
|
|
5
|
+
> By [MEOK AI Labs](https://meok.ai) — MEOK AI Labs MCP Server
|
|
6
|
+
|
|
7
|
+
Install: `pip install string-utils-ai-mcp`
|
|
8
|
+
|
|
9
|
+
By MEOK AI Labs — MIT licensed.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Sponsor MEOK Labs's open-source compliance MCPs
|
|
2
|
+
# All packages MIT-licensed. Supports the Sigstore migration + ongoing maintenance.
|
|
3
|
+
|
|
4
|
+
github: [CSOAI-ORG]
|
|
5
|
+
custom:
|
|
6
|
+
- "https://buy.stripe.com/eVq9AV4O87sudMF42k8k839"
|
|
7
|
+
- "https://meok.ai/sponsor"
|
|
8
|
+
- "https://nlnet.nl/propose"
|
|
@@ -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,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "string-utils-ai-mcp",
|
|
3
|
+
"description": "String Utils Ai tools for AI agents. Capabilities: slugify, camel to snake, truncate smart. Built by MEOK AI Labs.",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"tools": [
|
|
6
|
+
{
|
|
7
|
+
"name": "slugify",
|
|
8
|
+
"description": "Convert text to a URL-friendly slug.",
|
|
9
|
+
"parameters": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"text": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
},
|
|
15
|
+
"separator": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
"max_length": {
|
|
19
|
+
"type": "integer"
|
|
20
|
+
},
|
|
21
|
+
"lowercase": {
|
|
22
|
+
"type": "boolean"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": [
|
|
26
|
+
"text"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "camel_to_snake",
|
|
32
|
+
"description": "Convert between camelCase, snake_case, kebab-case, and PascalCase.",
|
|
33
|
+
"parameters": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"properties": {
|
|
36
|
+
"text": {
|
|
37
|
+
"type": "string"
|
|
38
|
+
},
|
|
39
|
+
"direction": {
|
|
40
|
+
"type": "string"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"required": [
|
|
44
|
+
"text"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "truncate_smart",
|
|
50
|
+
"description": "Smartly truncate text at word boundaries with a suffix.",
|
|
51
|
+
"parameters": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"properties": {
|
|
54
|
+
"text": {
|
|
55
|
+
"type": "string"
|
|
56
|
+
},
|
|
57
|
+
"max_length": {
|
|
58
|
+
"type": "integer"
|
|
59
|
+
},
|
|
60
|
+
"suffix": {
|
|
61
|
+
"type": "string"
|
|
62
|
+
},
|
|
63
|
+
"preserve_words": {
|
|
64
|
+
"type": "boolean"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"required": [
|
|
68
|
+
"text"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "extract_numbers",
|
|
74
|
+
"description": "Extract all numbers from text.",
|
|
75
|
+
"parameters": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"properties": {
|
|
78
|
+
"text": {
|
|
79
|
+
"type": "string"
|
|
80
|
+
},
|
|
81
|
+
"include_decimals": {
|
|
82
|
+
"type": "boolean"
|
|
83
|
+
},
|
|
84
|
+
"include_negative": {
|
|
85
|
+
"type": "boolean"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"required": [
|
|
89
|
+
"text"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "string-utils-ai",
|
|
3
|
+
"description": "String Utils Ai tools powered 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/string-utils-ai-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": "slugify",
|
|
25
|
+
"description": "Convert text to a URL-friendly slug."
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "camel_to_snake",
|
|
29
|
+
"description": "Convert between camelCase, snake_case, kebab-case, and PascalCase."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "truncate_smart",
|
|
33
|
+
"description": "Smartly truncate text at word boundaries with a suffix."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "extract_numbers",
|
|
37
|
+
"description": "Extract all numbers from text."
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"categories": [
|
|
41
|
+
"AI & Machine Learning"
|
|
42
|
+
],
|
|
43
|
+
"pricing": {
|
|
44
|
+
"free": {
|
|
45
|
+
"calls_per_day": 15
|
|
46
|
+
},
|
|
47
|
+
"pro": {
|
|
48
|
+
"price": "$29/month",
|
|
49
|
+
"url": "https://meok.ai/pricing"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -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,16 @@
|
|
|
1
|
+
FROM python:3.11-slim
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
|
|
5
|
+
ENV PYTHONUNBUFFERED=1
|
|
6
|
+
ENV PYTHONDONTWRITEBYTECODE=1
|
|
7
|
+
|
|
8
|
+
COPY pyproject.toml .
|
|
9
|
+
COPY server.py .
|
|
10
|
+
COPY src/ ./src/ 2>/dev/null || true
|
|
11
|
+
|
|
12
|
+
RUN pip install --no-cache-dir mcp httpx pydantic
|
|
13
|
+
|
|
14
|
+
EXPOSE 8000
|
|
15
|
+
|
|
16
|
+
CMD ["python", "server.py"]
|
|
@@ -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: string-utils-ai-mcp
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: String Utils Ai tools for AI agents. Capabilities: slugify, camel to snake, truncate smart. Built by MEOK AI Labs.
|
|
5
|
+
Project-URL: Homepage, https://meok.ai
|
|
6
|
+
Project-URL: Repository, https://github.com/CSOAI-ORG/string-utils-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,mcp,meok,string,utils
|
|
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,92 @@
|
|
|
1
|
+
# String Utils Ai
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/string-utils-ai-mcp/) [](https://pypi.org/project/string-utils-ai-mcp/)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
> By [MEOK AI Labs](https://meok.ai) — MEOK AI Labs MCP Server
|
|
7
|
+
|
|
8
|
+
String Utils AI MCP Server
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install string-utils-ai-mcp
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Run standalone
|
|
20
|
+
python server.py
|
|
21
|
+
|
|
22
|
+
# Or via MCP
|
|
23
|
+
mcp install string-utils-ai-mcp
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Tools
|
|
27
|
+
|
|
28
|
+
### `slugify`
|
|
29
|
+
Convert text to a URL-friendly slug.
|
|
30
|
+
|
|
31
|
+
**Parameters:**
|
|
32
|
+
- `text` (str)
|
|
33
|
+
- `separator` (str)
|
|
34
|
+
- `max_length` (int)
|
|
35
|
+
- `lowercase` (bool)
|
|
36
|
+
|
|
37
|
+
### `camel_to_snake`
|
|
38
|
+
Convert between camelCase, snake_case, kebab-case, and PascalCase.
|
|
39
|
+
|
|
40
|
+
**Parameters:**
|
|
41
|
+
- `text` (str)
|
|
42
|
+
- `direction` (str)
|
|
43
|
+
|
|
44
|
+
### `truncate_smart`
|
|
45
|
+
Smartly truncate text at word boundaries with a suffix.
|
|
46
|
+
|
|
47
|
+
**Parameters:**
|
|
48
|
+
- `text` (str)
|
|
49
|
+
- `max_length` (int)
|
|
50
|
+
- `suffix` (str)
|
|
51
|
+
- `preserve_words` (bool)
|
|
52
|
+
|
|
53
|
+
### `extract_numbers`
|
|
54
|
+
Extract all numbers from text.
|
|
55
|
+
|
|
56
|
+
**Parameters:**
|
|
57
|
+
- `text` (str)
|
|
58
|
+
- `include_decimals` (bool)
|
|
59
|
+
- `include_negative` (bool)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## Authentication
|
|
63
|
+
|
|
64
|
+
Free tier: 15 calls/day. Upgrade at [meok.ai/pricing](https://meok.ai/pricing) for unlimited access.
|
|
65
|
+
|
|
66
|
+
## Links
|
|
67
|
+
|
|
68
|
+
- **Website**: [meok.ai](https://meok.ai)
|
|
69
|
+
- **GitHub**: [CSOAI-ORG/string-utils-ai-mcp](https://github.com/CSOAI-ORG/string-utils-ai-mcp)
|
|
70
|
+
- **PyPI**: [pypi.org/project/string-utils-ai-mcp](https://pypi.org/project/string-utils-ai-mcp/)
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT — MEOK AI Labs
|
|
75
|
+
|
|
76
|
+
<!-- meok-moat-footer-v1 -->
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Pairs with MEOK Governance Suite
|
|
80
|
+
|
|
81
|
+
Build something that touches users? You need compliance. MEOK ships 38 governance MCPs that drop in alongside this tool — EU AI Act, DORA, NIS2, CRA, GDPR, ISO 42001, FDA SaMD, MDR, Basel, MiFID II, MiCA, COPPA, and more.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# One-shot install of the governance pack
|
|
85
|
+
npx meok-setup --pack governance
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Free tier: 10 calls/day per MCP. Pro tier (£79/mo): unlimited + cryptographically signed compliance attestations your auditor verifies independently.
|
|
89
|
+
|
|
90
|
+
→ Full catalogue: [councilof.ai/catalogue](https://councilof.ai/catalogue)
|
|
91
|
+
→ MEOK AI Labs: [meok.ai](https://meok.ai)
|
|
92
|
+
|
|
@@ -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": "string-utils-ai-mcp",
|
|
3
|
+
"description": "MEOK AI Labs \u2014 string-utils-ai-mcp",
|
|
4
|
+
"vendor": "MEOK AI Labs",
|
|
5
|
+
"homepage": "https://meok.ai",
|
|
6
|
+
"repository": "https://github.com/CSOAI-ORG/string-utils-ai-mcp",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"runtime": "python",
|
|
9
|
+
"entryPoint": "mcp-wrapper.py"
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# string-utils-ai-mcp
|
|
2
|
+
# > By [MEOK AI Labs](https://meok.ai) — MEOK AI Labs MCP Server
|
|
3
|
+
|
|
4
|
+
## Install
|
|
5
|
+
```bash
|
|
6
|
+
pip install string-utils-ai-mcp
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Auth & Rate Limits
|
|
10
|
+
- Free tier: 10 calls/day. No API key required.
|
|
11
|
+
- Pro tier (£79/mo): unlimited + signed attestations.
|
|
12
|
+
- Enterprise (£1,499/mo): white-label.
|
|
13
|
+
|
|
14
|
+
## Tools
|
|
15
|
+
|
|
16
|
+
### `slugify`
|
|
17
|
+
Convert text to a URL-friendly slug.
|
|
18
|
+
|
|
19
|
+
### `camel_to_snake`
|
|
20
|
+
Convert between camelCase, snake_case, kebab-case, and PascalCase.
|
|
21
|
+
|
|
22
|
+
### `truncate_smart`
|
|
23
|
+
Smartly truncate text at word boundaries with a suffix.
|
|
24
|
+
|
|
25
|
+
### `extract_numbers`
|
|
26
|
+
Extract all numbers from text.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Maintainer
|
|
30
|
+
MEOK AI Labs · hello@meok.ai · https://meok.ai · MIT licensed
|
|
31
|
+
|
|
32
|
+
## Pairs with
|
|
33
|
+
Governance moat: pair this tool with any of MEOK's 38 governance MCPs (EU AI Act, DORA, NIS2, CRA, GDPR, ISO 42001, etc.) for full compliance coverage.
|
|
@@ -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,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "string-utils-ai-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "String Utils Ai tools for AI agents. Capabilities: slugify, camel to snake, truncate smart. Built by MEOK AI Labs.",
|
|
5
|
+
"main": "server.py",
|
|
6
|
+
"mcp": {
|
|
7
|
+
"name": "string utils",
|
|
8
|
+
"vendor": "MEOK AI Labs",
|
|
9
|
+
"homepage": "https://meok.ai",
|
|
10
|
+
"repository": "https://github.com/CSOAI-ORG/string-utils-ai-mcp",
|
|
11
|
+
"runtime": "python",
|
|
12
|
+
"tags": [
|
|
13
|
+
"mcp",
|
|
14
|
+
"mcp-server",
|
|
15
|
+
"meok-ai-labs",
|
|
16
|
+
"ai-tools"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"mcp",
|
|
21
|
+
"mcp-server",
|
|
22
|
+
"meok-ai-labs"
|
|
23
|
+
],
|
|
24
|
+
"author": "MEOK AI Labs <nicholas@meok.ai>",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/CSOAI-ORG/string-utils-ai-mcp"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
[project]
|
|
5
|
+
name = "string-utils-ai-mcp"
|
|
6
|
+
version = "1.0.2"
|
|
7
|
+
description = "String Utils Ai tools for AI agents. Capabilities: slugify, camel to snake, truncate smart. 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", "string", "utils"]
|
|
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/string-utils-ai-mcp"
|
|
22
|
+
[tool.hatch.build.targets.wheel]
|
|
23
|
+
packages = ["."]
|
|
24
|
+
only-include = ["server.py"]
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
string_utils_ai_mcp = "server:main"
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"""
|
|
2
|
+
String Utils AI MCP Server
|
|
3
|
+
String manipulation and transformation tools powered by MEOK AI Labs.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import sys, os
|
|
8
|
+
from auth_middleware import check_access
|
|
9
|
+
|
|
10
|
+
import re
|
|
11
|
+
import time
|
|
12
|
+
import unicodedata
|
|
13
|
+
from collections import defaultdict
|
|
14
|
+
from mcp.server.fastmcp import FastMCP
|
|
15
|
+
|
|
16
|
+
STRIPE_199 = "https://buy.stripe.com/14A4gB3K4eUWgYR56o8k836"
|
|
17
|
+
|
|
18
|
+
def _add_upgrade_tail(response, tier="free"):
|
|
19
|
+
"""Append upgrade nudge to free-tier success responses."""
|
|
20
|
+
if isinstance(response, dict) and tier == "free":
|
|
21
|
+
response["_upgrade_note"] = "Pro tier: unlimited calls + priority support. Upgrade: " + STRIPE_199
|
|
22
|
+
return response
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
mcp = FastMCP("string-utils-ai", instructions="MEOK AI Labs MCP Server")
|
|
26
|
+
|
|
27
|
+
_call_counts: dict[str, list[float]] = defaultdict(list)
|
|
28
|
+
FREE_TIER_LIMIT = 50
|
|
29
|
+
WINDOW = 86400
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _check_rate_limit(tool_name: str) -> None:
|
|
33
|
+
now = time.time()
|
|
34
|
+
_call_counts[tool_name] = [t for t in _call_counts[tool_name] if now - t < WINDOW]
|
|
35
|
+
if len(_call_counts[tool_name]) >= FREE_TIER_LIMIT:
|
|
36
|
+
raise ValueError(f"Rate limit exceeded for {tool_name}. Free tier: {FREE_TIER_LIMIT}/day. Upgrade at https://meok.ai/pricing")
|
|
37
|
+
_call_counts[tool_name].append(now)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@mcp.tool()
|
|
41
|
+
def slugify(text: str, separator: str = "-", max_length: int = 80, lowercase: bool = True, api_key: str = "") -> dict:
|
|
42
|
+
"""Convert text to a URL-friendly slug.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
text: Text to slugify
|
|
46
|
+
separator: Word separator (default '-')
|
|
47
|
+
max_length: Maximum slug length (default 80)
|
|
48
|
+
lowercase: Convert to lowercase (default True)
|
|
49
|
+
"""
|
|
50
|
+
allowed, msg, tier = check_access(api_key)
|
|
51
|
+
if not allowed:
|
|
52
|
+
return {"error": msg, "upgrade_url": STRIPE_199}
|
|
53
|
+
|
|
54
|
+
_check_rate_limit("slugify")
|
|
55
|
+
slug = unicodedata.normalize('NFKD', text).encode('ascii', 'ignore').decode('ascii')
|
|
56
|
+
if lowercase:
|
|
57
|
+
slug = slug.lower()
|
|
58
|
+
slug = re.sub(r'[^\w\s-]', '', slug)
|
|
59
|
+
slug = re.sub(r'[-\s]+', separator, slug).strip(separator)
|
|
60
|
+
if max_length and len(slug) > max_length:
|
|
61
|
+
slug = slug[:max_length].rstrip(separator)
|
|
62
|
+
return {"slug": slug, "original": text, "length": len(slug)}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@mcp.tool()
|
|
66
|
+
def camel_to_snake(text: str, direction: str = "camel_to_snake", api_key: str = "") -> dict:
|
|
67
|
+
"""Convert between camelCase, snake_case, kebab-case, and PascalCase.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
text: String to convert
|
|
71
|
+
direction: Conversion type - 'camel_to_snake', 'snake_to_camel', 'to_kebab', 'to_pascal', 'to_constant'
|
|
72
|
+
"""
|
|
73
|
+
allowed, msg, tier = check_access(api_key)
|
|
74
|
+
if not allowed:
|
|
75
|
+
return {"error": msg, "upgrade_url": STRIPE_199}
|
|
76
|
+
|
|
77
|
+
_check_rate_limit("camel_to_snake")
|
|
78
|
+
# First normalize to words
|
|
79
|
+
words = []
|
|
80
|
+
if '_' in text:
|
|
81
|
+
words = [w for w in text.split('_') if w]
|
|
82
|
+
elif '-' in text:
|
|
83
|
+
words = [w for w in text.split('-') if w]
|
|
84
|
+
else:
|
|
85
|
+
parts = re.sub(r'([A-Z])', r' \1', text).strip().split()
|
|
86
|
+
words = [w.lower() for w in parts if w]
|
|
87
|
+
if not words:
|
|
88
|
+
words = [text.lower()]
|
|
89
|
+
results = {}
|
|
90
|
+
results["snake_case"] = '_'.join(w.lower() for w in words)
|
|
91
|
+
results["camelCase"] = words[0].lower() + ''.join(w.capitalize() for w in words[1:])
|
|
92
|
+
results["PascalCase"] = ''.join(w.capitalize() for w in words)
|
|
93
|
+
results["kebab-case"] = '-'.join(w.lower() for w in words)
|
|
94
|
+
results["CONSTANT_CASE"] = '_'.join(w.upper() for w in words)
|
|
95
|
+
target_map = {"camel_to_snake": "snake_case", "snake_to_camel": "camelCase",
|
|
96
|
+
"to_kebab": "kebab-case", "to_pascal": "PascalCase", "to_constant": "CONSTANT_CASE"}
|
|
97
|
+
target = target_map.get(direction, "snake_case")
|
|
98
|
+
return {"result": results[target], "direction": direction, "all_formats": results, "words": words}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@mcp.tool()
|
|
102
|
+
def truncate_smart(text: str, max_length: int = 100, suffix: str = "...", preserve_words: bool = True, api_key: str = "") -> dict:
|
|
103
|
+
"""Smartly truncate text at word boundaries with a suffix.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
text: Text to truncate
|
|
107
|
+
max_length: Maximum length including suffix (default 100)
|
|
108
|
+
suffix: Suffix to append when truncated (default '...')
|
|
109
|
+
preserve_words: Don't break mid-word (default True)
|
|
110
|
+
"""
|
|
111
|
+
allowed, msg, tier = check_access(api_key)
|
|
112
|
+
if not allowed:
|
|
113
|
+
return {"error": msg, "upgrade_url": STRIPE_199}
|
|
114
|
+
|
|
115
|
+
_check_rate_limit("truncate_smart")
|
|
116
|
+
if len(text) <= max_length:
|
|
117
|
+
return {"text": text, "truncated": False, "original_length": len(text)}
|
|
118
|
+
target_len = max_length - len(suffix)
|
|
119
|
+
if target_len <= 0:
|
|
120
|
+
return {"text": suffix[:max_length], "truncated": True, "original_length": len(text)}
|
|
121
|
+
truncated = text[:target_len]
|
|
122
|
+
if preserve_words and ' ' in truncated:
|
|
123
|
+
last_space = truncated.rfind(' ')
|
|
124
|
+
if last_space > target_len * 0.5:
|
|
125
|
+
truncated = truncated[:last_space]
|
|
126
|
+
truncated = truncated.rstrip(' .,;:!?-')
|
|
127
|
+
result = truncated + suffix
|
|
128
|
+
return {"text": result, "truncated": True, "original_length": len(text),
|
|
129
|
+
"result_length": len(result), "chars_removed": len(text) - len(truncated)}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@mcp.tool()
|
|
133
|
+
def extract_numbers(text: str, include_decimals: bool = True, include_negative: bool = True, api_key: str = "") -> dict:
|
|
134
|
+
"""Extract all numbers from text.
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
text: Text to extract numbers from
|
|
138
|
+
include_decimals: Include decimal numbers (default True)
|
|
139
|
+
include_negative: Include negative numbers (default True)
|
|
140
|
+
"""
|
|
141
|
+
allowed, msg, tier = check_access(api_key)
|
|
142
|
+
if not allowed:
|
|
143
|
+
return {"error": msg, "upgrade_url": STRIPE_199}
|
|
144
|
+
|
|
145
|
+
_check_rate_limit("extract_numbers")
|
|
146
|
+
if include_negative and include_decimals:
|
|
147
|
+
pattern = r'-?\d+\.?\d*'
|
|
148
|
+
elif include_decimals:
|
|
149
|
+
pattern = r'\d+\.?\d*'
|
|
150
|
+
elif include_negative:
|
|
151
|
+
pattern = r'-?\d+'
|
|
152
|
+
else:
|
|
153
|
+
pattern = r'\d+'
|
|
154
|
+
matches = re.findall(pattern, text)
|
|
155
|
+
numbers = []
|
|
156
|
+
for m in matches:
|
|
157
|
+
try:
|
|
158
|
+
if '.' in m:
|
|
159
|
+
numbers.append(float(m))
|
|
160
|
+
else:
|
|
161
|
+
numbers.append(int(m))
|
|
162
|
+
except ValueError:
|
|
163
|
+
pass
|
|
164
|
+
stats = {}
|
|
165
|
+
if numbers:
|
|
166
|
+
stats = {"min": min(numbers), "max": max(numbers),
|
|
167
|
+
"sum": sum(numbers), "average": sum(numbers) / len(numbers)}
|
|
168
|
+
return {"numbers": numbers, "count": len(numbers), "statistics": stats}
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def main():
|
|
172
|
+
mcp.run()
|
|
173
|
+
|
|
174
|
+
if __name__ == '__main__':
|
|
175
|
+
main()
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: string-utils-ai-mcp
|
|
2
|
+
description: 'String Utils Ai tools for AI agents. Capabilities: slugify, camel to
|
|
3
|
+
snake, truncate smart. Built by MEOK AI Labs.'
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tools:
|
|
6
|
+
- name: slugify
|
|
7
|
+
description: Convert text to a URL-friendly slug.
|
|
8
|
+
parameters:
|
|
9
|
+
- name: text
|
|
10
|
+
type: string
|
|
11
|
+
required: true
|
|
12
|
+
- name: separator
|
|
13
|
+
type: string
|
|
14
|
+
required: false
|
|
15
|
+
- name: max_length
|
|
16
|
+
type: integer
|
|
17
|
+
required: false
|
|
18
|
+
- name: lowercase
|
|
19
|
+
type: boolean
|
|
20
|
+
required: false
|
|
21
|
+
- name: camel_to_snake
|
|
22
|
+
description: Convert between camelCase, snake_case, kebab-case, and PascalCase.
|
|
23
|
+
parameters:
|
|
24
|
+
- name: text
|
|
25
|
+
type: string
|
|
26
|
+
required: true
|
|
27
|
+
- name: direction
|
|
28
|
+
type: string
|
|
29
|
+
required: false
|
|
30
|
+
- name: truncate_smart
|
|
31
|
+
description: Smartly truncate text at word boundaries with a suffix.
|
|
32
|
+
parameters:
|
|
33
|
+
- name: text
|
|
34
|
+
type: string
|
|
35
|
+
required: true
|
|
36
|
+
- name: max_length
|
|
37
|
+
type: integer
|
|
38
|
+
required: false
|
|
39
|
+
- name: suffix
|
|
40
|
+
type: string
|
|
41
|
+
required: false
|
|
42
|
+
- name: preserve_words
|
|
43
|
+
type: boolean
|
|
44
|
+
required: false
|
|
45
|
+
- name: extract_numbers
|
|
46
|
+
description: Extract all numbers from text.
|
|
47
|
+
parameters:
|
|
48
|
+
- name: text
|
|
49
|
+
type: string
|
|
50
|
+
required: true
|
|
51
|
+
- name: include_decimals
|
|
52
|
+
type: boolean
|
|
53
|
+
required: false
|
|
54
|
+
- name: include_negative
|
|
55
|
+
type: boolean
|
|
56
|
+
required: false
|
|
@@ -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()
|