Skip to main content
Glama

service_create_from_repo

Deploy applications by creating services from GitHub repositories, enabling automated builds and deployments for source code projects.

Instructions

[API] Create a new service from a GitHub repository

⚡️ Best for: ✓ Deploying applications from source code ✓ Services that need build processes ✓ GitHub-hosted projects

⚠️ Not for: × Pre-built Docker images (use service_create_from_image) × Database deployments (use database_deploy) × Static file hosting

→ Prerequisites: project_list

→ Alternatives: service_create_from_image, database_deploy

→ Next steps: variable_set, service_update

→ Related: deployment_trigger, service_info

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesID of the project to create the service in
repoYesGitHub repository URL or name (e.g., 'owner/repo')
nameNoOptional custom name for the service

Implementation Reference

  • The MCP tool handler function that executes the tool logic by calling serviceService.createServiceFromRepo.
    async ({ projectId, repo, name }) => {
      return serviceService.createServiceFromRepo(projectId, repo, name);
    }
  • Input schema using Zod defining the required parameters for the tool.
    {
      projectId: z.string().describe("ID of the project to create the service in"),
      repo: z.string().describe("GitHub repository URL or name (e.g., 'owner/repo')"),
      name: z.string().optional().describe("Optional custom name for the service")
    },
  • Tool definition and local registration using createTool function, including name, description, schema, and handler.
    createTool(
      "service_create_from_repo",
      formatToolDescription({
        type: 'API',
        description: "Create a new service from a GitHub repository",
        bestFor: [
          "Deploying applications from source code",
          "Services that need build processes",
          "GitHub-hosted projects"
        ],
        notFor: [
          "Pre-built Docker images (use service_create_from_image)",
          "Database deployments (use database_deploy)",
          "Static file hosting"
        ],
        relations: {
          prerequisites: ["project_list"],
          nextSteps: ["variable_set", "service_update"],
          alternatives: ["service_create_from_image", "database_deploy"],
          related: ["deployment_trigger", "service_info"]
        }
      }),
      {
        projectId: z.string().describe("ID of the project to create the service in"),
        repo: z.string().describe("GitHub repository URL or name (e.g., 'owner/repo')"),
        name: z.string().optional().describe("Optional custom name for the service")
      },
      async ({ projectId, repo, name }) => {
        return serviceService.createServiceFromRepo(projectId, repo, name);
      }
    ),
  • Supporting method in serviceService that performs the actual API call to create service from repo using the client.
    async createServiceFromRepo(projectId: string, repo: string, name?: string) {
      try {
        const service = await this.client.services.createService({
          projectId,
          name,
          source: {
            repo,
          }
        });
    
        return createSuccessResponse({
          text: `Created new service "${service.name}" (ID: ${service.id}) from GitHub repo "${repo}"`,
          data: service
        });
      } catch (error) {
        return createErrorResponse(`Error creating service: ${formatError(error)}`);
      }
    }
  • Global registration where serviceTools (including service_create_from_repo) is spread into allTools and each tool registered with the MCP server via server.tool.
    export function registerAllTools(server: McpServer) {
      // Collect all tools
      const allTools = [
        ...databaseTools,
        ...deploymentTools,
        ...domainTools,
        ...projectTools,
        ...serviceTools,
        ...tcpProxyTools,
        ...variableTools,
        ...configTools,
        ...volumeTools,
        ...templateTools,
      ] as Tool[];
    
      // Register each tool with the server
      allTools.forEach((tool) => {
        server.tool(
          ...tool
        );
      });

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/epitaphe360/railway-mcp'

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