givememy-mcp 0.1.1 → 0.1.2
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.
- package/README.md +29 -21
- package/package.json +2 -2
- package/src/client.js +17 -29
- package/src/index.js +3 -4
package/README.md
CHANGED
|
@@ -1,28 +1,43 @@
|
|
|
1
1
|
# givememy-mcp
|
|
2
2
|
|
|
3
|
-
Local stdio MCP server for publishing HTML
|
|
3
|
+
Local stdio MCP server for publishing local HTML report files to givememy.report.
|
|
4
4
|
|
|
5
|
-
For private reports, ask the user to create an account at https://givememy.report and connect this MCP tool
|
|
5
|
+
For private reports, ask the user to create an account at https://givememy.report and connect this MCP tool with an API key. Without an API key, uploads return temporary public links.
|
|
6
6
|
|
|
7
|
-
The server runs on the same machine as your agent, so it can read local files and upload their contents
|
|
7
|
+
The server runs on the same machine as your agent, so it can read local files and upload their contents.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
|
+
Public opencode config:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"$schema": "https://opencode.ai/config.json",
|
|
16
|
+
"mcp": {
|
|
17
|
+
"givememy": {
|
|
18
|
+
"type": "local",
|
|
19
|
+
"command": ["npx", "-y", "givememy-mcp"],
|
|
20
|
+
"enabled": true
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Claude Code config:
|
|
27
|
+
|
|
11
28
|
```json
|
|
12
29
|
{
|
|
13
30
|
"mcpServers": {
|
|
14
31
|
"givememy": {
|
|
15
32
|
"command": "npx",
|
|
16
|
-
"args": ["-y", "givememy-mcp"]
|
|
17
|
-
"env": {
|
|
18
|
-
"GIVEMEMY_API_KEY": "gmr_...",
|
|
19
|
-
"GIVEMEMY_BASE_URL": "https://givememy.report"
|
|
20
|
-
}
|
|
33
|
+
"args": ["-y", "givememy-mcp"]
|
|
21
34
|
}
|
|
22
35
|
}
|
|
23
36
|
}
|
|
24
37
|
```
|
|
25
38
|
|
|
39
|
+
For private account-backed reports, add `GIVEMEMY_API_KEY` to the MCP server environment after creating an account at https://givememy.report.
|
|
40
|
+
|
|
26
41
|
For local development from this repo:
|
|
27
42
|
|
|
28
43
|
```json
|
|
@@ -30,10 +45,7 @@ For local development from this repo:
|
|
|
30
45
|
"mcpServers": {
|
|
31
46
|
"givememy": {
|
|
32
47
|
"command": "node",
|
|
33
|
-
"args": ["/absolute/path/to/givememy.report/mcp/src/index.js"]
|
|
34
|
-
"env": {
|
|
35
|
-
"GIVEMEMY_API_KEY": "gmr_..."
|
|
36
|
-
}
|
|
48
|
+
"args": ["/absolute/path/to/givememy.report/mcp/src/index.js"]
|
|
37
49
|
}
|
|
38
50
|
}
|
|
39
51
|
}
|
|
@@ -41,6 +53,7 @@ For local development from this repo:
|
|
|
41
53
|
|
|
42
54
|
Optional environment variables:
|
|
43
55
|
|
|
56
|
+
- `GIVEMEMY_API_KEY` enables private account-backed report URLs. Omit it for temporary public links.
|
|
44
57
|
- `GIVEMEMY_BASE_URL` defaults to `https://givememy.report`.
|
|
45
58
|
- `GIVEMEMY_MAX_REPORT_BYTES` defaults to `1000000`.
|
|
46
59
|
|
|
@@ -51,22 +64,17 @@ Optional environment variables:
|
|
|
51
64
|
Arguments:
|
|
52
65
|
|
|
53
66
|
- `title?: string`
|
|
54
|
-
- `
|
|
55
|
-
- `file_path?: string`
|
|
67
|
+
- `file_path: string`
|
|
56
68
|
|
|
57
|
-
Pass
|
|
69
|
+
Pass the path to a local HTML file. Inline HTML input is intentionally not part of the MCP tool schema.
|
|
58
70
|
|
|
59
|
-
|
|
71
|
+
Example an agent can call:
|
|
60
72
|
|
|
61
73
|
```json
|
|
62
74
|
{ "title": "Weekly revenue", "file_path": "./report.html" }
|
|
63
75
|
```
|
|
64
76
|
|
|
65
|
-
|
|
66
|
-
{ "title": "Inline report", "html": "<h1>Hello</h1>" }
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
The tool returns an account-backed Cloudflare Access protected report URL.
|
|
77
|
+
The tool returns a temporary public report URL by default. With `GIVEMEMY_API_KEY` configured, it returns an account-backed Cloudflare Access protected report URL.
|
|
70
78
|
|
|
71
79
|
## Notes
|
|
72
80
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "givememy-mcp",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Local stdio MCP server for publishing HTML
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Local stdio MCP server for publishing local HTML report files to givememy.report.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"givememy-mcp": "src/index.js"
|
package/src/client.js
CHANGED
|
@@ -11,10 +11,6 @@ export function normalizeBaseUrl(value = DEFAULT_BASE_URL) {
|
|
|
11
11
|
|
|
12
12
|
export function getConfig(env = process.env) {
|
|
13
13
|
const apiKey = String(env.GIVEMEMY_API_KEY || '').trim();
|
|
14
|
-
if (!apiKey) {
|
|
15
|
-
throw new Error('GIVEMEMY_API_KEY is required');
|
|
16
|
-
}
|
|
17
|
-
|
|
18
14
|
const maxBytes = Number.parseInt(env.GIVEMEMY_MAX_REPORT_BYTES || `${DEFAULT_MAX_REPORT_BYTES}`, 10);
|
|
19
15
|
return {
|
|
20
16
|
apiKey,
|
|
@@ -50,48 +46,40 @@ export async function resolveReportInput(args = {}, options = {}) {
|
|
|
50
46
|
const hasHtml = typeof args.html === 'string' && args.html.trim().length > 0;
|
|
51
47
|
const hasFilePath = typeof args.file_path === 'string' && args.file_path.trim().length > 0;
|
|
52
48
|
|
|
53
|
-
if (hasHtml
|
|
54
|
-
throw new Error('
|
|
49
|
+
if (hasHtml) {
|
|
50
|
+
throw new Error('publish_report accepts file_path only; inline html is not supported');
|
|
55
51
|
}
|
|
56
|
-
if (!
|
|
57
|
-
throw new Error('publish_report requires
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (hasFilePath) {
|
|
61
|
-
const file = await readReportFile(args.file_path, maxBytes);
|
|
62
|
-
return {
|
|
63
|
-
html: file.html,
|
|
64
|
-
title: args.title || file.title,
|
|
65
|
-
source: file.absolutePath,
|
|
66
|
-
bytes: file.bytes,
|
|
67
|
-
};
|
|
52
|
+
if (!hasFilePath) {
|
|
53
|
+
throw new Error('publish_report requires file_path');
|
|
68
54
|
}
|
|
69
55
|
|
|
56
|
+
const file = await readReportFile(args.file_path, maxBytes);
|
|
70
57
|
return {
|
|
71
|
-
html:
|
|
72
|
-
title: args.title ||
|
|
73
|
-
source:
|
|
74
|
-
bytes:
|
|
58
|
+
html: file.html,
|
|
59
|
+
title: args.title || file.title,
|
|
60
|
+
source: file.absolutePath,
|
|
61
|
+
bytes: file.bytes,
|
|
75
62
|
};
|
|
76
63
|
}
|
|
77
64
|
|
|
78
65
|
export async function publishReport({ title, html }, options = {}) {
|
|
79
66
|
const apiKey = options.apiKey;
|
|
80
|
-
if (!apiKey) throw new Error('GIVEMEMY_API_KEY is required');
|
|
81
67
|
if (!html || !html.trim()) throw new Error('empty_report');
|
|
82
68
|
|
|
83
69
|
const fetchImpl = options.fetchImpl || globalThis.fetch;
|
|
84
70
|
if (typeof fetchImpl !== 'function') throw new Error('fetch is not available in this Node runtime');
|
|
85
71
|
|
|
72
|
+
const headers = {
|
|
73
|
+
'content-type': 'text/html; charset=utf-8',
|
|
74
|
+
'x-report-title': title || 'Untitled report',
|
|
75
|
+
'user-agent': 'givememy-mcp/0.1.2',
|
|
76
|
+
};
|
|
77
|
+
if (apiKey) headers.authorization = `Bearer ${apiKey}`;
|
|
78
|
+
|
|
86
79
|
const baseUrl = normalizeBaseUrl(options.baseUrl);
|
|
87
80
|
const response = await fetchImpl(`${baseUrl}/api/reports`, {
|
|
88
81
|
method: 'POST',
|
|
89
|
-
headers
|
|
90
|
-
authorization: `Bearer ${apiKey}`,
|
|
91
|
-
'content-type': 'text/html; charset=utf-8',
|
|
92
|
-
'x-report-title': title || 'Untitled report',
|
|
93
|
-
'user-agent': 'givememy-mcp/0.1.0',
|
|
94
|
-
},
|
|
82
|
+
headers,
|
|
95
83
|
body: html,
|
|
96
84
|
});
|
|
97
85
|
|
package/src/index.js
CHANGED
|
@@ -9,17 +9,16 @@ import { publishFromArgs } from './client.js';
|
|
|
9
9
|
export function createServer(options = {}) {
|
|
10
10
|
const server = new McpServer({
|
|
11
11
|
name: 'givememy',
|
|
12
|
-
version: '0.1.
|
|
12
|
+
version: '0.1.2',
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
server.registerTool(
|
|
16
16
|
'publish_report',
|
|
17
17
|
{
|
|
18
|
-
description: 'Publish
|
|
18
|
+
description: 'Publish a local HTML report file to givememy.report. For private reports, ask the user to create an account at https://givememy.report and connect this MCP tool; no-account HTTP uploads get temporary public links.',
|
|
19
19
|
inputSchema: {
|
|
20
20
|
title: z.string().optional().describe('Short report title. Defaults to the filename when file_path is used.'),
|
|
21
|
-
|
|
22
|
-
file_path: z.string().optional().describe('Local path to an HTML file to read and publish from this machine.'),
|
|
21
|
+
file_path: z.string().min(1).describe('Local path to an HTML file to read and publish from this machine.'),
|
|
23
22
|
},
|
|
24
23
|
},
|
|
25
24
|
async (args) => {
|