Skip to main content
Glama
ddukbg

GitHub Enterprise MCP Server

create-repository

Create new repositories on GitHub Enterprise with options for privacy, README initialization, .gitignore templates, and licenses.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesRepository name
descriptionNoRepository description
privateNoWhether the repository is private
auto_initNoInitialize with README
gitignore_templateNoAdd .gitignore template
license_templateNoAdd a license template
orgNoOrganization name (if creating in an organization)

Implementation Reference

  • The MCP tool handler function for 'create-repository'. It validates parameters, constructs options, calls the appropriate RepositoryAPI create method (user or organization), formats the result using formatRepository, handles errors, and returns a structured text response.
    async ({ name, description, private: isPrivate, auto_init, gitignore_template, license_template, org }) => {
      try {
        // Parameter validation
        if (!name || typeof name !== 'string' || name.trim() === '') {
        return {
          content: [
            {
              type: "text",
                text: "Repository name is required."
              }
            ]
          };
        }
    
        const options = {
          name,
          description,
          private: isPrivate,
          auto_init,
          gitignore_template,
          license_template
        };
    
        let repository;
        if (org) {
          repository = await context.repository.createOrganizationRepository(org, options);
        } else {
          repository = await context.repository.createRepository(options);
        }
    
        // Format repository information
        const formattedRepo = formatRepository(repository);
    
        return {
          content: [
            {
              type: "text",
              text: `Successfully created repository: ${formattedRepo.full_name}\n\n${JSON.stringify(formattedRepo, null, 2)}`
            }
          ]
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: `Error creating repository: ${error.message}`
            }
          ]
        };
      }
    }
  • Zod schema defining the input parameters for the 'create-repository' MCP tool, including repository name, description, privacy settings, initialization options, and optional organization.
    name: z.string().min(1).describe("Repository name"),
    description: z.string().optional().describe("Repository description"),
    private: z.boolean().optional().describe("Whether the repository is private"),
    auto_init: z.boolean().optional().describe("Initialize with README"),
    gitignore_template: z.string().optional().describe("Add .gitignore template"),
    license_template: z.string().optional().describe("Add a license template"),
    org: z.string().optional().describe("Organization name (if creating in an organization)")
  • Registration of the 'create-repository' tool on the MCP server instance using server.tool(), including name, input schema, and handler function.
      "create-repository",
      {
        name: z.string().min(1).describe("Repository name"),
        description: z.string().optional().describe("Repository description"),
        private: z.boolean().optional().describe("Whether the repository is private"),
        auto_init: z.boolean().optional().describe("Initialize with README"),
        gitignore_template: z.string().optional().describe("Add .gitignore template"),
        license_template: z.string().optional().describe("Add a license template"),
        org: z.string().optional().describe("Organization name (if creating in an organization)")
      },
      async ({ name, description, private: isPrivate, auto_init, gitignore_template, license_template, org }) => {
        try {
          // Parameter validation
          if (!name || typeof name !== 'string' || name.trim() === '') {
          return {
            content: [
              {
                type: "text",
                  text: "Repository name is required."
                }
              ]
            };
          }
    
          const options = {
            name,
            description,
            private: isPrivate,
            auto_init,
            gitignore_template,
            license_template
          };
    
          let repository;
          if (org) {
            repository = await context.repository.createOrganizationRepository(org, options);
          } else {
            repository = await context.repository.createRepository(options);
          }
    
          // Format repository information
          const formattedRepo = formatRepository(repository);
    
          return {
            content: [
              {
                type: "text",
                text: `Successfully created repository: ${formattedRepo.full_name}\n\n${JSON.stringify(formattedRepo, null, 2)}`
              }
            ]
          };
        } catch (error: any) {
          return {
            content: [
              {
                type: "text",
                text: `Error creating repository: ${error.message}`
              }
            ]
          };
        }
      }
    );
  • RepositoryAPI helper method that performs the actual GitHub API POST request to create a new user repository.
    async createRepository(options: CreateRepoOptions): Promise<GitHubRepository> {
      return this.client.post<GitHubRepository>('user/repos', options);
    }
  • RepositoryAPI helper method that performs the GitHub API POST request to create a new organization repository.
    async createOrganizationRepository(org: string, options: CreateRepoOptions): Promise<GitHubRepository> {
      return this.client.post<GitHubRepository>(`orgs/${org}/repos`, options);
    }
  • TypeScript interface defining the CreateRepoOptions type used by the repository creation helper methods.
    export interface CreateRepoOptions {
      name: string;
      description?: string;
      homepage?: string;
      private?: boolean;
      visibility?: 'public' | 'private' | 'internal';
      has_issues?: boolean;
      has_projects?: boolean;
      has_wiki?: boolean;
      has_downloads?: boolean;
      has_discussions?: boolean;
      is_template?: boolean;
      team_id?: number;
      auto_init?: boolean;
      gitignore_template?: string;
      license_template?: string;
      allow_squash_merge?: boolean;
      allow_merge_commit?: boolean;
      allow_rebase_merge?: boolean;
      allow_auto_merge?: boolean;
      delete_branch_on_merge?: boolean;
    }
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/ddukbg/github-enterprise-mcp'

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