allmcps-server
Advanced tools
+86
-0
@@ -20,2 +20,3 @@ #!/usr/bin/env node | ||
| const MCP_ENDPOINT = process.env.ALLMCPS_MCP_URL || "https://allmcps.com/api/mcp"; | ||
| const API_BASE = process.env.ALLMCPS_API_URL || "https://allmcps.com"; | ||
| async function callRemote(method, params) { | ||
@@ -55,3 +56,88 @@ const response = await fetch(MCP_ENDPOINT, { | ||
| }); | ||
| // --- CLI mode ----------------------------------------------------------- | ||
| // With no subcommand this package runs as the MCP stdio server above (the | ||
| // npx allmcps-server behavior most clients expect). Passed a subcommand, it | ||
| // instead becomes a plain scriptable CLI over the same public REST API | ||
| // (https://allmcps.com/docs/api) — no MCP client required — so agents and | ||
| // developers can call `npx allmcps-server search postgres` directly from a | ||
| // shell script or CI step. | ||
| const CLI_COMMANDS = ["search", "categories", "server", "help"]; | ||
| function isCliCommand(value) { | ||
| return CLI_COMMANDS.includes(value); | ||
| } | ||
| function printHelp() { | ||
| console.log(`allmcps-server — official AllMCPs CLI & MCP server | ||
| Usage: | ||
| allmcps-server Run as an MCP stdio server (default) | ||
| allmcps-server search <query> Search the MCP server directory | ||
| allmcps-server categories List all directory categories | ||
| allmcps-server server <id> Get full details for one listing | ||
| allmcps-server help Show this help | ||
| Environment: | ||
| ALLMCPS_API_URL Override the REST API base (default https://allmcps.com) | ||
| ALLMCPS_MCP_URL Override the MCP JSON-RPC endpoint (default https://allmcps.com/api/mcp) | ||
| Docs: https://allmcps.com/docs/api`); | ||
| } | ||
| async function fetchJson(path) { | ||
| const res = await fetch(`${API_BASE}${path}`); | ||
| const body = (await res.json().catch(() => null)); | ||
| if (!res.ok) { | ||
| const message = body && typeof body === "object" && "message" in body ? body.message : res.statusText; | ||
| throw new Error(`AllMCPs API request failed (${res.status}): ${message}`); | ||
| } | ||
| return body; | ||
| } | ||
| async function runCli(command, args) { | ||
| switch (command) { | ||
| case "help": { | ||
| printHelp(); | ||
| return; | ||
| } | ||
| case "categories": { | ||
| console.log(JSON.stringify(await fetchJson("/api/v1/categories"), null, 2)); | ||
| return; | ||
| } | ||
| case "search": { | ||
| const query = args.join(" ").trim(); | ||
| if (!query) { | ||
| console.error("Usage: allmcps-server search <query>"); | ||
| process.exit(1); | ||
| } | ||
| console.log(JSON.stringify(await fetchJson(`/api/v1/search?q=${encodeURIComponent(query)}`), null, 2)); | ||
| return; | ||
| } | ||
| case "server": { | ||
| const id = args[0]; | ||
| if (!id) { | ||
| console.error("Usage: allmcps-server server <id>"); | ||
| process.exit(1); | ||
| } | ||
| console.log(JSON.stringify(await fetchJson(`/api/v1/servers/${encodeURIComponent(id)}`), null, 2)); | ||
| return; | ||
| } | ||
| } | ||
| } | ||
| async function main() { | ||
| const [maybeCommand, ...rest] = process.argv.slice(2); | ||
| if (maybeCommand && isCliCommand(maybeCommand)) { | ||
| try { | ||
| await runCli(maybeCommand, rest); | ||
| } | ||
| catch (error) { | ||
| console.error(error?.message || String(error)); | ||
| process.exit(1); | ||
| } | ||
| return; | ||
| } | ||
| if (maybeCommand && (maybeCommand === "--help" || maybeCommand === "-h")) { | ||
| printHelp(); | ||
| return; | ||
| } | ||
| if (maybeCommand) { | ||
| console.error(`Unknown command "${maybeCommand}". Run "allmcps-server help" for usage.`); | ||
| process.exit(1); | ||
| } | ||
| const transport = new StdioServerTransport(); | ||
@@ -58,0 +144,0 @@ await server.connect(transport); |
+4
-3
| { | ||
| "name": "allmcps-server", | ||
| "version": "2.0.3", | ||
| "version": "2.1.0", | ||
| "mcpName": "io.github.Jackalope-Dev/allmcps-server", | ||
| "description": "The official MCP server for AllMCPs.com - search, browse, get install configs, and submit MCP servers directly from your AI agent.", | ||
| "description": "The official MCP server and CLI for AllMCPs.com - search, browse, get install configs, and submit MCP servers directly from your AI agent or a shell script.", | ||
| "main": "dist/index.js", | ||
@@ -25,3 +25,4 @@ "type": "module", | ||
| "claude", | ||
| "ai-agent" | ||
| "ai-agent", | ||
| "cli" | ||
| ], | ||
@@ -28,0 +29,0 @@ "homepage": "https://allmcps.com", |
+16
-1
@@ -16,3 +16,3 @@ <p align="center"> | ||
| The official local MCP server for [AllMCPs.com](https://allmcps.com) — search, browse, get install configs for, and submit Model Context Protocol (MCP) servers directly from Claude, Cursor, or any MCP-compatible agent. | ||
| The official local MCP server **and CLI** for [AllMCPs.com](https://allmcps.com) — search, browse, get install configs for, and submit Model Context Protocol (MCP) servers directly from Claude, Cursor, any MCP-compatible agent, or a plain shell script. | ||
@@ -41,2 +41,17 @@ This package is a thin stdio bridge to the [AllMCPs remote MCP endpoint](https://allmcps.com/api/mcp). Tool | ||
| ## CLI mode | ||
| Run with a subcommand instead of a bare `npx allmcps-server` and it becomes a plain scriptable CLI | ||
| over the [public REST API](https://allmcps.com/docs/api) — no MCP client needed: | ||
| ```bash | ||
| npx allmcps-server search postgres # search the directory | ||
| npx allmcps-server categories # list every category | ||
| npx allmcps-server server <id> # full detail for one listing | ||
| npx allmcps-server help # usage | ||
| ``` | ||
| Each prints JSON to stdout, so it composes with `jq` and other Unix tools. With no subcommand it | ||
| runs as the MCP stdio server described below (the default `npx allmcps-server` behavior). | ||
| ## Tools | ||
@@ -43,0 +58,0 @@ |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
13328
43.5%145
133.87%91
19.74%3
50%2
100%