Skip to main content
Glama

create_repository

Set up a new GitHub repository with custom name, description, privacy settings, and optional README initialization using the MCP-github server.

Instructions

Create a new GitHub repository in your account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
autoInitNoInitialize with README.md
descriptionNoRepository description
nameYesRepository name
privateNoWhether the repository should be private

Implementation Reference

  • Core implementation of the create_repository tool: makes a POST request to GitHub API to create a new repository and parses the response.
    export async function createRepository(github_pat: string, options: CreateRepositoryOptions) { const response = await githubRequest(github_pat, "https://api.github.com/user/repos", { method: "POST", body: options, }); return GitHubRepositorySchema.parse(response); }
  • Zod schema for the input parameters of the create_repository tool (excluding github_pat).
    export const CreateRepositoryOptionsSchema = z.object({ name: z.string().describe("Repository name"), description: z.string().optional().describe("Repository description"), private: z.boolean().optional().describe("Whether the repository should be private"), autoInit: z.boolean().optional().describe("Initialize with README.md"), });
  • src/index.ts:88-92 (registration)
    Registration of the create_repository tool in the ListTools response.
    { name: "create_repository", description: "Create a new GitHub repository in your account", inputSchema: zodToJsonSchema(repository.CreateRepositoryOptionsSchema), },
  • Dispatch handler in CallToolRequestHandler that parses arguments and calls the createRepository function.
    case "create_repository": { const argsWithPat = repository._CreateRepositoryOptionsSchema.parse(params.arguments); const { github_pat, ...args } = argsWithPat; const result = await repository.createRepository(github_pat, args); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }
  • Extended Zod schema including the required github_pat for internal use in dispatch.
    export const _CreateRepositoryOptionsSchema = CreateRepositoryOptionsSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });

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

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