Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

get-enterprise-stats

Retrieve GitHub Enterprise statistics to monitor usage metrics and organizational data for enterprise-level GitHub instances.

Instructions

Get GitHub Enterprise statistics (only available for GitHub Enterprise)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'get-enterprise-stats' tool. It checks if GitHub Enterprise is configured, fetches stats from '/enterprise/stats/all' endpoint, or returns an error message.
    export async function getEnterpriseStats(): Promise<any> {
      const github = getGitHubApi();
      const baseUrl = process.env.GITHUB_API_URL;
    
      // This function is only available for GitHub Enterprise
      if (!baseUrl) {
        return {
          error: 'This function is only available for GitHub Enterprise',
        };
      }
    
      return tryCatchAsync(async () => {
        try {
          // Try to get enterprise stats
          const { data } = await github.getOctokit().request('GET /enterprise/stats/all');
          return data;
        } catch (error) {
          // If not available, return basic information
          return {
            message: 'Enterprise stats not available or insufficient permissions',
            api_url: baseUrl,
          };
        }
      }, 'Failed to get enterprise stats');
    }
  • Registration of the 'get-enterprise-stats' tool in the server's listTools response, including its description and empty input schema.
    {
      name: 'get-enterprise-stats',
      description: 'Get GitHub Enterprise statistics (only available for GitHub Enterprise)',
      inputSchema: {
        type: 'object',
        properties: {},
        additionalProperties: false,
      },
    },
  • Dispatch case in the CallToolRequest handler that invokes the getEnterpriseStats function.
    case 'get-enterprise-stats':
      result = await getEnterpriseStats();
      break;

Latest Blog Posts

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/piyushgIITian/github-enterprice-mcp'

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