unsuspend-user
Reactivate a suspended GitHub Enterprise user by providing their username, enabling full access to repositories, issues, and workflows through the MCP server integration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | Username of the user to unsuspend |
Implementation Reference
- server/index.ts:2068-2110 (registration)Registration of the MCP tool 'unsuspend-user' including Zod input schema (username: string) and handler function that checks for GitHub Enterprise and calls UserManagement.unsuspendUserserver.tool( "unsuspend-user", { username: z.string().describe("Username of the user to unsuspend") }, async ({ username }) => { try { if (!context.isGitHubEnterprise) { return { content: [ { type: "text", text: "User unsuspension is only available in GitHub Enterprise. This operation cannot be performed on GitHub.com." } ], isError: true }; } await context.users.unsuspendUser(context.client, { username }); return { content: [ { type: "text", text: `User '${username}' has been unsuspended.` } ] }; } catch (error: any) { console.error('Error unsuspending user:', error); return { content: [ { type: "text", text: `An error occurred while unsuspending user: ${error.message}` } ], isError: true }; } } );
- api/users/users.ts:283-316 (handler)Core handler implementation: unsuspendUser method in UserManagement class that performs the axios DELETE request to the GitHub Enterprise admin API endpoint /admin/users/{username}/suspended to unsuspend the user./** * Unsuspend a user in GitHub Enterprise * * @param client - GitHub API client * @param params - Parameters with username to unsuspend * @returns Promise that resolves to true if successful */ async unsuspendUser(client: any, params: UnsuspendUserParams): Promise<boolean> { try { const { baseUrl, token } = client; const { username } = params; if (!username) { throw new Error('Username is required'); } const url = `${baseUrl}/admin/users/${username}/suspended`; await axios.delete(url, { headers: { Authorization: `token ${token}`, Accept: 'application/vnd.github.v3+json' } }); return true; } catch (error: any) { if (error.response?.status === 404) { throw new Error(`User '${params.username}' not found or admin endpoint not available`); } throw new Error(`Failed to unsuspend user: ${error.message}`); } }
- api/users/types.ts:177-184 (schema)TypeScript type definition for UnsuspendUserParams interface used as input type for the unsuspendUser function.* Parameters to unsuspend a user */ export interface UnsuspendUserParams { /** * Username of the user to unsuspend */ username: string; }