@pipeworx/mcp-homebrew-formulae 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 +60 -0
- package/package.json +20 -0
- package/server.json +18 -0
- package/src/index.ts +133 -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,60 @@
|
|
|
1
|
+
# mcp-homebrew-formulae
|
|
2
|
+
|
|
3
|
+
Homebrew formulae + casks + install analytics (formulae.brew.sh)
|
|
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
|
+
| `formula` | Formula by name. |
|
|
12
|
+
| `cask` | Cask by name. |
|
|
13
|
+
| `analytics_install` | Install counts. Pass formula to scope, or omit for top list. |
|
|
14
|
+
| `analytics_cask_install` | Cask install counts. |
|
|
15
|
+
| `recent_formulae` | Recently-added formulae. |
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"homebrew-formulae": {
|
|
25
|
+
"url": "https://gateway.pipeworx.io/homebrew-formulae/mcp"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or connect to the full Pipeworx gateway for access to all 250+ data sources:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"mcpServers": {
|
|
36
|
+
"pipeworx": {
|
|
37
|
+
"url": "https://gateway.pipeworx.io/mcp"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Using with ask_pipeworx
|
|
44
|
+
|
|
45
|
+
Instead of calling tools directly, you can ask questions in plain English:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
ask_pipeworx({ question: "your question about Homebrew Formulae data" })
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The gateway picks the right tool and fills the arguments automatically.
|
|
52
|
+
|
|
53
|
+
## More
|
|
54
|
+
|
|
55
|
+
- [All tools and guides](https://github.com/pipeworx-io/examples)
|
|
56
|
+
- [pipeworx.io](https://pipeworx.io)
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipeworx/mcp-homebrew-formulae",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Homebrew formulae + casks + install analytics (formulae.brew.sh)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "homebrew-formulae"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-homebrew-formulae"
|
|
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/homebrew-formulae",
|
|
4
|
+
"title": "Homebrew Formulae",
|
|
5
|
+
"description": "Homebrew formulae + casks + install analytics (formulae.brew.sh)",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/homebrew-formulae",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-homebrew-formulae",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/homebrew-formulae/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
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
|
+
* Homebrew formulae.brew.sh MCP.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const BASE = 'https://formulae.brew.sh/api';
|
|
25
|
+
const UA = 'pipeworx-mcp-homebrew-formulae/1.0 (+https://pipeworx.io)';
|
|
26
|
+
|
|
27
|
+
const tools: McpToolExport['tools'] = [
|
|
28
|
+
{
|
|
29
|
+
name: 'formula',
|
|
30
|
+
description: 'Formula by name.',
|
|
31
|
+
inputSchema: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: { name: { type: 'string' } },
|
|
34
|
+
required: ['name'],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'cask',
|
|
39
|
+
description: 'Cask by name.',
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: { name: { type: 'string' } },
|
|
43
|
+
required: ['name'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'analytics_install',
|
|
48
|
+
description: 'Install counts. Pass formula to scope, or omit for top list.',
|
|
49
|
+
inputSchema: {
|
|
50
|
+
type: 'object',
|
|
51
|
+
properties: {
|
|
52
|
+
formula: { type: 'string' },
|
|
53
|
+
days: { type: 'number', description: '30 | 90 | 365 (default 30).' },
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'analytics_cask_install',
|
|
59
|
+
description: 'Cask install counts.',
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: 'object',
|
|
62
|
+
properties: {
|
|
63
|
+
cask: { type: 'string' },
|
|
64
|
+
days: { type: 'number' },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'recent_formulae',
|
|
70
|
+
description: 'Recently-added formulae.',
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: 'object',
|
|
73
|
+
properties: {
|
|
74
|
+
days: { type: 'number', description: '1-365 (default 30).' },
|
|
75
|
+
limit: { type: 'number' },
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
82
|
+
switch (name) {
|
|
83
|
+
case 'formula':
|
|
84
|
+
return brewGet(`/formula/${encodeURIComponent(reqStr(args, 'name', '"node"'))}.json`);
|
|
85
|
+
case 'cask':
|
|
86
|
+
return brewGet(`/cask/${encodeURIComponent(reqStr(args, 'name', '"firefox"'))}.json`);
|
|
87
|
+
case 'analytics_install': {
|
|
88
|
+
const d = String(args.days ?? 30);
|
|
89
|
+
if (!['30', '90', '365'].includes(d)) throw new Error('days must be 30 | 90 | 365.');
|
|
90
|
+
if (args.formula) return brewGet(`/analytics/install/${d}d.json`).then(t => {
|
|
91
|
+
const counts = (t as { formulae?: Record<string, unknown> }).formulae ?? {};
|
|
92
|
+
return { formula: String(args.formula), data: counts[String(args.formula)] ?? null };
|
|
93
|
+
});
|
|
94
|
+
return brewGet(`/analytics/install/${d}d.json`);
|
|
95
|
+
}
|
|
96
|
+
case 'analytics_cask_install': {
|
|
97
|
+
const d = String(args.days ?? 30);
|
|
98
|
+
if (!['30', '90', '365'].includes(d)) throw new Error('days must be 30 | 90 | 365.');
|
|
99
|
+
if (args.cask) return brewGet(`/analytics/cask-install/${d}d.json`).then(t => {
|
|
100
|
+
const counts = (t as { formulae?: Record<string, unknown> }).formulae ?? {};
|
|
101
|
+
return { cask: String(args.cask), data: counts[String(args.cask)] ?? null };
|
|
102
|
+
});
|
|
103
|
+
return brewGet(`/analytics/cask-install/${d}d.json`);
|
|
104
|
+
}
|
|
105
|
+
case 'recent_formulae': {
|
|
106
|
+
const days = Math.min(365, Math.max(1, (args.days as number) ?? 30));
|
|
107
|
+
const limit = Math.min(1000, Math.max(1, (args.limit as number) ?? 50));
|
|
108
|
+
const data = (await brewGet(`/formula.json`)) as { name?: string; date_added?: string; ruby_source_path?: string; tap?: string }[];
|
|
109
|
+
const cutoff = Date.now() - days * 86400_000;
|
|
110
|
+
const recent = (data as any[])
|
|
111
|
+
.filter((f) => f.date_added && Date.parse(f.date_added) >= cutoff)
|
|
112
|
+
.slice(0, limit);
|
|
113
|
+
return { days, count: recent.length, formulae: recent };
|
|
114
|
+
}
|
|
115
|
+
default:
|
|
116
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async function brewGet(path: string): Promise<unknown> {
|
|
121
|
+
const res = await fetch(`${BASE}${path}`, { headers: { Accept: 'application/json', 'User-Agent': UA } });
|
|
122
|
+
if (res.status === 404) throw new Error('Homebrew: not found');
|
|
123
|
+
if (!res.ok) throw new Error(`Homebrew: ${res.status}`);
|
|
124
|
+
return res.json();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function reqStr(args: Record<string, unknown>, key: string, example: string): string {
|
|
128
|
+
const v = args[key];
|
|
129
|
+
if (typeof v !== 'string' || !v.trim()) throw new Error(`Required argument "${key}" is missing. Pass a string like ${example}.`);
|
|
130
|
+
return v;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
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
|
+
}
|