@pipeworx/mcp-dicebear 1.0.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -0
  3. package/package.json +18 -0
  4. package/src/index.ts +110 -0
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,32 @@
1
+ # mcp-dicebear
2
+
3
+ MCP server for generating avatars via [DiceBear API](https://www.dicebear.com). No authentication required.
4
+
5
+ ## Tools
6
+
7
+ | Tool | Description |
8
+ |------|-------------|
9
+ | `generate_avatar` | Generate a DiceBear avatar SVG URL for a given style and seed |
10
+ | `list_styles` | List all available DiceBear avatar styles |
11
+
12
+ ## Quickstart via Pipeworx Gateway
13
+
14
+ Call any tool through the hosted gateway with zero setup:
15
+
16
+ ```bash
17
+ curl -X POST https://gateway.pipeworx.io/mcp \
18
+ -H "Content-Type: application/json" \
19
+ -d '{
20
+ "jsonrpc": "2.0",
21
+ "id": 1,
22
+ "method": "tools/call",
23
+ "params": {
24
+ "name": "dicebear_generate_avatar",
25
+ "arguments": { "style": "bottts", "seed": "hello" }
26
+ }
27
+ }'
28
+ ```
29
+
30
+ ## License
31
+
32
+ MIT
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@pipeworx/mcp-dicebear",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for generating avatars via DiceBear API",
5
+ "main": "src/index.ts",
6
+ "types": "src/index.ts",
7
+ "files": ["src"],
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "typecheck": "tsc --noEmit"
11
+ },
12
+ "keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "dicebear", "avatars", "svg"],
13
+ "author": "Pipeworx <hello@pipeworx.io>",
14
+ "license": "MIT",
15
+ "devDependencies": {
16
+ "typescript": "^5.0.0"
17
+ }
18
+ }
package/src/index.ts ADDED
@@ -0,0 +1,110 @@
1
+ /**
2
+ * DiceBear MCP — wraps DiceBear Avatar API v7 (free, no auth)
3
+ *
4
+ * Tools:
5
+ * - generate_avatar: Generate an avatar SVG URL for a given style and seed
6
+ * - list_styles: Return the list of available avatar styles
7
+ */
8
+
9
+ interface McpToolDefinition {
10
+ name: string;
11
+ description: string;
12
+ inputSchema: {
13
+ type: 'object';
14
+ properties: Record<string, unknown>;
15
+ required?: string[];
16
+ };
17
+ }
18
+
19
+ interface McpToolExport {
20
+ tools: McpToolDefinition[];
21
+ callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
22
+ }
23
+
24
+ const BASE_URL = 'https://api.dicebear.com/7.x';
25
+
26
+ const STYLES = [
27
+ 'adventurer',
28
+ 'avataaars',
29
+ 'bottts',
30
+ 'fun-emoji',
31
+ 'identicon',
32
+ 'initials',
33
+ 'lorelei',
34
+ 'micah',
35
+ 'miniavs',
36
+ 'notionists',
37
+ 'open-peeps',
38
+ 'personas',
39
+ 'pixel-art',
40
+ 'thumbs',
41
+ ] as const;
42
+
43
+ type Style = (typeof STYLES)[number];
44
+
45
+ const tools: McpToolExport['tools'] = [
46
+ {
47
+ name: 'generate_avatar',
48
+ description:
49
+ 'Generate a DiceBear avatar SVG URL for a given style and seed string. Returns the URL that renders the avatar inline.',
50
+ inputSchema: {
51
+ type: 'object',
52
+ properties: {
53
+ style: {
54
+ type: 'string',
55
+ description:
56
+ 'The avatar style to use. Available styles: adventurer, avataaars, bottts, fun-emoji, identicon, initials, lorelei, micah, miniavs, notionists, open-peeps, personas, pixel-art, thumbs.',
57
+ },
58
+ seed: {
59
+ type: 'string',
60
+ description:
61
+ 'A seed string that determines the avatar appearance. Same seed + style always produces the same avatar.',
62
+ },
63
+ },
64
+ required: ['style', 'seed'],
65
+ },
66
+ },
67
+ {
68
+ name: 'list_styles',
69
+ description: 'List all available DiceBear avatar styles.',
70
+ inputSchema: {
71
+ type: 'object',
72
+ properties: {},
73
+ },
74
+ },
75
+ ];
76
+
77
+ async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
78
+ switch (name) {
79
+ case 'generate_avatar':
80
+ return generateAvatar(args.style as string, args.seed as string);
81
+ case 'list_styles':
82
+ return listStyles();
83
+ default:
84
+ throw new Error(`Unknown tool: ${name}`);
85
+ }
86
+ }
87
+
88
+ function generateAvatar(style: string, seed: string) {
89
+ if (!STYLES.includes(style as Style)) {
90
+ throw new Error(
91
+ `Unknown style: "${style}". Available styles: ${STYLES.join(', ')}`
92
+ );
93
+ }
94
+ const url = `${BASE_URL}/${encodeURIComponent(style)}/svg?seed=${encodeURIComponent(seed)}`;
95
+ return {
96
+ style,
97
+ seed,
98
+ url,
99
+ format: 'svg',
100
+ };
101
+ }
102
+
103
+ function listStyles() {
104
+ return {
105
+ count: STYLES.length,
106
+ styles: [...STYLES],
107
+ };
108
+ }
109
+
110
+ export default { tools, callTool } satisfies McpToolExport;