Skip to main content
Glama

Twitch MCP Server

by mtane0412
game.ts1.22 kB
import { ApiClient } from '@twurple/api'; import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js'; import { formatResponse } from '../../utils/twitch.js'; export async function handleGetTopGames(apiClient: ApiClient, args: { limit?: number }) { const games = await apiClient.games.getTopGames({ limit: args.limit }); return formatResponse( games.data.map(game => ({ id: game.id, name: game.name, boxArtUrl: game.boxArtUrl, })) ); } export async function handleGetGame(apiClient: ApiClient, args: { name: string }) { const game = await apiClient.games.getGameByName(args.name); if (!game) { throw new McpError(ErrorCode.InvalidParams, `Game "${args.name}" not found`); } return formatResponse({ id: game.id, name: game.name, boxArtUrl: game.boxArtUrl, }); } export async function handleSearchCategories( apiClient: ApiClient, args: { query: string; limit?: number } ) { const categories = await apiClient.search.searchCategories(args.query, { limit: args.limit }); return formatResponse( categories.data.map(category => ({ id: category.id, name: category.name, boxArtUrl: category.boxArtUrl, })) ); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mtane0412/twitch-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server