cs2-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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cito API
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 CHANGED
@@ -1,3 +1,69 @@
1
- # Temporary Holding Version
1
+ # Counter-Strike 2 (CS2) Esports MCP Server (`cs2-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
+ Model Context Protocol (MCP) server for Counter-Strike 2 (CS2): live scoreboards, Valve VRS rankings, map vetoes, round economy, opening duels, 1vX clutches, skin prices, and multi-bookmaker/Polymarket odds via Cito API.
4
+
5
+ Built for Claude Desktop, Cursor, Windsurf, Cline, and any [Model Context Protocol (MCP)](https://modelcontextprotocol.io) client. Starts cleanly without an API key so MCP clients and registries can inspect the full tool catalog and call offline tools immediately.
6
+
7
+ - **API Documentation:** [citoapi.com/docs](https://citoapi.com/docs?utm_source=github&utm_medium=mcp&utm_campaign=cs2-mcp)
8
+ - **Get Free API Key:** [citoapi.com/signup](https://citoapi.com/signup?utm_source=github&utm_medium=mcp&utm_campaign=cs2-mcp)
9
+
10
+ ## Curated Read-Only Tools (12)
11
+
12
+ | Tool | Title |
13
+ | --- | --- |
14
+ | `list_capabilities` | List Counter-Strike 2 (CS2) Esports MCP Capabilities |
15
+ | `check_api_health` | Check Cito API Health & Plan Limits |
16
+ | `get_cs2_live_matches` | Get Live CS2 Matches |
17
+ | `get_cs2_live_scoreboard` | Get Live CS2 Round Scoreboard |
18
+ | `get_cs2_matches` | Get CS2 Upcoming, Today & Completed Matches |
19
+ | `get_cs2_match_maps_and_vetoes` | Get CS2 Match Maps, Vetoes & Player Box Scores |
20
+ | `get_cs2_rankings` | Get CS2 Valve VRS & World Rankings |
21
+ | `get_cs2_team_map_stats` | Get CS2 Team Map Pool & CT/T Side Splits |
22
+ | `get_cs2_player_analytics` | Get CS2 Opening Duels, Clutches & Utility Leaders |
23
+ | `get_cs2_skins` | Get CS2 Skin Market Prices & Trending Movers |
24
+ | `get_cs2_odds` | Get CS2 Multi-Bookmaker, Polymarket Odds & Props |
25
+ | `search_cs2_entities` | Search CS2 Teams, Players & Events |
26
+
27
+ ## Quick Start
28
+
29
+ ### Run via npx
30
+
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "cs2-mcp": {
35
+ "command": "npx",
36
+ "args": ["-y", "cs2-mcp"],
37
+ "env": {
38
+ "CITO_API_KEY": "YOUR_CITO_API_KEY"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ ```
44
+
45
+ ### Run from Source or Docker
46
+
47
+ ```bash
48
+ git clone https://github.com/Cito-GG/cs2-mcp.git
49
+ cd cs2-mcp
50
+ npm install
51
+ npm run build
52
+ npm test
53
+ ```
54
+
55
+ ```bash
56
+ docker build -t cs2-mcp .
57
+ docker run -i --rm -e CITO_API_KEY="YOUR_CITO_API_KEY" cs2-mcp
58
+ ```
59
+
60
+ ## Environment Variables
61
+
62
+ | Variable | Required at Startup | Default | Description |
63
+ | --- | --- | --- | --- |
64
+ | `CITO_API_KEY` | No (required for live API calls) | `""` | Cito API key sent via `X-API-Key`. |
65
+ | `CITO_API_BASE` | No | `https://api.citoapi.com/api/v1` | Base URL for the Cito REST API. |
66
+
67
+ ## License
68
+
69
+ MIT. See [LICENSE](LICENSE).
package/dist/index.js ADDED
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
5
+ import { DEFAULT_API_BASE, errEnvelope, toMcpContent } from './runtime.js';
6
+ import { allTools, getTool } from './tools.js';
7
+ export const SERVER_NAME = 'cs2-mcp';
8
+ export const SERVER_VERSION = '1.0.0';
9
+ const apiKey = (process.env.CITO_API_KEY ?? '').trim();
10
+ const baseUrl = (process.env.CITO_API_BASE || DEFAULT_API_BASE).replace(/\/+$/, '');
11
+ if (!apiKey) {
12
+ console.error('[cs2-mcp] CITO_API_KEY is not set. Serving tool catalog and offline tools only; ' +
13
+ 'API-backed tools will return UNAUTHORIZED until CITO_API_KEY is configured.');
14
+ }
15
+ const ctx = { apiKey, baseUrl };
16
+ export function createServer() {
17
+ const server = new Server({ name: SERVER_NAME, version: SERVER_VERSION }, {
18
+ capabilities: { tools: {}, resources: {} },
19
+ instructions: 'Read-only MCP server for Counter-Strike 2 (CS2) Esports powered by Cito API. Call list_capabilities offline to inspect all tools and recommended sequences.',
20
+ });
21
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
22
+ tools: allTools.map((t) => ({
23
+ name: t.name,
24
+ title: t.title,
25
+ description: t.description,
26
+ inputSchema: t.inputSchema,
27
+ annotations: t.annotations,
28
+ })),
29
+ }));
30
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
31
+ const started = Date.now();
32
+ const { name } = request.params;
33
+ const args = (request.params.arguments ?? {});
34
+ const tool = getTool(name);
35
+ if (!tool) {
36
+ return toMcpContent(errEnvelope(SERVER_NAME, null, started, 'VALIDATION', `Unknown tool: ${name}`, undefined, [
37
+ 'Call list_capabilities to inspect available tools.',
38
+ ]));
39
+ }
40
+ if (!tool.offline && !ctx.apiKey) {
41
+ return toMcpContent(errEnvelope(SERVER_NAME, null, started, 'UNAUTHORIZED', 'CITO_API_KEY is not set. Set CITO_API_KEY in your MCP client environment to query live Cito API data.', 401, [
42
+ 'Get a free API key at https://citoapi.com/signup?utm_source=github&utm_medium=mcp&utm_campaign=cs2-mcp',
43
+ 'Set CITO_API_KEY in claude_desktop_config.json or .cursor/mcp.json',
44
+ 'Call list_capabilities offline to browse available tools',
45
+ ]));
46
+ }
47
+ try {
48
+ const env = await tool.handler(args, ctx);
49
+ return toMcpContent(env);
50
+ }
51
+ catch (err) {
52
+ return toMcpContent(errEnvelope(name, null, started, 'INTERNAL_ERROR', err instanceof Error ? err.message : String(err)));
53
+ }
54
+ });
55
+ server.setRequestHandler(ListResourcesRequestSchema, async () => ({
56
+ resources: [
57
+ {
58
+ uri: 'cito://capabilities',
59
+ name: 'cs2-mcp capabilities',
60
+ description: 'Static catalog of curated tools exposed by cs2-mcp.',
61
+ mimeType: 'application/json',
62
+ },
63
+ ],
64
+ }));
65
+ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
66
+ if (request.params.uri === 'cito://capabilities') {
67
+ return {
68
+ contents: [
69
+ {
70
+ uri: 'cito://capabilities',
71
+ mimeType: 'application/json',
72
+ text: JSON.stringify({
73
+ server: SERVER_NAME,
74
+ version: SERVER_VERSION,
75
+ tools: allTools.map((t) => ({ name: t.name, title: t.title, offline: Boolean(t.offline) })),
76
+ }, null, 2),
77
+ },
78
+ ],
79
+ };
80
+ }
81
+ throw new Error(`Unknown resource: ${request.params.uri}`);
82
+ });
83
+ return server;
84
+ }
85
+ const isMain = process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, '/').split('/').pop() || '');
86
+ if (isMain || process.argv[1]?.endsWith('index.js')) {
87
+ const server = createServer();
88
+ await server.connect(new StdioServerTransport());
89
+ }
@@ -0,0 +1,106 @@
1
+ export const DEFAULT_API_BASE = 'https://api.citoapi.com/api/v1';
2
+ export const READ_ANNOTATIONS = {
3
+ readOnlyHint: true,
4
+ destructiveHint: false,
5
+ idempotentHint: true,
6
+ openWorldHint: true,
7
+ };
8
+ export const OFFLINE_ANNOTATIONS = {
9
+ readOnlyHint: true,
10
+ destructiveHint: false,
11
+ idempotentHint: true,
12
+ openWorldHint: false,
13
+ };
14
+ export function clampInt(value, fallback, min, max) {
15
+ const n = typeof value === 'number' && Number.isFinite(value) ? Math.trunc(value) : fallback;
16
+ return Math.max(min, Math.min(max, n));
17
+ }
18
+ export function cleanStr(value) {
19
+ return typeof value === 'string' ? value.trim() : '';
20
+ }
21
+ export function encodeSeg(value) {
22
+ return encodeURIComponent(value.trim());
23
+ }
24
+ export async function citoGet(ctx, endpoint, query) {
25
+ const base = (ctx.baseUrl || DEFAULT_API_BASE).replace(/\/+$/, '');
26
+ const cleanPath = endpoint.startsWith('/') ? endpoint : `/${endpoint}`;
27
+ const qs = new URLSearchParams();
28
+ if (query) {
29
+ for (const [k, v] of Object.entries(query)) {
30
+ if (v === undefined || v === null || v === '')
31
+ continue;
32
+ qs.append(k, String(v));
33
+ }
34
+ }
35
+ const url = `${base}${cleanPath}${qs.toString() ? `?${qs.toString()}` : ''}`;
36
+ const f = ctx.fetchImpl ?? fetch;
37
+ const controller = new AbortController();
38
+ const timer = setTimeout(() => controller.abort(), 15000);
39
+ try {
40
+ const res = await f(url, {
41
+ method: 'GET',
42
+ headers: {
43
+ 'x-api-key': ctx.apiKey,
44
+ accept: 'application/json',
45
+ 'user-agent': 'cito-sport-mcp/1.0.0 (+https://citoapi.com)',
46
+ },
47
+ signal: controller.signal,
48
+ });
49
+ const rateLimit = {
50
+ tier: res.headers.get('x-cito-tier') ?? res.headers.get('x-plan-tier'),
51
+ limit: res.headers.get('x-ratelimit-limit') ?? res.headers.get('ratelimit-limit'),
52
+ remaining: res.headers.get('x-ratelimit-remaining') ?? res.headers.get('ratelimit-remaining'),
53
+ resetAt: res.headers.get('x-ratelimit-reset') ?? res.headers.get('ratelimit-reset'),
54
+ };
55
+ const text = await res.text();
56
+ let data = null;
57
+ try {
58
+ data = text ? JSON.parse(text) : null;
59
+ }
60
+ catch {
61
+ data = text;
62
+ }
63
+ return { ok: res.ok, status: res.status, data, rateLimit };
64
+ }
65
+ finally {
66
+ clearTimeout(timer);
67
+ }
68
+ }
69
+ export function okEnvelope(source, sport, started, data, rateLimit) {
70
+ return {
71
+ ok: true,
72
+ data,
73
+ meta: {
74
+ source,
75
+ sport,
76
+ tookMs: Date.now() - started,
77
+ ...(rateLimit ? { rateLimit } : {}),
78
+ },
79
+ };
80
+ }
81
+ export function errEnvelope(source, sport, started, code, message, httpStatus, recover) {
82
+ return {
83
+ ok: false,
84
+ error: { code, message, ...(httpStatus ? { httpStatus } : {}), ...(recover ? { recover } : {}) },
85
+ meta: { source, sport, tookMs: Date.now() - started },
86
+ };
87
+ }
88
+ export function mapHttpCode(status) {
89
+ if (status === 401)
90
+ return 'UNAUTHORIZED';
91
+ if (status === 403)
92
+ return 'FORBIDDEN';
93
+ if (status === 404)
94
+ return 'NOT_FOUND';
95
+ if (status === 429)
96
+ return 'RATE_LIMITED';
97
+ if (status >= 500)
98
+ return 'UPSTREAM_ERROR';
99
+ return 'HTTP_ERROR';
100
+ }
101
+ export function toMcpContent(env) {
102
+ return {
103
+ content: [{ type: 'text', text: JSON.stringify(env, null, 2) }],
104
+ isError: !env.ok,
105
+ };
106
+ }
package/dist/tools.js ADDED
@@ -0,0 +1,399 @@
1
+ import { OFFLINE_ANNOTATIONS, READ_ANNOTATIONS, citoGet, clampInt, cleanStr, encodeSeg, errEnvelope, mapHttpCode, okEnvelope, } from './runtime.js';
2
+ function makeCapabilitiesTool(getAll) {
3
+ return {
4
+ name: 'list_capabilities',
5
+ title: 'List Counter-Strike 2 (CS2) Esports MCP Capabilities',
6
+ offline: true,
7
+ description: `Return the offline catalog of all Counter-Strike 2 (CS2) Esports MCP tools, supported endpoints, and recommended agent call sequence without requiring CITO_API_KEY.
8
+
9
+ When to use:
10
+ - Discovering available tools at session start or verifying server health before setting CITO_API_KEY.
11
+
12
+ Do not use when:
13
+ - You already know which tool to call; invoke that tool directly.
14
+
15
+ Returns: JSON envelope { ok, data: { version, sport, tools, workflow }, meta }.`,
16
+ inputSchema: {
17
+ type: 'object',
18
+ additionalProperties: false,
19
+ properties: {},
20
+ },
21
+ annotations: OFFLINE_ANNOTATIONS,
22
+ handler: async () => {
23
+ const started = Date.now();
24
+ return okEnvelope('list_capabilities', 'cs2', started, {
25
+ version: '1.0.0',
26
+ sport: 'cs2',
27
+ tools: getAll().map((t) => ({
28
+ name: t.name,
29
+ title: t.title,
30
+ offline: Boolean(t.offline),
31
+ summary: t.description.split('\n')[0],
32
+ })),
33
+ workflow: ["get_cs2_live_matches or get_cs2_matches -> discover matchId", "get_cs2_live_scoreboard / get_cs2_match_maps_and_vetoes -> inspect tactical state", "get_cs2_rankings / get_cs2_team_map_stats / get_cs2_skins_and_odds"],
34
+ });
35
+ },
36
+ };
37
+ }
38
+ const checkApiHealth = {
39
+ name: 'check_api_health',
40
+ title: 'Check Cito API Health & Plan Limits',
41
+ description: `Verify Cito API connectivity, API key validity, plan tier, and current rate-limit budget.
42
+
43
+ When to use:
44
+ - Troubleshooting 401/403/429 responses or confirming active API key entitlements.
45
+
46
+ Do not use when:
47
+ - Fetching match data or odds directly.
48
+
49
+ Returns: API health status, plan tier, and rate-limit headers.`,
50
+ inputSchema: {
51
+ type: 'object',
52
+ additionalProperties: false,
53
+ properties: {},
54
+ },
55
+ annotations: READ_ANNOTATIONS,
56
+ handler: async (_args, ctx) => {
57
+ const started = Date.now();
58
+ const res = await citoGet(ctx, '/health');
59
+ if (!res.ok) {
60
+ return errEnvelope('check_api_health', 'cs2', started, mapHttpCode(res.status), `Health check failed (HTTP ${res.status})`, res.status);
61
+ }
62
+ return okEnvelope('check_api_health', 'cs2', started, res.data, res.rateLimit);
63
+ },
64
+ };
65
+ const getCs2LiveMatches = {
66
+ name: 'get_cs2_live_matches',
67
+ title: 'Get Live CS2 Matches',
68
+ description: `Fetch all professional Counter-Strike 2 matches currently in play with active map scores and match IDs.
69
+
70
+ When to use:
71
+ - Discovering live CS2 matches and matchId values before calling get_cs2_live_scoreboard.
72
+
73
+ Do not use when:
74
+ - Querying upcoming fixtures or completed results; call get_cs2_matches instead.
75
+
76
+ Returns: Array of live CS2 series with teams, map scores, and match IDs.`,
77
+ inputSchema: { type: 'object', additionalProperties: false, properties: {} },
78
+ annotations: READ_ANNOTATIONS,
79
+ handler: async (_args, ctx) => {
80
+ const started = Date.now();
81
+ const res = await citoGet(ctx, '/cs2/live');
82
+ if (!res.ok)
83
+ return errEnvelope('get_cs2_live_matches', 'cs2', started, mapHttpCode(res.status), `CS2 live fetch failed (HTTP ${res.status})`, res.status);
84
+ return okEnvelope('get_cs2_live_matches', 'cs2', started, res.data, res.rateLimit);
85
+ },
86
+ };
87
+ const getCs2LiveScoreboard = {
88
+ name: 'get_cs2_live_scoreboard',
89
+ title: 'Get Live CS2 Round Scoreboard',
90
+ description: `Retrieve the live in-game scoreboard for an active CS2 match: current round, bomb state, team scores, and player K/A/D, ADR, HS%, HP, armor, and weapons.
91
+
92
+ When to use:
93
+ - Tracking real-time round state for a known live CS2 matchId.
94
+
95
+ Do not use when:
96
+ - You do not have a live matchId yet; call get_cs2_live_matches first.
97
+
98
+ Returns: Live scoreboard payload for the active match.`,
99
+ inputSchema: {
100
+ type: 'object',
101
+ additionalProperties: false,
102
+ required: ['matchId'],
103
+ properties: {
104
+ matchId: { type: 'string', description: 'CS2 match ID (for example "cs2-match-2400910" or "2400910").' },
105
+ },
106
+ },
107
+ annotations: READ_ANNOTATIONS,
108
+ handler: async (args, ctx) => {
109
+ const started = Date.now();
110
+ const raw = cleanStr(args.matchId);
111
+ if (!raw)
112
+ return errEnvelope('get_cs2_live_scoreboard', 'cs2', started, 'VALIDATION', 'matchId is required');
113
+ const clean = raw.replace(/^cs2-match-/, '');
114
+ const res = await citoGet(ctx, `/cs2/live/${encodeSeg(clean)}/scoreboard`);
115
+ if (!res.ok)
116
+ return errEnvelope('get_cs2_live_scoreboard', 'cs2', started, mapHttpCode(res.status), `Scoreboard fetch failed (HTTP ${res.status})`, res.status);
117
+ return okEnvelope('get_cs2_live_scoreboard', 'cs2', started, res.data, res.rateLimit);
118
+ },
119
+ };
120
+ const getCs2Matches = {
121
+ name: 'get_cs2_matches',
122
+ title: 'Get CS2 Upcoming, Today & Completed Matches',
123
+ description: `Fetch upcoming, today, or recently completed professional CS2 matches.
124
+
125
+ When to use:
126
+ - Listing today's CS2 schedule, upcoming LAN/online series, or recent final scores.
127
+
128
+ Do not use when:
129
+ - Checking live round-by-round scoreboards; call get_cs2_live_matches instead.
130
+
131
+ Returns: List of CS2 matches with teams, tournament, format, and scores.`,
132
+ inputSchema: {
133
+ type: 'object',
134
+ additionalProperties: false,
135
+ properties: {
136
+ scope: { type: 'string', enum: ['upcoming', 'results', 'today'], default: 'upcoming', description: 'Which CS2 match list to retrieve.' },
137
+ limit: { type: 'integer', minimum: 1, maximum: 50, default: 25, description: 'Maximum matches to return.' },
138
+ },
139
+ },
140
+ annotations: READ_ANNOTATIONS,
141
+ handler: async (args, ctx) => {
142
+ const started = Date.now();
143
+ const scope = cleanStr(args.scope) || 'upcoming';
144
+ const endpoint = scope === 'results' ? '/cs2/matches/results' : scope === 'today' ? '/cs2/matches/today' : '/cs2/matches/upcoming';
145
+ const res = await citoGet(ctx, endpoint, scope === 'today' ? undefined : { limit: clampInt(args.limit, 25, 1, 50) });
146
+ if (!res.ok)
147
+ return errEnvelope('get_cs2_matches', 'cs2', started, mapHttpCode(res.status), `Matches fetch failed (HTTP ${res.status})`, res.status);
148
+ return okEnvelope('get_cs2_matches', 'cs2', started, res.data, res.rateLimit);
149
+ },
150
+ };
151
+ const getCs2MatchMapsAndVetoes = {
152
+ name: 'get_cs2_match_maps_and_vetoes',
153
+ title: 'Get CS2 Match Maps, Vetoes & Player Box Scores',
154
+ description: `Fetch full match summary, map pick/ban veto sequence, per-map scores, and player combat stats for one CS2 matchId.
155
+
156
+ When to use:
157
+ - Analyzing a completed or live series map pool, vetoes, and player K/D/ADR ratings.
158
+
159
+ Do not use when:
160
+ - You need team-wide historical map pool averages; call get_cs2_team_map_stats instead.
161
+
162
+ Returns: Combined match details, map breakdown, and player statistics.`,
163
+ inputSchema: {
164
+ type: 'object',
165
+ additionalProperties: false,
166
+ required: ['matchId'],
167
+ properties: {
168
+ matchId: { type: 'string', description: 'Canonical CS2 match ID.' },
169
+ },
170
+ },
171
+ annotations: READ_ANNOTATIONS,
172
+ handler: async (args, ctx) => {
173
+ const started = Date.now();
174
+ const matchId = cleanStr(args.matchId);
175
+ if (!matchId)
176
+ return errEnvelope('get_cs2_match_maps_and_vetoes', 'cs2', started, 'VALIDATION', 'matchId is required');
177
+ const [matchRes, mapsRes, statsRes] = await Promise.all([
178
+ citoGet(ctx, `/cs2/matches/${encodeSeg(matchId)}`),
179
+ citoGet(ctx, `/cs2/matches/${encodeSeg(matchId)}/maps`),
180
+ citoGet(ctx, `/cs2/matches/${encodeSeg(matchId)}/player-stats`),
181
+ ]);
182
+ if (!matchRes.ok)
183
+ return errEnvelope('get_cs2_match_maps_and_vetoes', 'cs2', started, mapHttpCode(matchRes.status), `Match fetch failed (HTTP ${matchRes.status})`, matchRes.status);
184
+ return okEnvelope('get_cs2_match_maps_and_vetoes', 'cs2', started, {
185
+ match: matchRes.data,
186
+ maps: mapsRes.ok ? mapsRes.data : null,
187
+ playerStats: statsRes.ok ? statsRes.data : null,
188
+ }, matchRes.rateLimit);
189
+ },
190
+ };
191
+ const getCs2Rankings = {
192
+ name: 'get_cs2_rankings',
193
+ title: 'Get CS2 Valve VRS & World Rankings',
194
+ description: `Retrieve the official Valve Regional Standings (VRS) or global CS2 world rankings table.
195
+
196
+ When to use:
197
+ - Answering "What are the current Valve VRS rankings for CS2?" or checking Top 30 teams.
198
+
199
+ Do not use when:
200
+ - Inspecting one team's map win rates; call get_cs2_team_map_stats instead.
201
+
202
+ Returns: Ranked CS2 team standings with rank, team name, ID, and rating points.`,
203
+ inputSchema: {
204
+ type: 'object',
205
+ additionalProperties: false,
206
+ properties: {
207
+ board: { type: 'string', enum: ['vrs', 'world'], default: 'vrs', description: 'Ranking board: vrs (Valve Regional Standings) or world.' },
208
+ limit: { type: 'integer', minimum: 1, maximum: 100, default: 30, description: 'Maximum ranked teams to return.' },
209
+ },
210
+ },
211
+ annotations: READ_ANNOTATIONS,
212
+ handler: async (args, ctx) => {
213
+ const started = Date.now();
214
+ const path = args.board === 'world' ? '/cs2/rankings/world' : '/cs2/rankings/vrs';
215
+ const res = await citoGet(ctx, path, { limit: clampInt(args.limit, 30, 1, 100) });
216
+ if (!res.ok)
217
+ return errEnvelope('get_cs2_rankings', 'cs2', started, mapHttpCode(res.status), `Rankings fetch failed (HTTP ${res.status})`, res.status);
218
+ return okEnvelope('get_cs2_rankings', 'cs2', started, res.data, res.rateLimit);
219
+ },
220
+ };
221
+ const getCs2TeamMapStats = {
222
+ name: 'get_cs2_team_map_stats',
223
+ title: 'Get CS2 Team Map Pool & CT/T Side Splits',
224
+ description: `Retrieve a CS2 team's win rate and CT/T side performance across Mirage, Inferno, Nuke, Dust2, Ancient, Anubis, and Vertigo over a rolling window.
225
+
226
+ When to use:
227
+ - Pre-match veto modeling and map-pool comparison for a specific teamId or slug.
228
+
229
+ Do not use when:
230
+ - Searching for a team ID; call search_cs2_entities first.
231
+
232
+ Returns: Per-map win percentages, rounds won, and side splits.`,
233
+ inputSchema: {
234
+ type: 'object',
235
+ additionalProperties: false,
236
+ required: ['teamId'],
237
+ properties: {
238
+ teamId: { type: 'string', description: 'CS2 team ID or slug (for example "cs2-team-4608" or "natus-vincere").' },
239
+ days: { type: 'integer', minimum: 14, maximum: 365, default: 90, description: 'Rolling window in days (default 90).' },
240
+ },
241
+ },
242
+ annotations: READ_ANNOTATIONS,
243
+ handler: async (args, ctx) => {
244
+ const started = Date.now();
245
+ const teamId = cleanStr(args.teamId);
246
+ if (!teamId)
247
+ return errEnvelope('get_cs2_team_map_stats', 'cs2', started, 'VALIDATION', 'teamId is required');
248
+ const res = await citoGet(ctx, `/cs2/teams/${encodeSeg(teamId)}/map-stats`, { days: clampInt(args.days, 90, 14, 365) });
249
+ if (!res.ok)
250
+ return errEnvelope('get_cs2_team_map_stats', 'cs2', started, mapHttpCode(res.status), `Team map stats failed (HTTP ${res.status})`, res.status);
251
+ return okEnvelope('get_cs2_team_map_stats', 'cs2', started, res.data, res.rateLimit);
252
+ },
253
+ };
254
+ const getCs2PlayerAnalytics = {
255
+ name: 'get_cs2_player_analytics',
256
+ title: 'Get CS2 Opening Duels, Clutches & Utility Leaders',
257
+ description: `Query advanced CS2 player leaderboards or single-player tactical profiles across opening duels (first kills), 1vX clutches, or flashbang utility efficiency.
258
+
259
+ When to use:
260
+ - Evaluating entry fraggers, clutch specialists, or utility impact across pro CS2.
261
+
262
+ Do not use when:
263
+ - Checking team world rankings; call get_cs2_rankings instead.
264
+
265
+ Returns: Tactical leaderboard or single-player stat breakdown.`,
266
+ inputSchema: {
267
+ type: 'object',
268
+ additionalProperties: false,
269
+ properties: {
270
+ metric: { type: 'string', enum: ['opening_duels', 'clutches', 'utility'], default: 'opening_duels', description: 'Tactical category to query.' },
271
+ playerId: { type: 'string', description: 'Optional player ID or slug (for opening_duels or clutches).' },
272
+ limit: { type: 'integer', minimum: 1, maximum: 100, default: 20, description: 'Maximum leaderboard rows.' },
273
+ },
274
+ },
275
+ annotations: READ_ANNOTATIONS,
276
+ handler: async (args, ctx) => {
277
+ const started = Date.now();
278
+ const metric = cleanStr(args.metric) || 'opening_duels';
279
+ const player = cleanStr(args.playerId);
280
+ const limit = clampInt(args.limit, 20, 1, 100);
281
+ let path = '/cs2/stats/opening-duels';
282
+ if (metric === 'opening_duels' && player)
283
+ path = `/cs2/players/${encodeSeg(player)}/opening-duels`;
284
+ else if (metric === 'clutches')
285
+ path = player ? `/cs2/players/${encodeSeg(player)}/clutches` : '/cs2/stats/clutches';
286
+ else if (metric === 'utility')
287
+ path = '/cs2/stats/utility';
288
+ const res = await citoGet(ctx, path, { limit });
289
+ if (!res.ok)
290
+ return errEnvelope('get_cs2_player_analytics', 'cs2', started, mapHttpCode(res.status), `Analytics fetch failed (HTTP ${res.status})`, res.status);
291
+ return okEnvelope('get_cs2_player_analytics', 'cs2', started, res.data, res.rateLimit);
292
+ },
293
+ };
294
+ const getCs2Skins = {
295
+ name: 'get_cs2_skins',
296
+ title: 'Get CS2 Skin Market Prices & Trending Movers',
297
+ description: `Query Counter-Strike 2 skin market prices or top trending price gainers and losers.
298
+
299
+ When to use:
300
+ - Analyzing CS2 skin market snapshots, wear-tier valuations, and daily price movers.
301
+
302
+ Do not use when:
303
+ - Fetching esports match scores or betting odds.
304
+
305
+ Returns: CS2 skin price snapshot or trending gainers/losers list.`,
306
+ inputSchema: {
307
+ type: 'object',
308
+ additionalProperties: false,
309
+ properties: {
310
+ mode: { type: 'string', enum: ['snapshot', 'trending'], default: 'trending', description: 'snapshot (/cs2/skins) or trending (/cs2/skins/trending).' },
311
+ limit: { type: 'integer', minimum: 1, maximum: 100, default: 20, description: 'Maximum items to return.' },
312
+ },
313
+ },
314
+ annotations: READ_ANNOTATIONS,
315
+ handler: async (args, ctx) => {
316
+ const started = Date.now();
317
+ const path = args.mode === 'snapshot' ? '/cs2/skins' : '/cs2/skins/trending';
318
+ const res = await citoGet(ctx, path, { limit: clampInt(args.limit, 20, 1, 100) });
319
+ if (!res.ok)
320
+ return errEnvelope('get_cs2_skins', 'cs2', started, mapHttpCode(res.status), `Skins fetch failed (HTTP ${res.status})`, res.status);
321
+ return okEnvelope('get_cs2_skins', 'cs2', started, res.data, res.rateLimit);
322
+ },
323
+ };
324
+ const getCs2Odds = {
325
+ name: 'get_cs2_odds',
326
+ title: 'Get CS2 Multi-Bookmaker, Polymarket Odds & Props',
327
+ description: `Fetch CS2 match moneyline, map handicap, round totals, Polymarket prediction market prices, or DFS player props.
328
+
329
+ When to use:
330
+ - Comparing CS2 match lines across sportsbooks and Polymarket or inspecting player kill props.
331
+
332
+ Do not use when:
333
+ - Querying match map vetoes without odds; call get_cs2_match_maps_and_vetoes instead.
334
+
335
+ Returns: Multi-bookmaker CS2 odds board or player props payload.`,
336
+ inputSchema: {
337
+ type: 'object',
338
+ additionalProperties: false,
339
+ properties: {
340
+ includeProps: { type: 'boolean', default: false, description: 'When true, fetches DFS player props (/cs2/props).' },
341
+ bookmaker: { type: 'string', description: 'Optional bookmaker filter (for example "pinnacle", "polymarket", "fanduel").' },
342
+ market: { type: 'string', description: 'Optional market filter (h2h, map_h2h_1, map_handicap, total_rounds).' },
343
+ status: { type: 'string', enum: ['live', 'upcoming', 'completed'], description: 'Optional status filter.' },
344
+ limit: { type: 'integer', minimum: 1, maximum: 50, default: 20, description: 'Maximum records to return.' },
345
+ },
346
+ },
347
+ annotations: READ_ANNOTATIONS,
348
+ handler: async (args, ctx) => {
349
+ const started = Date.now();
350
+ const path = args.includeProps === true ? '/cs2/props' : '/cs2/odds';
351
+ const res = await citoGet(ctx, path, {
352
+ bookmaker: cleanStr(args.bookmaker) || undefined,
353
+ market: cleanStr(args.market) || undefined,
354
+ status: cleanStr(args.status) || undefined,
355
+ limit: clampInt(args.limit, 20, 1, 50),
356
+ });
357
+ if (!res.ok)
358
+ return errEnvelope('get_cs2_odds', 'cs2', started, mapHttpCode(res.status), `CS2 odds fetch failed (HTTP ${res.status})`, res.status);
359
+ return okEnvelope('get_cs2_odds', 'cs2', started, res.data, res.rateLimit);
360
+ },
361
+ };
362
+ const searchCs2Entities = {
363
+ name: 'search_cs2_entities',
364
+ title: 'Search CS2 Teams, Players & Events',
365
+ description: `Search Counter-Strike 2 teams, players, and tournaments by name to discover canonical Cito IDs and slugs.
366
+
367
+ When to use:
368
+ - Translating a team or player name (for example "Team Vitality", "ZywOo") into a canonical ID before calling map-stats or analytics tools.
369
+
370
+ Do not use when:
371
+ - You already have the teamId or playerId.
372
+
373
+ Returns: Ranked matching CS2 entities.`,
374
+ inputSchema: {
375
+ type: 'object',
376
+ additionalProperties: false,
377
+ required: ['q'],
378
+ properties: {
379
+ q: { type: 'string', description: 'Search query string.' },
380
+ limit: { type: 'integer', minimum: 1, maximum: 50, default: 15, description: 'Maximum search hits.' },
381
+ },
382
+ },
383
+ annotations: READ_ANNOTATIONS,
384
+ handler: async (args, ctx) => {
385
+ const started = Date.now();
386
+ const q = cleanStr(args.q);
387
+ if (!q)
388
+ return errEnvelope('search_cs2_entities', 'cs2', started, 'VALIDATION', 'q is required');
389
+ const res = await citoGet(ctx, '/cs2/search', { q, limit: clampInt(args.limit, 15, 1, 50) });
390
+ if (!res.ok)
391
+ return errEnvelope('search_cs2_entities', 'cs2', started, mapHttpCode(res.status), `Search failed (HTTP ${res.status})`, res.status);
392
+ return okEnvelope('search_cs2_entities', 'cs2', started, res.data, res.rateLimit);
393
+ },
394
+ };
395
+ export const allTools = [];
396
+ allTools.push(makeCapabilitiesTool(() => allTools), checkApiHealth, searchCs2Entities, getCs2LiveMatches, getCs2LiveScoreboard, getCs2Matches, getCs2MatchMapsAndVetoes, getCs2Rankings, getCs2TeamMapStats, getCs2PlayerAnalytics, getCs2Skins, getCs2Odds);
397
+ export function getTool(name) {
398
+ return allTools.find((t) => t.name === name);
399
+ }
package/glama.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://glama.ai/mcp/schemas/server.json",
3
+ "maintainers": [
4
+ "Cito-GG"
5
+ ]
6
+ }
package/package.json CHANGED
@@ -1,6 +1,55 @@
1
1
  {
2
2
  "name": "cs2-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": "Model Context Protocol (MCP) server for Counter-Strike 2 (CS2): live scoreboards, Valve VRS rankings, map vetoes, round economy, opening duels, 1vX clutches, skin prices, and multi-bookmaker/Polymarket odds via Cito API.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Cito API <support@citoapi.com>",
8
+ "homepage": "https://citoapi.com/docs?utm_source=github&utm_medium=mcp&utm_campaign=cs2-mcp",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Cito-GG/cs2-mcp.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/Cito-GG/cs2-mcp/issues"
15
+ },
16
+ "keywords": [
17
+ "mcp",
18
+ "model-context-protocol",
19
+ "cs2",
20
+ "counter-strike-2",
21
+ "cs2-mcp",
22
+ "vrs-rankings",
23
+ "cs2-skins",
24
+ "esports-api",
25
+ "citoapi"
26
+ ],
27
+ "bin": {
28
+ "cs2-mcp": "dist/index.js"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "README.md",
33
+ "LICENSE",
34
+ "glama.json",
35
+ "smithery.yaml",
36
+ "server.json"
37
+ ],
38
+ "engines": {
39
+ "node": ">=20.0.0"
40
+ },
41
+ "scripts": {
42
+ "build": "tsc -p tsconfig.json",
43
+ "start": "node dist/index.js",
44
+ "smoke": "node scripts/smoke.mjs",
45
+ "test": "node --test test/mcp.test.mjs && node scripts/smoke.mjs",
46
+ "prepublishOnly": "npm run build && npm test"
47
+ },
48
+ "dependencies": {
49
+ "@modelcontextprotocol/sdk": "1.29.0"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^22.10.0",
53
+ "typescript": "^5.9.2"
54
+ }
55
+ }
package/server.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json",
3
+ "name": "io.github.Cito-GG/cs2-mcp",
4
+ "description": "Model Context Protocol (MCP) server for Counter-Strike 2 (CS2): live scoreboards, Valve VRS rankings, map vetoes, round economy, opening duels, 1vX clutches, skin prices, and multi-bookmaker/Polymarket odds via Cito API.",
5
+ "repository": {
6
+ "url": "https://github.com/Cito-GG/cs2-mcp",
7
+ "source": "github"
8
+ },
9
+ "version": "1.0.0",
10
+ "packages": [
11
+ {
12
+ "registryType": "npm",
13
+ "identifier": "cs2-mcp",
14
+ "version": "1.0.0",
15
+ "transport": {
16
+ "type": "stdio"
17
+ },
18
+ "environmentVariables": [
19
+ {
20
+ "name": "CITO_API_KEY",
21
+ "description": "Cito API key from citoapi.com/signup (optional for offline catalog inspection, required for live queries).",
22
+ "isRequired": false,
23
+ "isSecret": true
24
+ },
25
+ {
26
+ "name": "CITO_API_BASE",
27
+ "description": "Optional override for Cito API base URL (default: https://api.citoapi.com/api/v1).",
28
+ "isRequired": false,
29
+ "isSecret": false
30
+ }
31
+ ]
32
+ }
33
+ ]
34
+ }
package/smithery.yaml ADDED
@@ -0,0 +1,24 @@
1
+ startCommand:
2
+ type: stdio
3
+ configSchema:
4
+ type: object
5
+ required: []
6
+ properties:
7
+ citoApiKey:
8
+ type: string
9
+ title: Cito API Key
10
+ description: Optional at startup for catalog inspection; required for live Cito API queries. Get a key at https://citoapi.com/signup?utm_source=smithery&utm_medium=mcp&utm_campaign=cs2-mcp
11
+ citoApiBase:
12
+ type: string
13
+ title: Cito API Base URL
14
+ default: https://api.citoapi.com/api/v1
15
+ description: Base URL for the Cito REST API.
16
+ commandFunction: |-
17
+ (config) => ({
18
+ command: 'node',
19
+ args: ['dist/index.js'],
20
+ env: {
21
+ ...(config.citoApiKey ? { CITO_API_KEY: config.citoApiKey } : {}),
22
+ CITO_API_BASE: config.citoApiBase || 'https://api.citoapi.com/api/v1'
23
+ }
24
+ })