agentrender-mcp 0.1.0__py3-none-any.whl

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,3 @@
1
+ """AgentRender MCP stdio server — screenshot, pdf, extract."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env python3
2
+ """AgentRender MCP server (stdio) — tools: screenshot, pdf, extract.
3
+
4
+ Calls the AgentRender HTTP API. Configure:
5
+
6
+ AGENTRENDER_BASE_URL default https://api.agentrenderapi.com
7
+ AGENTRENDER_API_KEY Bearer token (required for production)
8
+
9
+ Run (stdio):
10
+
11
+ export AGENTRENDER_API_KEY=akr_…
12
+ python -m agentrender_mcp.server
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import base64
18
+ import os
19
+ from typing import Any
20
+
21
+ import httpx
22
+ from mcp.server.fastmcp import FastMCP
23
+
24
+ mcp = FastMCP(
25
+ "agentrender",
26
+ instructions=(
27
+ "AgentRender tools: capture URL screenshots/PDFs and extract main content. "
28
+ "Set AGENTRENDER_API_KEY and optionally AGENTRENDER_BASE_URL "
29
+ "(default https://api.agentrenderapi.com)."
30
+ ),
31
+ )
32
+
33
+
34
+ def _base_url() -> str:
35
+ return os.getenv("AGENTRENDER_BASE_URL", "https://api.agentrenderapi.com").rstrip("/")
36
+
37
+
38
+ def _api_key() -> str:
39
+ key = os.getenv("AGENTRENDER_API_KEY", "").strip()
40
+ if key:
41
+ return key
42
+ raw = os.getenv("RENDER_API_KEYS", "").strip()
43
+ if raw:
44
+ return raw.split(",")[0].strip()
45
+ return ""
46
+
47
+
48
+ def _headers() -> dict[str, str]:
49
+ headers = {
50
+ "Content-Type": "application/json",
51
+ "Accept": "application/json",
52
+ }
53
+ key = _api_key()
54
+ if key:
55
+ headers["Authorization"] = f"Bearer {key}"
56
+ return headers
57
+
58
+
59
+ def _post(path: str, body: dict[str, Any], *, timeout: float = 90.0) -> dict[str, Any]:
60
+ if not _api_key():
61
+ raise RuntimeError(
62
+ "AGENTRENDER_API_KEY is not set. Get a key via https://agentrenderapi.com "
63
+ "or your waitlist welcome email."
64
+ )
65
+ url = f"{_base_url()}{path}"
66
+ with httpx.Client(timeout=timeout) as client:
67
+ resp = client.post(url, json=body, headers=_headers())
68
+ try:
69
+ data = resp.json()
70
+ except Exception:
71
+ data = {"ok": False, "error": {"code": "bad_response", "message": resp.text[:500]}}
72
+ if resp.status_code >= 400:
73
+ err = data.get("error") if isinstance(data, dict) else None
74
+ msg = err.get("message") if isinstance(err, dict) else resp.text[:300]
75
+ raise RuntimeError(f"HTTP {resp.status_code}: {msg}")
76
+ return data # type: ignore[return-value]
77
+
78
+
79
+ @mcp.tool()
80
+ def screenshot(
81
+ url: str,
82
+ format: str = "png",
83
+ full_page: bool = False,
84
+ width: int = 1280,
85
+ height: int = 720,
86
+ ) -> dict[str, Any]:
87
+ """Capture a public URL as an image (PNG/JPEG/WebP). Returns JSON with image_base64 + receipt."""
88
+ body = {
89
+ "url": url,
90
+ "format": format,
91
+ "full_page": full_page,
92
+ "viewport": {"width": width, "height": height},
93
+ }
94
+ data = _post("/v1/screenshot", body)
95
+ if isinstance(data, dict) and data.get("image_base64"):
96
+ b64 = data["image_base64"]
97
+ data = {
98
+ **data,
99
+ "image_base64": b64,
100
+ "image_bytes_approx": len(base64.b64decode(b64)) if b64 else 0,
101
+ }
102
+ return data
103
+
104
+
105
+ @mcp.tool()
106
+ def pdf(url: str, print_background: bool = True, landscape: bool = False) -> dict[str, Any]:
107
+ """Capture a public URL as a PDF. Returns JSON with pdf_base64 + receipt."""
108
+ body = {
109
+ "url": url,
110
+ "print_background": print_background,
111
+ "landscape": landscape,
112
+ }
113
+ data = _post("/v1/pdf", body)
114
+ if isinstance(data, dict) and data.get("pdf_base64"):
115
+ b64 = data["pdf_base64"]
116
+ data = {
117
+ **data,
118
+ "pdf_base64": b64,
119
+ "pdf_bytes_approx": len(base64.b64decode(b64)) if b64 else 0,
120
+ }
121
+ return data
122
+
123
+
124
+ @mcp.tool()
125
+ def extract(
126
+ url: str,
127
+ include_links: bool = True,
128
+ max_text_chars: int = 20000,
129
+ ) -> dict[str, Any]:
130
+ """Extract title, meta description, canonical, main text, and links from a URL (non-LLM)."""
131
+ body = {
132
+ "url": url,
133
+ "include_links": include_links,
134
+ "max_text_chars": max_text_chars,
135
+ }
136
+ return _post("/v1/extract", body)
137
+
138
+
139
+ def main() -> None:
140
+ mcp.run(transport="stdio")
141
+
142
+
143
+ if __name__ == "__main__":
144
+ main()
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.5
2
+ Name: agentrender-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP helper: URL to screenshot, PDF, or structured extract for AI agents
5
+ Project-URL: Homepage, https://agentrenderapi.com
6
+ Project-URL: API, https://api.agentrenderapi.com
7
+ Author: AgentRender
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: ai-agents,browser,extract,mcp,pdf,screenshot
11
+ Requires-Python: >=3.11
12
+ Requires-Dist: httpx>=0.27
13
+ Requires-Dist: mcp<3,>=1.9
14
+ Description-Content-Type: text/markdown
15
+
16
+ # AgentRender MCP
17
+
18
+ **URL → screenshot, PDF, or structured extract for AI agents** via [MCP](https://modelcontextprotocol.io) (stdio) + REST.
19
+
20
+ - Site: https://agentrenderapi.com
21
+ - API: https://api.agentrenderapi.com
22
+
23
+ Tools: `screenshot` · `pdf` · `extract`
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ pip install agentrender-mcp
29
+ # or from this repo:
30
+ pip install .
31
+ ```
32
+
33
+ Requires an AgentRender API key (`akr_…`) from https://agentrenderapi.com (free waitlist path or paid Starter $17 / Growth $79 / Scale $259).
34
+
35
+ ## Environment
36
+
37
+ | Variable | Default | Purpose |
38
+ |----------|---------|---------|
39
+ | `AGENTRENDER_API_KEY` | _(required)_ | Bearer API key |
40
+ | `AGENTRENDER_BASE_URL` | `https://api.agentrenderapi.com` | API base |
41
+
42
+ ## Run (stdio)
43
+
44
+ ```bash
45
+ export AGENTRENDER_API_KEY=akr_your_key
46
+ agentrender-mcp
47
+ # or: python -m agentrender_mcp.server
48
+ ```
49
+
50
+ ## Cursor / Claude Desktop
51
+
52
+ ```json
53
+ {
54
+ "mcpServers": {
55
+ "agentrender": {
56
+ "command": "agentrender-mcp",
57
+ "env": {
58
+ "AGENTRENDER_API_KEY": "akr_your_key",
59
+ "AGENTRENDER_BASE_URL": "https://api.agentrenderapi.com"
60
+ }
61
+ }
62
+ }
63
+ }
64
+ ```
65
+
66
+ If `agentrender-mcp` is not on `PATH`, use your Python:
67
+
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "agentrender": {
72
+ "command": "python",
73
+ "args": ["-m", "agentrender_mcp.server"],
74
+ "env": {
75
+ "AGENTRENDER_API_KEY": "akr_your_key"
76
+ }
77
+ }
78
+ }
79
+ }
80
+ ```
81
+
82
+ ## Tools
83
+
84
+ | Tool | Maps to | Notes |
85
+ |------|---------|--------|
86
+ | `screenshot` | `POST /v1/screenshot` | PNG/JPEG/WebP; returns `image_base64` + receipt |
87
+ | `pdf` | `POST /v1/pdf` | Returns `pdf_base64` + receipt |
88
+ | `extract` | `POST /v1/extract` | Title, meta, canonical, text, links (non-LLM) |
89
+
90
+ ## REST smoke
91
+
92
+ ```bash
93
+ curl -s https://api.agentrenderapi.com/health
94
+ curl -s -X POST https://api.agentrenderapi.com/v1/extract \
95
+ -H "Authorization: Bearer $AGENTRENDER_API_KEY" \
96
+ -H "Content-Type: application/json" \
97
+ -d '{"url":"https://example.com"}'
98
+ ```
99
+
100
+ ## Notes
101
+
102
+ - Hosted Streamable HTTP MCP is not shipped in this package yet; use stdio as above.
103
+ - Do not commit API keys. Rotate any key that leaks.
104
+ - Support: hello@ via product site / waitlist flow.
105
+
106
+ ## License
107
+
108
+ MIT
109
+
110
+ <!-- mcp-name: io.github.corbinvachal48/agentrender-mcp -->
@@ -0,0 +1,7 @@
1
+ agentrender_mcp/__init__.py,sha256=N0XtFvKhbwXr58EGctsRVqJWJHKaRez1WfCt556F0zg,88
2
+ agentrender_mcp/server.py,sha256=q0dBzBuYcS2D9A9YfHfEzGyINgr4NmG2qMx9XEmYCtY,4061
3
+ agentrender_mcp-0.1.0.dist-info/METADATA,sha256=bqkbAjaRjyEmo2LsmssWoxDL0kRNsU81cIQPqLyBjAM,2677
4
+ agentrender_mcp-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
5
+ agentrender_mcp-0.1.0.dist-info/entry_points.txt,sha256=_O01KiW4tVJcFroPRqFl8YAoPWVBoAU1lCL7cxIUaaY,64
6
+ agentrender_mcp-0.1.0.dist-info/licenses/LICENSE,sha256=nT4MQjWFyksjSFFit2CnV7ptW6-Pj3JmfkwdAOhtii0,1068
7
+ agentrender_mcp-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ agentrender-mcp = agentrender_mcp.server:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AgentRender
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.