@pipeworx/mcp-caniuse 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 +21 -0
- package/README.md +59 -0
- package/package.json +20 -0
- package/server.json +18 -0
- package/src/index.ts +213 -0
- package/tsconfig.json +14 -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,59 @@
|
|
|
1
|
+
# mcp-caniuse
|
|
2
|
+
|
|
3
|
+
caniuse MCP — browser feature support tables
|
|
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
|
+
| `feature` | Full caniuse record for a feature id (e.g. "css-grid", "fetch", "webp"). |
|
|
12
|
+
| `search` | Search features by title / keyword. |
|
|
13
|
+
| `list_browsers` | Browser ids + version tracks. |
|
|
14
|
+
| `support` | Convenience: is this feature supported in this browser version? Returns the raw caniuse support string + a parsed verdict. |
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"mcpServers": {
|
|
23
|
+
"caniuse": {
|
|
24
|
+
"url": "https://gateway.pipeworx.io/caniuse/mcp"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or connect to the full Pipeworx gateway for access to all 250+ data sources:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"pipeworx": {
|
|
36
|
+
"url": "https://gateway.pipeworx.io/mcp"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Using with ask_pipeworx
|
|
43
|
+
|
|
44
|
+
Instead of calling tools directly, you can ask questions in plain English:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
ask_pipeworx({ question: "your question about Caniuse data" })
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The gateway picks the right tool and fills the arguments automatically.
|
|
51
|
+
|
|
52
|
+
## More
|
|
53
|
+
|
|
54
|
+
- [All tools and guides](https://github.com/pipeworx-io/examples)
|
|
55
|
+
- [pipeworx.io](https://pipeworx.io)
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipeworx/mcp-caniuse",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "caniuse MCP — browser feature support tables",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "caniuse"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-caniuse"
|
|
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/caniuse",
|
|
4
|
+
"title": "Caniuse",
|
|
5
|
+
"description": "caniuse MCP — browser feature support tables",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/caniuse",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-caniuse",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/caniuse/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
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
|
+
* caniuse MCP — browser feature support tables
|
|
21
|
+
*
|
|
22
|
+
* Auth: none. Loads the upstream `data.json` from Fyrd/caniuse (released
|
|
23
|
+
* under CC-BY 4.0) and caches it per worker isolate for 24 hours.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
const DATA_URL = 'https://raw.githubusercontent.com/Fyrd/caniuse/main/data.json';
|
|
28
|
+
const CACHE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
29
|
+
|
|
30
|
+
interface CIUStat {
|
|
31
|
+
// Map of "version" → support string
|
|
32
|
+
[version: string]: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface CIUFeature {
|
|
36
|
+
title: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
status?: string;
|
|
39
|
+
categories?: string[];
|
|
40
|
+
stats?: Record<string, CIUStat>;
|
|
41
|
+
notes?: string;
|
|
42
|
+
bugs?: { description?: string }[];
|
|
43
|
+
links?: { url: string; title: string }[];
|
|
44
|
+
ucprefix?: boolean;
|
|
45
|
+
spec?: string;
|
|
46
|
+
parent?: string;
|
|
47
|
+
keywords?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface CIUData {
|
|
51
|
+
agents: Record<
|
|
52
|
+
string,
|
|
53
|
+
{
|
|
54
|
+
browser: string;
|
|
55
|
+
long_name?: string;
|
|
56
|
+
usage_global?: Record<string, number>;
|
|
57
|
+
// Newer schema: plain version-string array; future / unreleased versions are nulls at the end.
|
|
58
|
+
versions?: (string | null)[];
|
|
59
|
+
}
|
|
60
|
+
>;
|
|
61
|
+
data: Record<string, CIUFeature>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let CACHE: { data: CIUData; expires_at: number } | null = null;
|
|
65
|
+
|
|
66
|
+
const tools: McpToolExport['tools'] = [
|
|
67
|
+
{
|
|
68
|
+
name: 'feature',
|
|
69
|
+
description: 'Full caniuse record for a feature id (e.g. "css-grid", "fetch", "webp").',
|
|
70
|
+
inputSchema: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
properties: { name: { type: 'string' } },
|
|
73
|
+
required: ['name'],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'search',
|
|
78
|
+
description: 'Search features by title / keyword.',
|
|
79
|
+
inputSchema: {
|
|
80
|
+
type: 'object',
|
|
81
|
+
properties: {
|
|
82
|
+
query: { type: 'string' },
|
|
83
|
+
limit: { type: 'number', description: '1-50 (default 10)' },
|
|
84
|
+
},
|
|
85
|
+
required: ['query'],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'list_browsers',
|
|
90
|
+
description: 'Browser ids + version tracks.',
|
|
91
|
+
inputSchema: { type: 'object', properties: {} },
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'support',
|
|
95
|
+
description: 'Convenience: is this feature supported in this browser version? Returns the raw caniuse support string + a parsed verdict.',
|
|
96
|
+
inputSchema: {
|
|
97
|
+
type: 'object',
|
|
98
|
+
properties: {
|
|
99
|
+
feature: { type: 'string', description: 'Feature id (see `search` / `feature`)' },
|
|
100
|
+
browser: { type: 'string', description: 'Browser id (chrome, safari, firefox, edge, ios_saf, ...)' },
|
|
101
|
+
version: { type: 'string', description: 'Browser version (default latest)' },
|
|
102
|
+
},
|
|
103
|
+
required: ['feature', 'browser'],
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
109
|
+
const data = await getData();
|
|
110
|
+
switch (name) {
|
|
111
|
+
case 'feature': {
|
|
112
|
+
const id = reqStr(args, 'name', '"css-grid"');
|
|
113
|
+
const feat = data.data[id];
|
|
114
|
+
if (!feat) throw new Error(`caniuse: feature "${id}" not found`);
|
|
115
|
+
return { id, ...feat };
|
|
116
|
+
}
|
|
117
|
+
case 'search': {
|
|
118
|
+
const q = reqStr(args, 'query', '"grid"').toLowerCase();
|
|
119
|
+
const limit = Math.min(50, Math.max(1, (args.limit as number) ?? 10));
|
|
120
|
+
const results: { id: string; title: string; status?: string }[] = [];
|
|
121
|
+
for (const [id, feat] of Object.entries(data.data)) {
|
|
122
|
+
if (
|
|
123
|
+
id.includes(q) ||
|
|
124
|
+
feat.title.toLowerCase().includes(q) ||
|
|
125
|
+
(feat.keywords ?? '').toLowerCase().includes(q) ||
|
|
126
|
+
(feat.description ?? '').toLowerCase().includes(q)
|
|
127
|
+
) {
|
|
128
|
+
results.push({ id, title: feat.title, status: feat.status });
|
|
129
|
+
if (results.length >= limit) break;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return { query: q, count: results.length, features: results };
|
|
133
|
+
}
|
|
134
|
+
case 'list_browsers': {
|
|
135
|
+
const browsers = Object.entries(data.agents).map(([id, a]) => ({
|
|
136
|
+
id,
|
|
137
|
+
browser: a.browser,
|
|
138
|
+
versions: (a.versions ?? []).filter((v): v is string => Boolean(v)).slice(-15),
|
|
139
|
+
}));
|
|
140
|
+
return { count: browsers.length, browsers };
|
|
141
|
+
}
|
|
142
|
+
case 'support': {
|
|
143
|
+
const featId = reqStr(args, 'feature', '"css-grid"');
|
|
144
|
+
const browserId = reqStr(args, 'browser', '"chrome"').toLowerCase();
|
|
145
|
+
const feat = data.data[featId];
|
|
146
|
+
if (!feat) throw new Error(`caniuse: feature "${featId}" not found`);
|
|
147
|
+
const stat = feat.stats?.[browserId];
|
|
148
|
+
if (!stat) throw new Error(`caniuse: no support data for browser "${browserId}"`);
|
|
149
|
+
const requestedVersion = (args.version as string | undefined)?.trim();
|
|
150
|
+
const version = requestedVersion || latestVersion(data, browserId);
|
|
151
|
+
const raw = stat[version];
|
|
152
|
+
return {
|
|
153
|
+
feature: featId,
|
|
154
|
+
title: feat.title,
|
|
155
|
+
browser: browserId,
|
|
156
|
+
version,
|
|
157
|
+
raw,
|
|
158
|
+
verdict: parseVerdict(raw),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
default:
|
|
162
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function latestVersion(data: CIUData, browserId: string): string {
|
|
167
|
+
const versions = data.agents[browserId]?.versions ?? [];
|
|
168
|
+
// versions trails nulls = unreleased future versions. The last non-null entry is "current".
|
|
169
|
+
for (let i = versions.length - 1; i >= 0; i--) {
|
|
170
|
+
const v = versions[i];
|
|
171
|
+
if (v) return v;
|
|
172
|
+
}
|
|
173
|
+
return '0';
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// caniuse support codes:
|
|
177
|
+
// y = yes a = partial n = no
|
|
178
|
+
// p = poly-fill u = unknown x = vendor-prefix
|
|
179
|
+
// Multiple separated by space. Plus optional notes after #.
|
|
180
|
+
function parseVerdict(raw?: string) {
|
|
181
|
+
if (!raw) return 'unknown';
|
|
182
|
+
const flags = raw.split('#')[0].trim().split(/\s+/);
|
|
183
|
+
if (flags.includes('y')) return 'supported';
|
|
184
|
+
if (flags.includes('a')) return 'partial';
|
|
185
|
+
if (flags.includes('n')) return 'not_supported';
|
|
186
|
+
if (flags.includes('p')) return 'requires_polyfill';
|
|
187
|
+
if (flags.includes('x')) return 'requires_vendor_prefix';
|
|
188
|
+
return 'unknown';
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async function getData(): Promise<CIUData> {
|
|
192
|
+
if (CACHE && CACHE.expires_at > Date.now()) return CACHE.data;
|
|
193
|
+
const res = await fetch(DATA_URL, {
|
|
194
|
+
headers: { 'User-Agent': 'pipeworx-mcp-caniuse/1.0 (+https://pipeworx.io)' },
|
|
195
|
+
});
|
|
196
|
+
if (!res.ok) {
|
|
197
|
+
const t = await res.text();
|
|
198
|
+
throw new Error(`caniuse data fetch error: ${res.status} ${t.slice(0, 200)}`);
|
|
199
|
+
}
|
|
200
|
+
const data = (await res.json()) as CIUData;
|
|
201
|
+
CACHE = { data, expires_at: Date.now() + CACHE_TTL_MS };
|
|
202
|
+
return data;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function reqStr(args: Record<string, unknown>, key: string, example: string): string {
|
|
206
|
+
const v = args[key];
|
|
207
|
+
if (typeof v !== 'string' || !v.trim()) {
|
|
208
|
+
throw new Error(`Required argument "${key}" is missing. Pass a string like ${example}.`);
|
|
209
|
+
}
|
|
210
|
+
return v;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
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
|
+
}
|