github_apps_get_webhook_config_for_app
Retrieve the webhook configuration for a GitHub App to inspect current settings. Ideal for auditing or debugging webhook payloads.
Instructions
Get a webhook configuration for an app
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/apps.ts:28-30 (handler)The handler function that executes the tool logic. It makes a GET request to `/app/hook/config` to retrieve the webhook configuration for the GitHub App.
handler: async (args: Record<string, any>) => { return githubRequest("GET", `/app/hook/config`, undefined, undefined); }, - src/tools/apps.ts:27-27 (schema)The input schema for the tool. It takes no parameters (`z.object({})`).
inputSchema: z.object({}), - src/tools/apps.ts:5-31 (registration)The tool definition is part of the `appsTools` array exported from `src/tools/apps.ts`. The tool object has name, description, inputSchema, and handler fields.
export const appsTools = [ { name: "github_apps_get_authenticated", description: "Get the authenticated app", inputSchema: z.object({}), handler: async (args: Record<string, any>) => { return githubRequest("GET", `/app`, undefined, undefined); }, }, { name: "github_apps_create_from_manifest", description: "Create a GitHub App from a manifest", inputSchema: z.object({ code: z.string().describe("code") }), handler: async (args: Record<string, any>) => { return githubRequest("POST", `/app-manifests/${args.code}/conversions`, undefined, undefined); }, }, { name: "github_apps_get_webhook_config_for_app", description: "Get a webhook configuration for an app", inputSchema: z.object({}), handler: async (args: Record<string, any>) => { return githubRequest("GET", `/app/hook/config`, undefined, undefined); }, }, - src/index.ts:110-130 (registration)Tools are registered via `server.tool()` in a loop over all tool modules. Each tool's name, description, inputSchema, and handler are passed to the MCP server.
for (const tool of allTools) { server.tool( tool.name, tool.description, tool.inputSchema.shape as any, async (args: any) => { try { const result = await tool.handler(args as any); return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], }; } catch (err) { const message = err instanceof Error ? err.message : String(err); return { content: [{ type: "text" as const, text: `Error: ${message}` }], isError: true, }; } } ); } - src/client.ts:9-59 (helper)The `githubRequest` helper function that makes authenticated HTTP requests to the GitHub API. It's used by the tool handler to execute the GET request.
export async function githubRequest<T>( method: string, path: string, body?: Record<string, unknown>, params?: Record<string, string | number | boolean | string[] | undefined> ): Promise<T> { const url = new URL(`${BASE_URL}${path}`); if (params) { for (const [key, value] of Object.entries(params)) { if (value === undefined || value === null || value === "") continue; if (Array.isArray(value)) { url.searchParams.set(key, value.join(",")); } else { url.searchParams.set(key, String(value)); } } } const headers: Record<string, string> = { Authorization: `Bearer ${getToken()}`, Accept: "application/vnd.github+json", "X-GitHub-Api-Version": "2022-11-28", "User-Agent": "github-mcp/1.0.0", }; if (body) { headers["Content-Type"] = "application/json"; } const res = await fetch(url.toString(), { method, headers, body: body ? JSON.stringify(body) : undefined, }); if (!res.ok) { const text = await res.text().catch(() => ""); let detail = text; try { const json = JSON.parse(text); detail = json.message || text; if (json.errors) detail += ` -- ${JSON.stringify(json.errors)}`; } catch {} throw new Error(`GitHub API error ${res.status}: ${detail}`); } if (res.status === 204) return {} as T; return res.json() as Promise<T>; }