@aicanvas/mcp 0.1.0 → 0.1.1
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/dist/index.js +7 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19,6 +19,8 @@ import { z } from 'zod';
|
|
|
19
19
|
const REGISTRY_BASE = process.env.AICANVAS_REGISTRY_BASE ?? 'https://aicanvas.me/r';
|
|
20
20
|
const META_URL = `${REGISTRY_BASE}/aicanvas-mcp.json`;
|
|
21
21
|
const META_TTL_MS = 5 * 60 * 1000; // 5 minutes — meta updates with deploys
|
|
22
|
+
const MCP_VERSION = '0.1.1';
|
|
23
|
+
const USER_AGENT = `aicanvas-mcp/${MCP_VERSION}`;
|
|
22
24
|
// ── Cached fetchers ──────────────────────────────────────────────────────────
|
|
23
25
|
let metaCache = null;
|
|
24
26
|
async function fetchMeta() {
|
|
@@ -26,7 +28,7 @@ async function fetchMeta() {
|
|
|
26
28
|
return metaCache.data;
|
|
27
29
|
}
|
|
28
30
|
const res = await fetch(META_URL, {
|
|
29
|
-
headers: { Accept: 'application/json' },
|
|
31
|
+
headers: { Accept: 'application/json', 'User-Agent': USER_AGENT },
|
|
30
32
|
});
|
|
31
33
|
if (!res.ok) {
|
|
32
34
|
throw new Error(`Failed to fetch AI Canvas registry meta from ${META_URL}: ${res.status} ${res.statusText}`);
|
|
@@ -37,7 +39,9 @@ async function fetchMeta() {
|
|
|
37
39
|
}
|
|
38
40
|
async function fetchComponentSource(slug) {
|
|
39
41
|
const url = `${REGISTRY_BASE}/${encodeURIComponent(slug)}.json`;
|
|
40
|
-
const res = await fetch(url, {
|
|
42
|
+
const res = await fetch(url, {
|
|
43
|
+
headers: { Accept: 'application/json', 'User-Agent': USER_AGENT },
|
|
44
|
+
});
|
|
41
45
|
if (!res.ok) {
|
|
42
46
|
throw new Error(`Failed to fetch source for "${slug}" from ${url}: ${res.status} ${res.statusText}`);
|
|
43
47
|
}
|
|
@@ -97,7 +101,7 @@ function errorResult(message) {
|
|
|
97
101
|
};
|
|
98
102
|
}
|
|
99
103
|
// ── Server ───────────────────────────────────────────────────────────────────
|
|
100
|
-
const server = new McpServer({ name: 'aicanvas-mcp', version:
|
|
104
|
+
const server = new McpServer({ name: 'aicanvas-mcp', version: MCP_VERSION }, { capabilities: { tools: {}, logging: {} } });
|
|
101
105
|
// ── Tool: list_categories ────────────────────────────────────────────────────
|
|
102
106
|
server.registerTool('list_categories', {
|
|
103
107
|
title: 'List AI Canvas categories',
|
package/package.json
CHANGED