voiddo-mcp 1.1.3__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.
- voiddo_mcp-1.1.3/LICENSE +21 -0
- voiddo_mcp-1.1.3/PKG-INFO +92 -0
- voiddo_mcp-1.1.3/README.md +71 -0
- voiddo_mcp-1.1.3/pyproject.toml +37 -0
- voiddo_mcp-1.1.3/setup.cfg +4 -0
- voiddo_mcp-1.1.3/src/voiddo_mcp/__init__.py +5 -0
- voiddo_mcp-1.1.3/src/voiddo_mcp/__main__.py +3 -0
- voiddo_mcp-1.1.3/src/voiddo_mcp/cli.py +57 -0
- voiddo_mcp-1.1.3/src/voiddo_mcp/proxy.py +252 -0
- voiddo_mcp-1.1.3/src/voiddo_mcp/py.typed +0 -0
- voiddo_mcp-1.1.3/src/voiddo_mcp.egg-info/PKG-INFO +92 -0
- voiddo_mcp-1.1.3/src/voiddo_mcp.egg-info/SOURCES.txt +13 -0
- voiddo_mcp-1.1.3/src/voiddo_mcp.egg-info/dependency_links.txt +1 -0
- voiddo_mcp-1.1.3/src/voiddo_mcp.egg-info/entry_points.txt +2 -0
- voiddo_mcp-1.1.3/src/voiddo_mcp.egg-info/top_level.txt +1 -0
voiddo_mcp-1.1.3/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 voiddo studio
|
|
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.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: voiddo-mcp
|
|
3
|
+
Version: 1.1.3
|
|
4
|
+
Summary: stdio proxy for the vøiddo utilities MCP server (data.voiddo.com): file conversion, rendering, validation and lookup tools for agents.
|
|
5
|
+
Author-email: voiddo studio <data@voiddo.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://data.voiddo.com
|
|
8
|
+
Project-URL: Documentation, https://data.voiddo.com/llms.txt
|
|
9
|
+
Project-URL: MCP discovery, https://data.voiddo.com/.well-known/mcp.json
|
|
10
|
+
Keywords: mcp,model-context-protocol,pdf,qr-code,image-convert,csv,json-schema,dns,agents
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# voiddo-mcp
|
|
23
|
+
|
|
24
|
+
stdio MCP server for the **vøiddo utilities** at <https://data.voiddo.com>: 26 deterministic tools for agents and developers
|
|
25
|
+
(PDF merge / split / text / info, image and SVG conversion, QR codes, HTML to PDF or image, Markdown rendering, CSV / Excel /
|
|
26
|
+
JSON / YAML conversion, JSON Schema validation, DNS / RDAP / IP / currency / holiday / ISO-code / time-zone lookups).
|
|
27
|
+
|
|
28
|
+
This package is a thin proxy: it reads MCP messages on stdin, POSTs them to `https://data.voiddo.com/mcp` (streamable HTTP, stateless)
|
|
29
|
+
and writes the answers to stdout. It has no dependencies beyond the Python standard library. Clients that speak streamable HTTP
|
|
30
|
+
can skip it and connect to the endpoint directly.
|
|
31
|
+
|
|
32
|
+
<!-- mcp-name: com.voiddo.data/utilities -->
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
PyPI and npm packages are not published yet. Until they are, install from the files served by the API:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# run once, no install (needs uv):
|
|
40
|
+
uvx --from https://data.voiddo.com/sdk/voiddo_mcp-1.1.3-py3-none-any.whl voiddo-mcp --check
|
|
41
|
+
# or install:
|
|
42
|
+
pip install https://data.voiddo.com/sdk/voiddo_mcp-1.1.3-py3-none-any.whl
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The current file names and checksums are listed at <https://data.voiddo.com/sdk/>.
|
|
46
|
+
|
|
47
|
+
## Configure a client
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"voiddo": {
|
|
53
|
+
"command": "uvx",
|
|
54
|
+
"args": ["--from", "https://data.voiddo.com/sdk/voiddo_mcp-1.1.3-py3-none-any.whl", "voiddo-mcp"],
|
|
55
|
+
"env": { "VOIDDO_API_KEY": "vd_..." }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`VOIDDO_API_KEY` is optional. Without it you are on the free tier: 20 calls per day per IP address. With it, calls draw prepaid
|
|
62
|
+
credits from the key's wallet (packs: $5 = 500, $9 = 1,000, $29 = 4,000 credits; most tools cost 1 credit and each tool's
|
|
63
|
+
description states its price). Create a key with `curl -X POST https://data.voiddo.com/v1/keys`. When a tool answers
|
|
64
|
+
`payment_required`, its `checkout_url` leads to the credit packs.
|
|
65
|
+
|
|
66
|
+
Without any install, the same server is reachable directly, for example in Claude Code:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
claude mcp add --transport http voiddo https://data.voiddo.com/mcp --header "Authorization: Bearer vd_..."
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Options
|
|
73
|
+
|
|
74
|
+
| Flag / variable | Meaning |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| `VOIDDO_API_KEY` | API key (sent as `Authorization: Bearer ...`). Prefer the variable to `--api-key`: command lines are visible to other users. |
|
|
77
|
+
| `VOIDDO_BASE_URL`, `--base-url` | server root, default `https://data.voiddo.com` (`/mcp` is appended) |
|
|
78
|
+
| `--header NAME:VALUE` | extra HTTP header, repeatable |
|
|
79
|
+
| `MINT_TIMEOUT`, `--timeout` | seconds per request, default 120 |
|
|
80
|
+
| `--check` | connect once, print a JSON report (server, protocol version, tool count) and exit |
|
|
81
|
+
| `--verbose` | log HTTP status lines to stderr (never the key) |
|
|
82
|
+
|
|
83
|
+
Redirects are never followed, so the key cannot leak to another host.
|
|
84
|
+
|
|
85
|
+
## Limits worth knowing
|
|
86
|
+
|
|
87
|
+
* File inputs are base64 strings or `{"url": "https://..."}`; a request body is limited to 10 MiB.
|
|
88
|
+
* Results that are files (images, PDFs, ...) are returned inline up to 1 MiB over MCP; larger ones are refused and not charged. The
|
|
89
|
+
HTTP API (`POST /v1/<tool>?download=1`) returns files up to 32 MiB.
|
|
90
|
+
* The free tier counts per client IP. Behind a shared gateway every user shares one address, so use an API key there.
|
|
91
|
+
|
|
92
|
+
Support: data@voiddo.com. MIT licence.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# voiddo-mcp
|
|
2
|
+
|
|
3
|
+
stdio MCP server for the **vøiddo utilities** at <https://data.voiddo.com>: 26 deterministic tools for agents and developers
|
|
4
|
+
(PDF merge / split / text / info, image and SVG conversion, QR codes, HTML to PDF or image, Markdown rendering, CSV / Excel /
|
|
5
|
+
JSON / YAML conversion, JSON Schema validation, DNS / RDAP / IP / currency / holiday / ISO-code / time-zone lookups).
|
|
6
|
+
|
|
7
|
+
This package is a thin proxy: it reads MCP messages on stdin, POSTs them to `https://data.voiddo.com/mcp` (streamable HTTP, stateless)
|
|
8
|
+
and writes the answers to stdout. It has no dependencies beyond the Python standard library. Clients that speak streamable HTTP
|
|
9
|
+
can skip it and connect to the endpoint directly.
|
|
10
|
+
|
|
11
|
+
<!-- mcp-name: com.voiddo.data/utilities -->
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
PyPI and npm packages are not published yet. Until they are, install from the files served by the API:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# run once, no install (needs uv):
|
|
19
|
+
uvx --from https://data.voiddo.com/sdk/voiddo_mcp-1.1.3-py3-none-any.whl voiddo-mcp --check
|
|
20
|
+
# or install:
|
|
21
|
+
pip install https://data.voiddo.com/sdk/voiddo_mcp-1.1.3-py3-none-any.whl
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The current file names and checksums are listed at <https://data.voiddo.com/sdk/>.
|
|
25
|
+
|
|
26
|
+
## Configure a client
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"voiddo": {
|
|
32
|
+
"command": "uvx",
|
|
33
|
+
"args": ["--from", "https://data.voiddo.com/sdk/voiddo_mcp-1.1.3-py3-none-any.whl", "voiddo-mcp"],
|
|
34
|
+
"env": { "VOIDDO_API_KEY": "vd_..." }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`VOIDDO_API_KEY` is optional. Without it you are on the free tier: 20 calls per day per IP address. With it, calls draw prepaid
|
|
41
|
+
credits from the key's wallet (packs: $5 = 500, $9 = 1,000, $29 = 4,000 credits; most tools cost 1 credit and each tool's
|
|
42
|
+
description states its price). Create a key with `curl -X POST https://data.voiddo.com/v1/keys`. When a tool answers
|
|
43
|
+
`payment_required`, its `checkout_url` leads to the credit packs.
|
|
44
|
+
|
|
45
|
+
Without any install, the same server is reachable directly, for example in Claude Code:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
claude mcp add --transport http voiddo https://data.voiddo.com/mcp --header "Authorization: Bearer vd_..."
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Options
|
|
52
|
+
|
|
53
|
+
| Flag / variable | Meaning |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| `VOIDDO_API_KEY` | API key (sent as `Authorization: Bearer ...`). Prefer the variable to `--api-key`: command lines are visible to other users. |
|
|
56
|
+
| `VOIDDO_BASE_URL`, `--base-url` | server root, default `https://data.voiddo.com` (`/mcp` is appended) |
|
|
57
|
+
| `--header NAME:VALUE` | extra HTTP header, repeatable |
|
|
58
|
+
| `MINT_TIMEOUT`, `--timeout` | seconds per request, default 120 |
|
|
59
|
+
| `--check` | connect once, print a JSON report (server, protocol version, tool count) and exit |
|
|
60
|
+
| `--verbose` | log HTTP status lines to stderr (never the key) |
|
|
61
|
+
|
|
62
|
+
Redirects are never followed, so the key cannot leak to another host.
|
|
63
|
+
|
|
64
|
+
## Limits worth knowing
|
|
65
|
+
|
|
66
|
+
* File inputs are base64 strings or `{"url": "https://..."}`; a request body is limited to 10 MiB.
|
|
67
|
+
* Results that are files (images, PDFs, ...) are returned inline up to 1 MiB over MCP; larger ones are refused and not charged. The
|
|
68
|
+
HTTP API (`POST /v1/<tool>?download=1`) returns files up to 32 MiB.
|
|
69
|
+
* The free tier counts per client IP. Behind a shared gateway every user shares one address, so use an API key there.
|
|
70
|
+
|
|
71
|
+
Support: data@voiddo.com. MIT licence.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "voiddo-mcp"
|
|
7
|
+
version = "1.1.3"
|
|
8
|
+
description = "stdio proxy for the vøiddo utilities MCP server (data.voiddo.com): file conversion, rendering, validation and lookup tools for agents."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "voiddo studio", email = "data@voiddo.com" }]
|
|
14
|
+
keywords = ["mcp", "model-context-protocol", "pdf", "qr-code", "image-convert", "csv", "json-schema", "dns", "agents"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 5 - Production/Stable",
|
|
17
|
+
"Environment :: Console",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Topic :: Software Development :: Libraries",
|
|
22
|
+
]
|
|
23
|
+
dependencies = []
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://data.voiddo.com"
|
|
27
|
+
Documentation = "https://data.voiddo.com/llms.txt"
|
|
28
|
+
"MCP discovery" = "https://data.voiddo.com/.well-known/mcp.json"
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
voiddo-mcp = "voiddo_mcp.cli:main"
|
|
32
|
+
|
|
33
|
+
[tool.setuptools.packages.find]
|
|
34
|
+
where = ["src"]
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.package-data]
|
|
37
|
+
voiddo_mcp = ["py.typed"]
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Command line entry point: ``voiddo-mcp`` (stdio server) and ``voiddo-mcp --check``."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
from typing import List, Optional
|
|
9
|
+
|
|
10
|
+
from . import DEFAULT_BASE_URL, __version__
|
|
11
|
+
from .proxy import Proxy
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
15
|
+
p = argparse.ArgumentParser(
|
|
16
|
+
prog="voiddo-mcp",
|
|
17
|
+
description="stdio MCP server for the vøiddo utilities (file conversion, rendering, validation, lookups). "
|
|
18
|
+
"It forwards every message to the hosted endpoint; the API key is read from VOIDDO_API_KEY.",
|
|
19
|
+
epilog="The first 20 calls per day per IP are free without a key. Create a key: POST {base}/v1/keys. "
|
|
20
|
+
"Client config example: {\"command\": \"uvx\", \"args\": [\"voiddo-mcp\"], \"env\": {\"VOIDDO_API_KEY\": \"vd_...\"}}")
|
|
21
|
+
p.add_argument("--base-url", default=os.environ.get("VOIDDO_BASE_URL") or os.environ.get("MINT_BASE_URL") or DEFAULT_BASE_URL,
|
|
22
|
+
help="server root, default %(default)s (env VOIDDO_BASE_URL); '/mcp' is appended")
|
|
23
|
+
p.add_argument("--api-key", default=None,
|
|
24
|
+
help="API key (prefer the VOIDDO_API_KEY environment variable: command lines are visible to other users)")
|
|
25
|
+
p.add_argument("--header", action="append", default=[], metavar="NAME:VALUE", help="extra HTTP header (repeatable)")
|
|
26
|
+
p.add_argument("--timeout", type=float, default=float(os.environ.get("MINT_TIMEOUT") or 120),
|
|
27
|
+
help="seconds per request, default %(default)s (env MINT_TIMEOUT)")
|
|
28
|
+
p.add_argument("--check", action="store_true", help="connect once (initialize + tools/list), print a JSON report and exit")
|
|
29
|
+
p.add_argument("--verbose", action="store_true", help="log HTTP status lines to stderr")
|
|
30
|
+
p.add_argument("--version", action="version", version=f"voiddo-mcp {__version__}")
|
|
31
|
+
return p
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def parse_headers(items: List[str]) -> dict:
|
|
35
|
+
out = {}
|
|
36
|
+
for item in items:
|
|
37
|
+
name, sep, value = item.partition(":")
|
|
38
|
+
if not sep or not name.strip():
|
|
39
|
+
raise SystemExit(f"voiddo-mcp: --header expects NAME:VALUE, got {item!r}")
|
|
40
|
+
out[name.strip()] = value.strip()
|
|
41
|
+
return out
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def main(argv: Optional[List[str]] = None) -> int:
|
|
45
|
+
args = build_parser().parse_args(argv)
|
|
46
|
+
key = args.api_key or os.environ.get("VOIDDO_API_KEY") or os.environ.get("MINT_API_KEY")
|
|
47
|
+
proxy = Proxy(args.base_url, key, timeout=args.timeout, headers=parse_headers(args.header), verbose=args.verbose)
|
|
48
|
+
if args.check:
|
|
49
|
+
report = proxy.check()
|
|
50
|
+
proxy.close()
|
|
51
|
+
print(json.dumps(report, indent=2, ensure_ascii=False))
|
|
52
|
+
return 0 if report.get("ok") else 1
|
|
53
|
+
return proxy.run(sys.stdin.buffer)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
if __name__ == "__main__":
|
|
57
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"""The proxy core: newline-delimited JSON-RPC on stdio <-> POSTs to the streamable-HTTP endpoint. Standard library only.
|
|
2
|
+
|
|
3
|
+
The hosted server is stateless (see /.well-known/mcp.json): every POST is self-contained and answers with plain JSON, so this
|
|
4
|
+
process keeps no per-session state except the negotiated protocol version, which it echoes in the ``MCP-Protocol-Version`` header
|
|
5
|
+
like any streamable-HTTP client. It also understands what a stateful server would send (``Mcp-Session-Id``, SSE replies), so it
|
|
6
|
+
keeps working if the endpoint ever grows those.
|
|
7
|
+
|
|
8
|
+
Nothing but protocol messages is written to stdout; diagnostics go to stderr and never contain the API key.
|
|
9
|
+
"""
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import json
|
|
13
|
+
import sys
|
|
14
|
+
import threading
|
|
15
|
+
import urllib.error
|
|
16
|
+
import urllib.request
|
|
17
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
18
|
+
from typing import IO, Any, Dict, Iterable, List, Optional
|
|
19
|
+
|
|
20
|
+
from . import ENDPOINT_PATH, __version__
|
|
21
|
+
|
|
22
|
+
ERR_HTTP = -32000 # JSON-RPC "server error" range: the HTTP request failed or was refused
|
|
23
|
+
ERR_INTERNAL = -32603
|
|
24
|
+
ERR_PARSE = -32700
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class _NoRedirect(urllib.request.HTTPRedirectHandler):
|
|
28
|
+
"""Never follow a redirect: urllib would replay the Authorization header to wherever the Location points."""
|
|
29
|
+
|
|
30
|
+
def redirect_request(self, req, fp, code, msg, headers, newurl): # noqa: D401, ANN001
|
|
31
|
+
return None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def endpoint_url(base_url: str) -> str:
|
|
35
|
+
base = base_url.strip().rstrip("/")
|
|
36
|
+
return base if base.endswith(ENDPOINT_PATH) else base + ENDPOINT_PATH
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def sse_messages(text: str) -> Iterable[str]:
|
|
40
|
+
"""The ``data:`` payloads of a text/event-stream body, one string per event (multi-line data is joined with newlines)."""
|
|
41
|
+
data: List[str] = []
|
|
42
|
+
for raw in text.splitlines():
|
|
43
|
+
if not raw:
|
|
44
|
+
if data:
|
|
45
|
+
yield "\n".join(data)
|
|
46
|
+
data = []
|
|
47
|
+
elif raw.startswith("data:"):
|
|
48
|
+
data.append(raw[5:][1:] if raw[5:6] == " " else raw[5:])
|
|
49
|
+
if data:
|
|
50
|
+
yield "\n".join(data)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class Proxy:
|
|
54
|
+
def __init__(self, base_url: str, api_key: Optional[str] = None, *, timeout: float = 120.0,
|
|
55
|
+
headers: Optional[Dict[str, str]] = None, out: Optional[IO[str]] = None, err: Optional[IO[str]] = None,
|
|
56
|
+
verbose: bool = False, workers: int = 8):
|
|
57
|
+
self.url = endpoint_url(base_url)
|
|
58
|
+
self._api_key = (api_key or "").strip() or None
|
|
59
|
+
self.timeout = timeout
|
|
60
|
+
self.extra = dict(headers or {})
|
|
61
|
+
self.out = out if out is not None else sys.stdout
|
|
62
|
+
self.err = err if err is not None else sys.stderr
|
|
63
|
+
self.verbose = verbose
|
|
64
|
+
self.protocol_version: Optional[str] = None
|
|
65
|
+
self.session_id: Optional[str] = None
|
|
66
|
+
self._init_ids: set = set()
|
|
67
|
+
self._state = threading.Lock()
|
|
68
|
+
self._write_lock = threading.Lock()
|
|
69
|
+
self._pool = ThreadPoolExecutor(max_workers=max(1, workers), thread_name_prefix="voiddo-mcp")
|
|
70
|
+
self._opener = urllib.request.build_opener(_NoRedirect)
|
|
71
|
+
|
|
72
|
+
# ----- output -----------------------------------------------------------------------------------------------------
|
|
73
|
+
def log(self, text: str) -> None:
|
|
74
|
+
print(f"voiddo-mcp: {text}", file=self.err, flush=True)
|
|
75
|
+
|
|
76
|
+
def emit(self, message: Any) -> None:
|
|
77
|
+
line = json.dumps(message, ensure_ascii=False, separators=(",", ":"))
|
|
78
|
+
with self._write_lock:
|
|
79
|
+
self.out.write(line + "\n")
|
|
80
|
+
self.out.flush()
|
|
81
|
+
|
|
82
|
+
def _error(self, request_id: Any, code: int, message: str, data: Any = None) -> Dict[str, Any]:
|
|
83
|
+
err: Dict[str, Any] = {"code": code, "message": message}
|
|
84
|
+
if data is not None:
|
|
85
|
+
err["data"] = data
|
|
86
|
+
return {"jsonrpc": "2.0", "id": request_id, "error": err}
|
|
87
|
+
|
|
88
|
+
# ----- one message ------------------------------------------------------------------------------------------------
|
|
89
|
+
def headers(self) -> Dict[str, str]:
|
|
90
|
+
h = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream",
|
|
91
|
+
"User-Agent": f"voiddo-mcp/{__version__}"}
|
|
92
|
+
h.update(self.extra)
|
|
93
|
+
if self._api_key:
|
|
94
|
+
h["Authorization"] = f"Bearer {self._api_key}"
|
|
95
|
+
with self._state:
|
|
96
|
+
if self.protocol_version:
|
|
97
|
+
h["MCP-Protocol-Version"] = self.protocol_version
|
|
98
|
+
if self.session_id:
|
|
99
|
+
h["Mcp-Session-Id"] = self.session_id
|
|
100
|
+
return h
|
|
101
|
+
|
|
102
|
+
def _requests_in(self, message: Any) -> List[Dict[str, Any]]:
|
|
103
|
+
items = message if isinstance(message, list) else [message]
|
|
104
|
+
return [m for m in items if isinstance(m, dict) and "method" in m and "id" in m]
|
|
105
|
+
|
|
106
|
+
def forward(self, message: Any) -> List[Any]:
|
|
107
|
+
"""POST one JSON-RPC message (or batch); return the messages to write to stdout. Never raises."""
|
|
108
|
+
requests = self._requests_in(message)
|
|
109
|
+
body = json.dumps(message, ensure_ascii=False, separators=(",", ":")).encode("utf-8")
|
|
110
|
+
req = urllib.request.Request(self.url, data=body, headers=self.headers(), method="POST")
|
|
111
|
+
try:
|
|
112
|
+
with self._opener.open(req, timeout=self.timeout) as resp:
|
|
113
|
+
status = resp.status
|
|
114
|
+
ctype = (resp.headers.get("Content-Type") or "").split(";")[0].strip().lower()
|
|
115
|
+
sid = resp.headers.get("Mcp-Session-Id")
|
|
116
|
+
payload = resp.read()
|
|
117
|
+
except urllib.error.HTTPError as e:
|
|
118
|
+
status, ctype, sid = e.code, (e.headers.get("Content-Type") or "").split(";")[0].strip().lower(), None
|
|
119
|
+
payload = e.read() if hasattr(e, "read") else b""
|
|
120
|
+
return self._http_failure(requests, status, ctype, payload)
|
|
121
|
+
except (urllib.error.URLError, OSError, ValueError) as e:
|
|
122
|
+
reason = getattr(e, "reason", e)
|
|
123
|
+
self.log(f"request failed: {type(reason).__name__}: {reason}")
|
|
124
|
+
return [self._error(r["id"], ERR_HTTP, f"cannot reach {self.url}: {reason}") for r in requests]
|
|
125
|
+
if self.verbose:
|
|
126
|
+
self.log(f"POST {self.url} -> {status} {ctype}")
|
|
127
|
+
if sid:
|
|
128
|
+
with self._state:
|
|
129
|
+
self.session_id = sid
|
|
130
|
+
text = payload.decode("utf-8", "replace")
|
|
131
|
+
if status == 202 or not text.strip():
|
|
132
|
+
return []
|
|
133
|
+
try:
|
|
134
|
+
if ctype == "text/event-stream":
|
|
135
|
+
out: List[Any] = []
|
|
136
|
+
for data in sse_messages(text):
|
|
137
|
+
out.extend(self._as_list(json.loads(data)))
|
|
138
|
+
else:
|
|
139
|
+
out = self._as_list(json.loads(text))
|
|
140
|
+
except ValueError:
|
|
141
|
+
self.log(f"unparseable {ctype or 'response'} from the server (status {status})")
|
|
142
|
+
return [self._error(r["id"], ERR_PARSE, f"the server answered with something that is not JSON (HTTP {status})")
|
|
143
|
+
for r in requests]
|
|
144
|
+
self._learn(message, out)
|
|
145
|
+
return out
|
|
146
|
+
|
|
147
|
+
@staticmethod
|
|
148
|
+
def _as_list(parsed: Any) -> List[Any]:
|
|
149
|
+
return parsed if isinstance(parsed, list) else [parsed]
|
|
150
|
+
|
|
151
|
+
def _http_failure(self, requests: List[Dict[str, Any]], status: int, ctype: str, payload: bytes) -> List[Any]:
|
|
152
|
+
text = payload.decode("utf-8", "replace")
|
|
153
|
+
if ctype == "application/json":
|
|
154
|
+
try:
|
|
155
|
+
parsed = json.loads(text)
|
|
156
|
+
found = [m for m in self._as_list(parsed) if isinstance(m, dict) and ("error" in m or "result" in m)
|
|
157
|
+
and "jsonrpc" in m]
|
|
158
|
+
if found: # the server spoke JSON-RPC: pass its error through
|
|
159
|
+
return found
|
|
160
|
+
detail = parsed.get("message") if isinstance(parsed, dict) else None
|
|
161
|
+
except ValueError:
|
|
162
|
+
detail = None
|
|
163
|
+
else:
|
|
164
|
+
detail = None
|
|
165
|
+
if ctype in ("text/html", "application/xhtml+xml"): # a gateway error page: markup is no use to an agent
|
|
166
|
+
text = ""
|
|
167
|
+
message = f"HTTP {status} from {self.url}" + (f": {detail}" if detail else (f": {text[:200].strip()}" if text.strip() else ""))
|
|
168
|
+
if status == 401:
|
|
169
|
+
message += " (check VOIDDO_API_KEY)"
|
|
170
|
+
elif 300 <= status < 400:
|
|
171
|
+
message += " (redirects are not followed; use the exact endpoint URL)"
|
|
172
|
+
self.log(message)
|
|
173
|
+
return [self._error(r["id"], ERR_HTTP, message, {"http_status": status}) for r in requests]
|
|
174
|
+
|
|
175
|
+
def _learn(self, sent: Any, received: List[Any]) -> None:
|
|
176
|
+
"""Remember the protocol version the server picked in its initialize result."""
|
|
177
|
+
init_ids = {m.get("id") for m in self._requests_in(sent) if m.get("method") == "initialize"}
|
|
178
|
+
if not init_ids:
|
|
179
|
+
return
|
|
180
|
+
for m in received:
|
|
181
|
+
if isinstance(m, dict) and m.get("id") in init_ids and isinstance(m.get("result"), dict):
|
|
182
|
+
version = m["result"].get("protocolVersion")
|
|
183
|
+
if isinstance(version, str):
|
|
184
|
+
with self._state:
|
|
185
|
+
self.protocol_version = version
|
|
186
|
+
|
|
187
|
+
# ----- the loop ---------------------------------------------------------------------------------------------------
|
|
188
|
+
def handle_line(self, line: str) -> None:
|
|
189
|
+
try:
|
|
190
|
+
message = json.loads(line)
|
|
191
|
+
except ValueError:
|
|
192
|
+
self.emit(self._error(None, ERR_PARSE, "parse error: the line is not valid JSON"))
|
|
193
|
+
return
|
|
194
|
+
if not isinstance(message, (dict, list)):
|
|
195
|
+
self.emit(self._error(None, -32600, "invalid request"))
|
|
196
|
+
return
|
|
197
|
+
for reply in self.forward(message):
|
|
198
|
+
self.emit(reply)
|
|
199
|
+
|
|
200
|
+
def run(self, stdin: Optional[IO[bytes]] = None) -> int:
|
|
201
|
+
stream = stdin if stdin is not None else sys.stdin.buffer
|
|
202
|
+
pending = []
|
|
203
|
+
try:
|
|
204
|
+
for raw in iter(stream.readline, b""):
|
|
205
|
+
line = raw.decode("utf-8", "replace").strip()
|
|
206
|
+
if not line:
|
|
207
|
+
continue
|
|
208
|
+
pending.append(self._pool.submit(self._guarded, line))
|
|
209
|
+
pending = [f for f in pending if not f.done()]
|
|
210
|
+
except KeyboardInterrupt:
|
|
211
|
+
pass
|
|
212
|
+
finally:
|
|
213
|
+
for f in pending:
|
|
214
|
+
f.result()
|
|
215
|
+
self.close()
|
|
216
|
+
return 0
|
|
217
|
+
|
|
218
|
+
def _guarded(self, line: str) -> None:
|
|
219
|
+
try:
|
|
220
|
+
self.handle_line(line)
|
|
221
|
+
except Exception as e: # noqa: BLE001 - one bad message must not end the session
|
|
222
|
+
self.log(f"internal error: {type(e).__name__}: {e}")
|
|
223
|
+
|
|
224
|
+
def close(self) -> None:
|
|
225
|
+
self._pool.shutdown(wait=True)
|
|
226
|
+
with self._state:
|
|
227
|
+
sid = self.session_id
|
|
228
|
+
if sid: # a stateful server: end the session (best effort)
|
|
229
|
+
try:
|
|
230
|
+
req = urllib.request.Request(self.url, headers={**self.headers(), "Mcp-Session-Id": sid}, method="DELETE")
|
|
231
|
+
self._opener.open(req, timeout=10).close()
|
|
232
|
+
except (urllib.error.URLError, OSError, ValueError):
|
|
233
|
+
pass
|
|
234
|
+
|
|
235
|
+
# ----- self test --------------------------------------------------------------------------------------------------
|
|
236
|
+
def check(self) -> Dict[str, Any]:
|
|
237
|
+
"""initialize + tools/list against the endpoint; returns a small report (used by ``voiddo-mcp --check``)."""
|
|
238
|
+
init = {"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {
|
|
239
|
+
"protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "voiddo-mcp-check", "version": __version__}}}
|
|
240
|
+
first = self.forward(init)
|
|
241
|
+
info = next((m for m in first if isinstance(m, dict) and "result" in m), None)
|
|
242
|
+
if info is None:
|
|
243
|
+
err = next((m.get("error", {}).get("message") for m in first if isinstance(m, dict) and "error" in m), "no answer")
|
|
244
|
+
return {"ok": False, "endpoint": self.url, "error": err}
|
|
245
|
+
self.forward({"jsonrpc": "2.0", "method": "notifications/initialized"})
|
|
246
|
+
listed = self.forward({"jsonrpc": "2.0", "id": 2, "method": "tools/list"})
|
|
247
|
+
tools = next((m["result"].get("tools", []) for m in listed if isinstance(m, dict) and "result" in m), None)
|
|
248
|
+
if tools is None:
|
|
249
|
+
return {"ok": False, "endpoint": self.url, "error": "tools/list failed"}
|
|
250
|
+
return {"ok": True, "endpoint": self.url, "server": info["result"].get("serverInfo"),
|
|
251
|
+
"protocol_version": info["result"].get("protocolVersion"), "tools": len(tools),
|
|
252
|
+
"authenticated": bool(self._api_key)}
|
|
File without changes
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: voiddo-mcp
|
|
3
|
+
Version: 1.1.3
|
|
4
|
+
Summary: stdio proxy for the vøiddo utilities MCP server (data.voiddo.com): file conversion, rendering, validation and lookup tools for agents.
|
|
5
|
+
Author-email: voiddo studio <data@voiddo.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://data.voiddo.com
|
|
8
|
+
Project-URL: Documentation, https://data.voiddo.com/llms.txt
|
|
9
|
+
Project-URL: MCP discovery, https://data.voiddo.com/.well-known/mcp.json
|
|
10
|
+
Keywords: mcp,model-context-protocol,pdf,qr-code,image-convert,csv,json-schema,dns,agents
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# voiddo-mcp
|
|
23
|
+
|
|
24
|
+
stdio MCP server for the **vøiddo utilities** at <https://data.voiddo.com>: 26 deterministic tools for agents and developers
|
|
25
|
+
(PDF merge / split / text / info, image and SVG conversion, QR codes, HTML to PDF or image, Markdown rendering, CSV / Excel /
|
|
26
|
+
JSON / YAML conversion, JSON Schema validation, DNS / RDAP / IP / currency / holiday / ISO-code / time-zone lookups).
|
|
27
|
+
|
|
28
|
+
This package is a thin proxy: it reads MCP messages on stdin, POSTs them to `https://data.voiddo.com/mcp` (streamable HTTP, stateless)
|
|
29
|
+
and writes the answers to stdout. It has no dependencies beyond the Python standard library. Clients that speak streamable HTTP
|
|
30
|
+
can skip it and connect to the endpoint directly.
|
|
31
|
+
|
|
32
|
+
<!-- mcp-name: com.voiddo.data/utilities -->
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
PyPI and npm packages are not published yet. Until they are, install from the files served by the API:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# run once, no install (needs uv):
|
|
40
|
+
uvx --from https://data.voiddo.com/sdk/voiddo_mcp-1.1.3-py3-none-any.whl voiddo-mcp --check
|
|
41
|
+
# or install:
|
|
42
|
+
pip install https://data.voiddo.com/sdk/voiddo_mcp-1.1.3-py3-none-any.whl
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The current file names and checksums are listed at <https://data.voiddo.com/sdk/>.
|
|
46
|
+
|
|
47
|
+
## Configure a client
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"voiddo": {
|
|
53
|
+
"command": "uvx",
|
|
54
|
+
"args": ["--from", "https://data.voiddo.com/sdk/voiddo_mcp-1.1.3-py3-none-any.whl", "voiddo-mcp"],
|
|
55
|
+
"env": { "VOIDDO_API_KEY": "vd_..." }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`VOIDDO_API_KEY` is optional. Without it you are on the free tier: 20 calls per day per IP address. With it, calls draw prepaid
|
|
62
|
+
credits from the key's wallet (packs: $5 = 500, $9 = 1,000, $29 = 4,000 credits; most tools cost 1 credit and each tool's
|
|
63
|
+
description states its price). Create a key with `curl -X POST https://data.voiddo.com/v1/keys`. When a tool answers
|
|
64
|
+
`payment_required`, its `checkout_url` leads to the credit packs.
|
|
65
|
+
|
|
66
|
+
Without any install, the same server is reachable directly, for example in Claude Code:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
claude mcp add --transport http voiddo https://data.voiddo.com/mcp --header "Authorization: Bearer vd_..."
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Options
|
|
73
|
+
|
|
74
|
+
| Flag / variable | Meaning |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| `VOIDDO_API_KEY` | API key (sent as `Authorization: Bearer ...`). Prefer the variable to `--api-key`: command lines are visible to other users. |
|
|
77
|
+
| `VOIDDO_BASE_URL`, `--base-url` | server root, default `https://data.voiddo.com` (`/mcp` is appended) |
|
|
78
|
+
| `--header NAME:VALUE` | extra HTTP header, repeatable |
|
|
79
|
+
| `MINT_TIMEOUT`, `--timeout` | seconds per request, default 120 |
|
|
80
|
+
| `--check` | connect once, print a JSON report (server, protocol version, tool count) and exit |
|
|
81
|
+
| `--verbose` | log HTTP status lines to stderr (never the key) |
|
|
82
|
+
|
|
83
|
+
Redirects are never followed, so the key cannot leak to another host.
|
|
84
|
+
|
|
85
|
+
## Limits worth knowing
|
|
86
|
+
|
|
87
|
+
* File inputs are base64 strings or `{"url": "https://..."}`; a request body is limited to 10 MiB.
|
|
88
|
+
* Results that are files (images, PDFs, ...) are returned inline up to 1 MiB over MCP; larger ones are refused and not charged. The
|
|
89
|
+
HTTP API (`POST /v1/<tool>?download=1`) returns files up to 32 MiB.
|
|
90
|
+
* The free tier counts per client IP. Behind a shared gateway every user shares one address, so use an API key there.
|
|
91
|
+
|
|
92
|
+
Support: data@voiddo.com. MIT licence.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/voiddo_mcp/__init__.py
|
|
5
|
+
src/voiddo_mcp/__main__.py
|
|
6
|
+
src/voiddo_mcp/cli.py
|
|
7
|
+
src/voiddo_mcp/proxy.py
|
|
8
|
+
src/voiddo_mcp/py.typed
|
|
9
|
+
src/voiddo_mcp.egg-info/PKG-INFO
|
|
10
|
+
src/voiddo_mcp.egg-info/SOURCES.txt
|
|
11
|
+
src/voiddo_mcp.egg-info/dependency_links.txt
|
|
12
|
+
src/voiddo_mcp.egg-info/entry_points.txt
|
|
13
|
+
src/voiddo_mcp.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
voiddo_mcp
|