UNPKG

@cyanheads/git-mcp-server

Version:

An MCP (Model Context Protocol) server enabling LLMs and AI agents to interact with Git repositories. Provides tools for comprehensive Git operations including clone, commit, branch, diff, log, status, push, pull, merge, rebase, worktree, tag management,

87 lines 4.2 kB
/** * @fileoverview Loads, validates, and exports application configuration. * This module centralizes configuration management, sourcing values from * environment variables and `package.json`. It uses Zod for schema validation * to ensure type safety and correctness of configuration parameters. * * Key responsibilities: * - Load environment variables from a `.env` file. * - Read `package.json` for default server name and version. * - Define a Zod schema for all expected environment variables. * - Validate environment variables against the schema. * - Construct and export a comprehensive `config` object. * - Export individual configuration values like `logLevel` and `environment` for convenience. * * @module src/config/index */ /** * Main application configuration object. * Aggregates settings from validated environment variables and `package.json`. */ export declare const config: { /** Information from package.json. */ pkg: { name: string; version: string; }; /** MCP server name. Env `MCP_SERVER_NAME` > `package.json` name > "git-mcp-server". */ mcpServerName: string; /** MCP server version. Env `MCP_SERVER_VERSION` > `package.json` version > "0.0.0". */ mcpServerVersion: string; /** Logging level. From `MCP_LOG_LEVEL` env var. Default: "info". */ logLevel: string; /** Absolute path to the logs directory. From `LOGS_DIR` env var. */ logsPath: string | null; /** Runtime environment. From `NODE_ENV` env var. Default: "development". */ environment: string; /** MCP transport type ('stdio' or 'http'). From `MCP_TRANSPORT_TYPE` env var. Default: "stdio". */ mcpTransportType: "stdio" | "http"; /** MCP session mode ('stateless', 'stateful', 'auto'). From `MCP_SESSION_MODE` env var. Default: "auto". */ mcpSessionMode: "stateless" | "stateful" | "auto"; /** HTTP server port (if http transport). From `MCP_HTTP_PORT` env var. Default: 3010. */ mcpHttpPort: number; /** HTTP server host (if http transport). From `MCP_HTTP_HOST` env var. Default: "127.0.0.1". */ mcpHttpHost: string; /** MCP endpoint path for HTTP transport. From `MCP_HTTP_ENDPOINT_PATH`. Default: "/mcp". */ mcpHttpEndpointPath: string; /** Max retries for port binding. From `MCP_HTTP_MAX_PORT_RETRIES`. Default: 15. */ mcpHttpMaxPortRetries: number; /** Delay between port binding retries. From `MCP_HTTP_PORT_RETRY_DELAY_MS`. Default: 50. */ mcpHttpPortRetryDelayMs: number; /** Timeout for stale stateful sessions. From `MCP_STATEFUL_SESSION_STALE_TIMEOUT_MS`. Default: 1800000. */ mcpStatefulSessionStaleTimeoutMs: number; /** Array of allowed CORS origins (http transport). From `MCP_ALLOWED_ORIGINS` (comma-separated). */ mcpAllowedOrigins: string[] | undefined; /** Auth secret key (JWTs, http transport). From `MCP_AUTH_SECRET_KEY`. CRITICAL. */ mcpAuthSecretKey: string | undefined; /** The authentication mode ('jwt' or 'oauth'). From `MCP_AUTH_MODE`. */ mcpAuthMode: "jwt" | "oauth" | "none"; /** OAuth 2.1 Issuer URL. From `OAUTH_ISSUER_URL`. */ oauthIssuerUrl: string | undefined; /** OAuth 2.1 JWKS URI. From `OAUTH_JWKS_URI`. */ oauthJwksUri: string | undefined; /** OAuth 2.1 Audience. From `OAUTH_AUDIENCE`. */ oauthAudience: string | undefined; /** Development mode client ID. From `DEV_MCP_CLIENT_ID`. */ devMcpClientId: string | undefined; /** Development mode scopes. From `DEV_MCP_SCOPES`. */ devMcpScopes: string[] | undefined; /** Flag to enable GPG signing for commits made by the git_commit tool. Requires server-side GPG setup. */ gitSignCommits: boolean | undefined; /** Security-related configurations. */ security: { /** Indicates if authentication is required for server operations. */ authRequired: boolean; }; }; /** * Configured logging level for the application. * Exported for convenience. */ export declare const logLevel: string; /** * Configured runtime environment ("development", "production", etc.). * Exported for convenience. */ export declare const environment: string; //# sourceMappingURL=index.d.ts.map