@pipeworx/mcp-frinkiac 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pipeworx
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.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # mcp-frinkiac
2
+
3
+ Quote-based screencap search for Simpsons, Futurama, Rick and Morty
4
+
5
+ Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 250+ live data sources.
6
+
7
+ ## Tools
8
+
9
+ | Tool | Description |
10
+ |------|-------------|
11
+ | `search` | Find screencaps matching a quote. |
12
+ | `random` | Random screencap + its caption. |
13
+ | `caption` | Caption for a specific (episode, timestamp). |
14
+
15
+ ## Quick Start
16
+
17
+ Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
18
+
19
+ ```json
20
+ {
21
+ "mcpServers": {
22
+ "frinkiac": {
23
+ "url": "https://gateway.pipeworx.io/frinkiac/mcp"
24
+ }
25
+ }
26
+ }
27
+ ```
28
+
29
+ Or connect to the full Pipeworx gateway for access to all 250+ data sources:
30
+
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "pipeworx": {
35
+ "url": "https://gateway.pipeworx.io/mcp"
36
+ }
37
+ }
38
+ }
39
+ ```
40
+
41
+ ## Using with ask_pipeworx
42
+
43
+ Instead of calling tools directly, you can ask questions in plain English:
44
+
45
+ ```
46
+ ask_pipeworx({ question: "your question about Frinkiac data" })
47
+ ```
48
+
49
+ The gateway picks the right tool and fills the arguments automatically.
50
+
51
+ ## More
52
+
53
+ - [All tools and guides](https://github.com/pipeworx-io/examples)
54
+ - [pipeworx.io](https://pipeworx.io)
55
+
56
+ ## License
57
+
58
+ MIT
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@pipeworx/mcp-frinkiac",
3
+ "version": "0.1.0",
4
+ "description": "Quote-based screencap search for Simpsons, Futurama, Rick and Morty",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "types": "src/index.ts",
8
+ "keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "frinkiac"],
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/pipeworx-io/mcp-frinkiac"
13
+ },
14
+ "scripts": {
15
+ "typecheck": "tsc --noEmit"
16
+ },
17
+ "devDependencies": {
18
+ "typescript": "^5.7.0"
19
+ }
20
+ }
package/server.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.pipeworx-io/frinkiac",
4
+ "title": "Frinkiac",
5
+ "description": "Quote-based screencap search for Simpsons, Futurama, Rick and Morty",
6
+ "version": "0.1.0",
7
+ "websiteUrl": "https://pipeworx.io/packs/frinkiac",
8
+ "repository": {
9
+ "url": "https://github.com/pipeworx-io/mcp-frinkiac",
10
+ "source": "github"
11
+ },
12
+ "remotes": [
13
+ {
14
+ "type": "streamable-http",
15
+ "url": "https://gateway.pipeworx.io/frinkiac/mcp"
16
+ }
17
+ ]
18
+ }
package/src/index.ts ADDED
@@ -0,0 +1,146 @@
1
+ interface McpToolDefinition {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: 'object';
6
+ properties: Record<string, unknown>;
7
+ required?: string[];
8
+ };
9
+ }
10
+
11
+ interface McpToolExport {
12
+ tools: McpToolDefinition[];
13
+ callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
14
+ meter?: { credits: number };
15
+ cost?: Record<string, unknown>;
16
+ provider?: string;
17
+ }
18
+
19
+ /**
20
+ * Frinkiac + Morbotron + Master of All Science MCP.
21
+ *
22
+ * Frinkiac (Simpsons), Morbotron (Futurama), Master of All Science (Rick and Morty)
23
+ * all share the same API contract. Auth: none.
24
+ */
25
+
26
+
27
+ const BASES: Record<string, string> = {
28
+ simpsons: 'https://frinkiac.com/api',
29
+ futurama: 'https://morbotron.com/api',
30
+ rickandmorty: 'https://masterofallscience.com/api',
31
+ };
32
+
33
+ const FRAME_HOSTS: Record<string, string> = {
34
+ simpsons: 'https://frinkiac.com',
35
+ futurama: 'https://morbotron.com',
36
+ rickandmorty: 'https://masterofallscience.com',
37
+ };
38
+
39
+ const UA = 'pipeworx-mcp-frinkiac/1.0 (+https://pipeworx.io)';
40
+
41
+ const tools: McpToolExport['tools'] = [
42
+ {
43
+ name: 'search',
44
+ description: 'Find screencaps matching a quote.',
45
+ inputSchema: {
46
+ type: 'object',
47
+ properties: {
48
+ show: { type: 'string', description: 'simpsons | futurama | rickandmorty (default simpsons)' },
49
+ query: { type: 'string', description: 'Quote / keywords' },
50
+ limit: { type: 'number', description: '1-100 (default 20)' },
51
+ },
52
+ required: ['query'],
53
+ },
54
+ },
55
+ {
56
+ name: 'random',
57
+ description: 'Random screencap + its caption.',
58
+ inputSchema: {
59
+ type: 'object',
60
+ properties: { show: { type: 'string' } },
61
+ },
62
+ },
63
+ {
64
+ name: 'caption',
65
+ description: 'Caption for a specific (episode, timestamp).',
66
+ inputSchema: {
67
+ type: 'object',
68
+ properties: {
69
+ show: { type: 'string' },
70
+ episode: { type: 'string', description: 'Episode key, e.g. "S05E15" (Simpsons).' },
71
+ timestamp: { type: 'number', description: 'Frame timestamp (ms) from search results.' },
72
+ },
73
+ required: ['episode', 'timestamp'],
74
+ },
75
+ },
76
+ ];
77
+
78
+ async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
79
+ const show = pickShow(args);
80
+ const base = BASES[show];
81
+ switch (name) {
82
+ case 'search': {
83
+ const q = reqStr(args, 'query', '"steamed hams"');
84
+ const limit = Math.min(100, Math.max(1, (args.limit as number) ?? 20));
85
+ const data = (await frinkGet(`${base}/search?q=${encodeURIComponent(q)}`)) as Array<{
86
+ Id: number;
87
+ Episode: string;
88
+ Timestamp: number;
89
+ }>;
90
+ const sliced = (Array.isArray(data) ? data : []).slice(0, limit).map((r) => ({
91
+ ...r,
92
+ frame_url: `${FRAME_HOSTS[show]}/img/${r.Episode}/${r.Timestamp}.jpg`,
93
+ gif_url: `${FRAME_HOSTS[show]}/gif/${r.Episode}/${r.Timestamp}/${r.Timestamp + 5000}.gif`,
94
+ }));
95
+ return { show, count: sliced.length, results: sliced };
96
+ }
97
+ case 'random': {
98
+ const data = (await frinkGet(`${base}/random`)) as {
99
+ Frame?: { Episode?: string; Timestamp?: number };
100
+ Subtitles?: { Content?: string }[];
101
+ };
102
+ const ep = data.Frame?.Episode;
103
+ const ts = data.Frame?.Timestamp;
104
+ return {
105
+ show,
106
+ episode: ep,
107
+ timestamp: ts,
108
+ caption: (data.Subtitles ?? []).map((s) => s.Content).filter(Boolean).join('\n'),
109
+ frame_url: ep && ts != null ? `${FRAME_HOSTS[show]}/img/${ep}/${ts}.jpg` : null,
110
+ raw: data,
111
+ };
112
+ }
113
+ case 'caption': {
114
+ const ep = reqStr(args, 'episode', '"S05E15"');
115
+ const ts = (args.timestamp as number) | 0;
116
+ if (!ts) throw new Error('timestamp must be a positive number (frame ms).');
117
+ return frinkGet(`${base}/caption?e=${encodeURIComponent(ep)}&t=${ts}`);
118
+ }
119
+ default:
120
+ throw new Error(`Unknown tool: ${name}`);
121
+ }
122
+ }
123
+
124
+ function pickShow(args: Record<string, unknown>): 'simpsons' | 'futurama' | 'rickandmorty' {
125
+ const s = ((args.show as string | undefined) ?? 'simpsons').toLowerCase();
126
+ if (s !== 'simpsons' && s !== 'futurama' && s !== 'rickandmorty') {
127
+ throw new Error('show must be simpsons | futurama | rickandmorty.');
128
+ }
129
+ return s;
130
+ }
131
+
132
+ async function frinkGet(url: string): Promise<unknown> {
133
+ const res = await fetch(url, { headers: { Accept: 'application/json', 'User-Agent': UA } });
134
+ if (!res.ok) throw new Error(`Frinkiac: ${res.status} ${await res.text().then((t) => t.slice(0, 200))}`);
135
+ return res.json();
136
+ }
137
+
138
+ function reqStr(args: Record<string, unknown>, key: string, example: string): string {
139
+ const v = args[key];
140
+ if (typeof v !== 'string' || !v.trim()) {
141
+ throw new Error(`Required argument "${key}" is missing. Pass a string like ${example}.`);
142
+ }
143
+ return v;
144
+ }
145
+
146
+ export default { tools, callTool, meter: { credits: 1 } } satisfies McpToolExport;
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "outDir": "dist",
10
+ "rootDir": "src",
11
+ "declaration": true
12
+ },
13
+ "include": ["src"]
14
+ }