@mrfentmen/cs2-agents-mcp 0.0.0-stage → 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.
package/README.md CHANGED
@@ -1,3 +1,22 @@
1
- # Temporary Holding Version
1
+ # cs2-agents-mcp
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ MCP server for CS2 agents. Keyless: it reads the public ByMykel CS2 item list.
4
+
5
+ ## Tools
6
+
7
+ | Tool | What it returns |
8
+ | --- | --- |
9
+ | `get_agents` | Agents with rarity and team |
10
+
11
+ ## Run
12
+
13
+ ```bash
14
+ npx -y @mrfentmen/cs2-agents-mcp
15
+ ```
16
+
17
+ ## Build and test
18
+
19
+ ```bash
20
+ npm install
21
+ npm test
22
+ ```
package/dist/api.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ export declare class Cs2AgentsError extends Error {
2
+ }
3
+ export interface Agent {
4
+ id: string;
5
+ name: string;
6
+ rarity: string;
7
+ team: string;
8
+ }
9
+ export declare function agents(limit: number): Promise<Agent[]>;
10
+ export declare function formatAgents(list: Agent[]): string;
package/dist/api.js ADDED
@@ -0,0 +1,35 @@
1
+ const API = "https://raw.githubusercontent.com/ByMykel/CSGO-API/main/public/api/en/agents.json";
2
+ export class Cs2AgentsError extends Error {
3
+ }
4
+ export async function agents(limit) {
5
+ let json;
6
+ try {
7
+ const response = await fetch(API, { signal: AbortSignal.timeout(60000) });
8
+ if (!response.ok)
9
+ throw new Cs2AgentsError(`ByMykel answered ${response.status}`);
10
+ json = (await response.json());
11
+ }
12
+ catch (error) {
13
+ if (error instanceof Cs2AgentsError)
14
+ throw error;
15
+ throw new Cs2AgentsError(`ByMykel unreachable: ${error instanceof Error ? error.message : String(error)}`);
16
+ }
17
+ if (!Array.isArray(json))
18
+ throw new Cs2AgentsError("ByMykel returned no agents");
19
+ const list = json
20
+ .filter((agent) => agent.name)
21
+ .map((agent) => ({
22
+ id: agent.id ?? "unknown",
23
+ name: agent.name,
24
+ rarity: agent.rarity?.name ?? "unknown",
25
+ team: agent.team?.name ?? "no team",
26
+ }))
27
+ .sort((a, b) => a.name.localeCompare(b.name));
28
+ if (list.length === 0)
29
+ throw new Cs2AgentsError("ByMykel returned no agents");
30
+ return list.slice(0, limit);
31
+ }
32
+ export function formatAgents(list) {
33
+ const lines = list.map((agent, index) => `${index + 1}. ${agent.name} — ${agent.rarity} — ${agent.team}`);
34
+ return `# CS2 agents\n\n${lines.join("\n")}`;
35
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
+ import { createServer } from "./server.js";
4
+ async function main() {
5
+ const server = createServer();
6
+ const transport = new StdioServerTransport();
7
+ await server.connect(transport);
8
+ console.error("cs2-agents-mcp running on stdio");
9
+ }
10
+ main().catch((error) => {
11
+ console.error("Fatal error:", error);
12
+ process.exit(1);
13
+ });
@@ -0,0 +1,2 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function createServer(): McpServer;
package/dist/server.js ADDED
@@ -0,0 +1,17 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { z } from "zod";
3
+ import { agents, formatAgents } from "./api.js";
4
+ const text = (value) => ({ content: [{ type: "text", text: value }] });
5
+ const failed = (error) => text(`Error: ${error instanceof Error ? error.message : String(error)}`);
6
+ export function createServer() {
7
+ const server = new McpServer({ name: "cs2-agents-mcp", version: "1.0.0" });
8
+ server.tool("get_agents", "CS2 agents with rarity and team.", { limit: z.number().int().min(1).max(200).default(50) }, async ({ limit }) => {
9
+ try {
10
+ return text(formatAgents(await agents(limit)));
11
+ }
12
+ catch (error) {
13
+ return failed(error);
14
+ }
15
+ });
16
+ return server;
17
+ }
package/package.json CHANGED
@@ -1,6 +1,41 @@
1
1
  {
2
2
  "name": "@mrfentmen/cs2-agents-mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "CS2 agents MCP: rarity and team. Keyless.",
5
+ "type": "module",
6
+ "mcpName": "io.github.mrfentmen/cs2-agents-mcp",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/mrfentmen/awesome-servers.git"
10
+ },
11
+ "bin": {
12
+ "cs2-agents-mcp": "./dist/index.js"
13
+ },
14
+ "main": "./dist/index.js",
15
+ "files": [
16
+ "dist",
17
+ "server.json",
18
+ "README.md"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -p tsconfig.json",
22
+ "start": "node dist/index.js",
23
+ "test": "npm run build && node --test tests/tools.test.mjs"
24
+ },
25
+ "keywords": [
26
+ "mcp",
27
+ "cs2",
28
+ "counter-strike",
29
+ "agents",
30
+ "skins"
31
+ ],
32
+ "license": "MIT",
33
+ "dependencies": {
34
+ "@modelcontextprotocol/sdk": "^1.0.4",
35
+ "zod": "^3.23.8"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^22.0.0",
39
+ "typescript": "^5.6.0"
40
+ }
41
+ }
package/server.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.mrfentmen/cs2-agents-mcp",
4
+ "description": "CS2 agents MCP: rarity and team. Keyless.",
5
+ "repository": {
6
+ "url": "https://github.com/mrfentmen/awesome-servers",
7
+ "source": "github"
8
+ },
9
+ "version": "1.0.0",
10
+ "packages": [
11
+ {
12
+ "registryType": "npm",
13
+ "identifier": "@mrfentmen/cs2-agents-mcp",
14
+ "version": "1.0.0",
15
+ "transport": {
16
+ "type": "stdio"
17
+ }
18
+ }
19
+ ]
20
+ }