liveog 0.1.0 → 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 +8 -3
- package/dist/install.js +3 -1
- package/dist/mcp.d.ts +6 -0
- package/dist/mcp.js +30 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,9 +33,9 @@ npx liveog mcp add
|
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
This finds the agent apps on your machine and adds the liveog MCP server to each one: Hermes
|
|
36
|
-
Agent, Claude Code, Codex, Cursor, VS Code, Amp, Windsurf (Devin Desktop), Claude Desktop,
|
|
37
|
-
Kiro and LM Studio. Antigravity, Zed, JetBrains, Cline, Warp, Goose,
|
|
38
|
-
too, with one step by hand (see below). Restart the app, then ask:
|
|
36
|
+
Agent, Claude Code, Codex, Kimi Code, Cursor, VS Code, Amp, Windsurf (Devin Desktop), Claude Desktop,
|
|
37
|
+
OpenCode, Kiro and LM Studio. Muse Code, Factory, Antigravity, Zed, JetBrains, Cline, Warp, Goose,
|
|
38
|
+
Continue and Kilo Code work too, with one step by hand (see below). Restart the app, then ask:
|
|
39
39
|
|
|
40
40
|
> Set up link previews for this project.
|
|
41
41
|
|
|
@@ -133,6 +133,11 @@ Its tools:
|
|
|
133
133
|
| `liveog/draw` | `draw(page, out)` with your local Chrome (Node only) |
|
|
134
134
|
| `liveog/browser` | `drawCover`, `sendCover` for the user's page |
|
|
135
135
|
|
|
136
|
+
## Using liveog?
|
|
137
|
+
|
|
138
|
+
Tell us in [Using liveog? Tell us](https://github.com/bilal-abraham/liveog/discussions/7): what you built and
|
|
139
|
+
what your previews show. Want it set up for you instead? Email babraham@hmc.edu.
|
|
140
|
+
|
|
136
141
|
## License
|
|
137
142
|
|
|
138
143
|
MIT
|
package/dist/install.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// `liveog mcp add`: the MCP server added to every agent app on this machine (Hermes Agent, Claude
|
|
2
|
-
// Code, Codex, Cursor, VS Code, Amp, Windsurf, Kiro, LM Studio, OpenCode, Claude Desktop). Apps with their own
|
|
2
|
+
// Code, Codex, Kimi Code, Cursor, VS Code, Amp, Windsurf, Kiro, LM Studio, OpenCode, Claude Desktop). Apps with their own
|
|
3
3
|
// command are asked through it; apps that keep a JSON file get one key added, nothing else changed.
|
|
4
4
|
import { execFileSync } from 'node:child_process';
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
@@ -56,6 +56,8 @@ export function addEverywhere(env = realEnv()) {
|
|
|
56
56
|
out.push({ app: 'Claude Code', result: viaCommand(env, 'claude', ['mcp', 'add', '--scope', 'user', 'liveog', ...tail]) });
|
|
57
57
|
if (env.has('codex'))
|
|
58
58
|
out.push({ app: 'Codex', result: viaCommand(env, 'codex', ['mcp', 'add', 'liveog', ...tail]) });
|
|
59
|
+
if (env.has('kimi'))
|
|
60
|
+
out.push({ app: 'Kimi Code', result: viaCommand(env, 'kimi', ['mcp', 'add', '--transport', 'stdio', 'liveog', ...tail]) });
|
|
59
61
|
if (env.has('amp'))
|
|
60
62
|
out.push({ app: 'Amp', result: viaCommand(env, 'amp', ['mcp', 'add', 'liveog', ...tail]) });
|
|
61
63
|
if (env.has('code'))
|
package/dist/mcp.d.ts
CHANGED
|
@@ -6,6 +6,12 @@ type Msg = {
|
|
|
6
6
|
method?: string;
|
|
7
7
|
params?: Record<string, unknown>;
|
|
8
8
|
};
|
|
9
|
+
/** Pages drawn for an agent may not reach the network or this machine's files: inline styles and
|
|
10
|
+
* scripts, data: pictures and Google Fonts only. */
|
|
11
|
+
export declare const CSP = "default-src 'none'; style-src 'unsafe-inline' https://fonts.googleapis.com; font-src data: https://fonts.gstatic.com; img-src data: blob:; script-src 'unsafe-inline'";
|
|
12
|
+
export declare function lockDown(html: string): string;
|
|
13
|
+
/** Where to save a cover: inside the project folder, never outside it. */
|
|
14
|
+
export declare function savePath(out: string, root?: string): string | null;
|
|
9
15
|
/** One message in, its answer out (null for a notification). */
|
|
10
16
|
export declare function reply(m: Msg, version: string): Promise<object | null>;
|
|
11
17
|
export declare function serve(version: string, input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream): void;
|
package/dist/mcp.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// what a good cover looks like is said once, in INSTRUCTIONS, which a client reads at the start.
|
|
3
3
|
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import { tmpdir } from 'node:os';
|
|
5
|
-
import { isAbsolute, join, resolve } from 'node:path';
|
|
5
|
+
import { isAbsolute, join, relative, resolve } from 'node:path';
|
|
6
6
|
import { createInterface } from 'node:readline';
|
|
7
7
|
import { check, describe } from './check.js';
|
|
8
8
|
import { draw } from './draw.js';
|
|
@@ -98,6 +98,23 @@ const TOOLS = [
|
|
|
98
98
|
const VERSIONS = ['2025-06-18', '2025-03-26', '2024-11-05'];
|
|
99
99
|
const text = (t, isError = false) => ({ content: [{ type: 'text', text: t }], ...(isError ? { isError } : {}) });
|
|
100
100
|
const str = (x) => (typeof x === 'string' && x ? x : undefined);
|
|
101
|
+
/** Pages drawn for an agent may not reach the network or this machine's files: inline styles and
|
|
102
|
+
* scripts, data: pictures and Google Fonts only. */
|
|
103
|
+
export const CSP = "default-src 'none'; style-src 'unsafe-inline' https://fonts.googleapis.com; font-src data: https://fonts.gstatic.com; img-src data: blob:; script-src 'unsafe-inline'";
|
|
104
|
+
export function lockDown(html) {
|
|
105
|
+
const meta = `<meta http-equiv="Content-Security-Policy" content="${CSP}">`;
|
|
106
|
+
if (/<head[^>]*>/i.test(html))
|
|
107
|
+
return html.replace(/<head[^>]*>/i, (h) => h + meta);
|
|
108
|
+
if (/^\s*<!doctype[^>]*>/i.test(html))
|
|
109
|
+
return html.replace(/^\s*<!doctype[^>]*>/i, (d) => d + meta);
|
|
110
|
+
return meta + html;
|
|
111
|
+
}
|
|
112
|
+
/** Where to save a cover: inside the project folder, never outside it. */
|
|
113
|
+
export function savePath(out, root = process.cwd()) {
|
|
114
|
+
const file = resolve(root, out);
|
|
115
|
+
const rel = relative(resolve(root), file);
|
|
116
|
+
return rel && !rel.startsWith('..') && !isAbsolute(rel) ? file : null;
|
|
117
|
+
}
|
|
101
118
|
function drawCover(args) {
|
|
102
119
|
const title = str(args.title);
|
|
103
120
|
const html = str(args.html);
|
|
@@ -106,6 +123,9 @@ function drawCover(args) {
|
|
|
106
123
|
const out = str(args.out);
|
|
107
124
|
if (out && !/\.png$/i.test(out))
|
|
108
125
|
return text('out must end in .png.', true);
|
|
126
|
+
const saveAt = out ? savePath(out) : null;
|
|
127
|
+
if (out && !saveAt)
|
|
128
|
+
return text('out must be a path inside the project, e.g. public/og/home.png.', true);
|
|
109
129
|
const words = { title: title ?? '' };
|
|
110
130
|
for (const k of ['site', 'line', 'tag', 'art']) {
|
|
111
131
|
const v = str(args[k]);
|
|
@@ -116,8 +136,8 @@ function drawCover(args) {
|
|
|
116
136
|
const tmp = mkdtempSync(join(tmpdir(), 'liveog-mcp-'));
|
|
117
137
|
try {
|
|
118
138
|
const src = join(tmp, 'cover.html');
|
|
119
|
-
writeFileSync(src, html ?? coverHtml(words, look));
|
|
120
|
-
const file =
|
|
139
|
+
writeFileSync(src, lockDown(html ?? coverHtml(words, look)));
|
|
140
|
+
const file = saveAt ?? join(tmp, 'cover.png');
|
|
121
141
|
const s = draw(src, file);
|
|
122
142
|
return {
|
|
123
143
|
content: [
|
|
@@ -164,7 +184,13 @@ export async function reply(m, version) {
|
|
|
164
184
|
}
|
|
165
185
|
case 'ping': return ok({});
|
|
166
186
|
case 'tools/list': return ok({ tools: TOOLS });
|
|
167
|
-
case 'tools/call':
|
|
187
|
+
case 'tools/call':
|
|
188
|
+
try {
|
|
189
|
+
return ok(await call(m.params?.name, (m.params?.arguments ?? {})));
|
|
190
|
+
}
|
|
191
|
+
catch (e) {
|
|
192
|
+
return ok(text(e.message, true));
|
|
193
|
+
}
|
|
168
194
|
default: return { jsonrpc: '2.0', id: m.id, error: { code: -32601, message: `No method ${m.method}` } };
|
|
169
195
|
}
|
|
170
196
|
}
|
package/package.json
CHANGED