Labsco
galley-solutions logo

Galley MCP Server

ā˜… 3

from galley-solutions

Integrates Galley's GraphQL API with MCP clients. It automatically introspects the GraphQL schema for seamless use with tools like Claude and VS Code.

šŸ”„šŸ”„āœ“ VerifiedFreeAdvanced setup

Galley MCP Server

A Model Context Protocol (MCP) server for Galley GraphQL API integration using Apollo MCP Server with mandatory automatic schema introspection. The server introspects your Galley GraphQL schema on startup and provides seamless integration with MCP clients like Claude, Cursor, and VS Code.

šŸ”Œ MCP Client Integration

Claude Desktop

  1. Install Claude Desktop from https://claude.ai/download

  2. Configure MCP Server in Claude's settings:

    Read-only configuration (recommended):

    {
      "mcpServers": {
        "galley": {
          "command": "docker",
          "args": [
            "run",
            "--rm",
            "-i",
            "-e", "X_API_KEY=your_api_key_here",
            "-e", "DISABLE_INTROSPECTION=true",
            "-e", "ALLOW_MUTATIONS=none",
            "public.ecr.aws/o0r1r5q2/galley-mcp:latest"
          ],
          "env": {}
        }
      }
    }

    Allow explicit mutations:

    {
      "mcpServers": {
        "galley": {
          "command": "docker",
          "args": [
            "run",
            "--rm",
            "-i",
            "-e", "X_API_KEY=your_api_key_here",
            "-e", "ALLOW_MUTATIONS=explicit",
            "public.ecr.aws/o0r1r5q2/galley-mcp:latest"
          ],
          "env": {}
        }
      }
    }
  3. Restart Claude Desktop to load the MCP server

Cursor IDE

  1. Install Cursor from https://cursor.sh

  2. Add MCP Configuration in Cursor settings:

    • Open Settings → Extensions → MCP
    • Add new server configuration:
    {
      "name": "galley",
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-e", "X_API_KEY=your_api_key_here",
        "public.ecr.aws/o0r1r5q2/galley-mcp:latest"
      ]
    }
  3. Enable the MCP server in Cursor's MCP panel

VS Code

  1. Install VS Code from https://code.visualstudio.com

  2. Install MCP Extension:

    • Open Extensions panel (Ctrl+Shift+X)
    • Search for "Model Context Protocol"
    • Install the MCP extension
  3. Configure MCP Server:

    • Open VS Code settings (Ctrl+,)
    • Search for "MCP"
    • Add server configuration:
    {
      "mcp.servers": {
        "galley": {
          "command": "docker",
          "args": [
            "run", "--rm", "-i",
            "-e", "X_API_KEY=your_api_key_here",
            "public.ecr.aws/o0r1r5q2/galley-mcp:latest"
          ]
        }
      }
    }

šŸ› ļø Development

Custom Operations

Add your own GraphQL operations by mounting a custom directory:

# Create custom operations directory
mkdir -p ./my-operations

# Add your .graphql files
echo 'query MyCustomQuery { viewer { id } }' > ./my-operations/MyQuery.graphql

# Run with custom operations
docker run -i \
  -e X_API_KEY="your_api_key" \
  -e USER_DIRECTORY="/custom" \
  -v ./my-operations:/custom \
  public.ecr.aws/o0r1r5q2/galley-mcp:latest

Schema Introspection

The server automatically introspects the Galley GraphQL schema on startup. The schema is saved to /app/schema.graphql and used by the Apollo MCP Server.

Key Features:

  • Mandatory execution: Cannot be skipped or disabled
  • Fail-fast behavior: Server stops if introspection fails
  • Authentication: Uses same credentials as MCP operations
  • Real-time schema: Always gets the latest schema on startup
  • Client identification: Sends apollographql-client-name header for tracking

Built-in Tools

The Docker image includes:

  • Apollo MCP Server: Latest version installed to /usr/local/bin
  • Rover: Apollo's GraphQL CLI tool for schema introspection
  • Debian Bookworm Slim: Lightweight base image with glibc support

Debugging

Enable debug mode for detailed output and troubleshooting:

# Enable debug mode for verbose logging
docker run -i -e X_API_KEY="your_api_key" -e MCP_DEBUG=true public.ecr.aws/o0r1r5q2/galley-mcp:latest

# View container logs
docker logs <container_id>

# Run interactively to see all output
docker run -it -e X_API_KEY="your_api_key" -e MCP_DEBUG=true public.ecr.aws/o0r1r5q2/galley-mcp:latest

# Test with different endpoints in debug mode
docker run -i \
  -e X_API_KEY="your_api_key" \
  -e MCP_DEBUG=true \
  -e INTROSPECT_ENDPOINT="https://staging-app.galleysolutions.com/graphql" \
  public.ecr.aws/o0r1r5q2/galley-mcp:latest

Debug Mode Features:

  • Shows all configuration values
  • Displays Rover introspection command and output
  • Shows schema statistics (lines, file size)
  • Enables Apollo MCP Server debug logging
  • Displays authentication method being used

šŸ“ Project Structure

galley-mcp/
ā”œā”€ā”€ Dockerfile                 # Docker container with Apollo MCP Server + Rover
ā”œā”€ā”€ entrypoint.sh             # Main startup script with mandatory introspection
ā”œā”€ā”€ introspect-schema.sh      # Schema introspection script using Rover
ā”œā”€ā”€ operations/               # GraphQL operations directory
│   └── GetRecipesByName.graphql  # Example Galley recipe query
└── README.md                # This comprehensive guide

Key Components

  • entrypoint.sh: Orchestrates schema introspection and server startup
  • introspect-schema.sh: Uses Rover to fetch the latest Galley GraphQL schema
  • operations/: Contains your GraphQL operations (queries, mutations, subscriptions)
  • Dockerfile: Multi-stage build with Apollo MCP Server and Rover pre-installed

šŸ”„ CI/CD Pipeline

The project includes automated CI/CD using GitHub Actions with two specialized workflows:

šŸš€ Release Workflow (release.yml)

Triggers: Push to master branch

What it does:

  • Auto-versioning: Automatically increments patch version from latest tag
  • GitHub Releases: Creates release with auto-generated notes
  • Multi-architecture builds: Builds for linux/amd64 and linux/arm64
  • Multiple Docker tags: Publishes latest, v1.0.1, and 1.0.1 tags
  • Release documentation: Includes Docker image URLs and commit info

Example: Push to master → Creates v1.0.1 release + publishes Docker images

šŸ”§ Build Workflow (build-and-push.yml)

Triggers:

  • Push to develop branch
  • Pull requests to master

What it does:

  • Development builds: Publishes develop tag for development branch
  • PR validation: Builds (but doesn't publish) for pull requests
  • Multi-architecture: Supports both linux/amd64 and linux/arm64
  • Caching: Uses GitHub Actions cache for faster builds

Available Docker Tags

  • latest - Latest stable release from master branch
  • v1.0.1, 1.0.1 - Semantic version tags from releases
  • develop - Latest development version from develop branch

Repository Setup

To set up the CI/CD pipeline, configure these GitHub repository secrets:

  • AWS_ACCESS_KEY_ID: AWS access key for ECR push permissions
  • AWS_SECRET_ACCESS_KEY: AWS secret key for ECR push permissions

Permissions: The release workflow needs contents: write permission (automatically configured).

The ECR repository needs to be created as a public repository in us-east-1 region with the name galley-mcp.

šŸ“„ License

[Your License Here]

šŸ¤ Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

For more information about the Model Context Protocol, visit https://modelcontextprotocol.io