Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

update-repository

Modify GitHub repository settings including description, privacy, default branch, and enable/disable features like issues, projects, wiki, or archive status.

Instructions

Update an existing GitHub repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
archivedNoArchive/unarchive repository
default_branchNoChange default branch
descriptionNoNew description
has_issuesNoEnable/disable issues
has_projectsNoEnable/disable projects
has_wikiNoEnable/disable wiki
ownerYesRepository owner
privateNoChange privacy setting
repoYesRepository name

Implementation Reference

  • The main execution handler for the 'update-repository' tool. Parses arguments using Zod schema, uses GitHub Octokit to update repository settings, wraps in error handling, and returns updated repository details.
    export async function updateRepository(args: unknown): Promise<any> {
      const {
        owner,
        repo,
        description,
        private: isPrivate,
        default_branch,
        has_issues,
        has_projects,
        has_wiki,
        archived,
      } = UpdateRepositorySchema.parse(args);
      const github = getGitHubApi();
    
      return tryCatchAsync(async () => {
        const { data } = await github.getOctokit().repos.update({
          owner,
          repo,
          description,
          private: isPrivate,
          default_branch,
          has_issues,
          has_projects,
          has_wiki,
          archived,
        });
    
        return {
          id: data.id,
          name: data.name,
          full_name: data.full_name,
          private: data.private,
          description: data.description,
          html_url: data.html_url,
          default_branch: data.default_branch,
          has_issues: data.has_issues,
          has_projects: data.has_projects,
          has_wiki: data.has_wiki,
          archived: data.archived,
          updated_at: data.updated_at,
        };
      }, 'Failed to update repository');
    }
  • src/server.ts:152-197 (registration)
    MCP tool registration defining the 'update-repository' tool's metadata, description, and input schema for the server.
    {
      name: 'update-repository',
      description: 'Update an existing GitHub repository',
      inputSchema: {
        type: 'object',
        properties: {
          owner: {
            type: 'string',
            description: 'Repository owner',
          },
          repo: {
            type: 'string',
            description: 'Repository name',
          },
          description: {
            type: 'string',
            description: 'New description',
          },
          private: {
            type: 'boolean',
            description: 'Change privacy setting',
          },
          default_branch: {
            type: 'string',
            description: 'Change default branch',
          },
          has_issues: {
            type: 'boolean',
            description: 'Enable/disable issues',
          },
          has_projects: {
            type: 'boolean',
            description: 'Enable/disable projects',
          },
          has_wiki: {
            type: 'boolean',
            description: 'Enable/disable wiki',
          },
          archived: {
            type: 'boolean',
            description: 'Archive/unarchive repository',
          },
        },
        required: ['owner', 'repo'],
        additionalProperties: false,
      },
  • Zod validation schema for 'update-repository' tool inputs, extending OwnerRepoSchema with optional update fields. Used in the handler for argument parsing.
    export const UpdateRepositorySchema = OwnerRepoSchema.extend({
      description: z.string().optional(),
      private: z.boolean().optional(),
      default_branch: z.string().optional(),
      has_issues: z.boolean().optional(),
      has_projects: z.boolean().optional(),
      has_wiki: z.boolean().optional(),
      archived: z.boolean().optional(),
    });
  • Dispatch case in the MCP server's tool request handler that routes 'update-repository' calls to the updateRepository function.
    case 'update-repository':
      result = await updateRepository(parsedArgs);
      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