FAIRy MCP Server
Officialby BioFAIRUK
README.md
# biofair-fairy
AI agent and MCP tools for Data Commons
## Run FAIRy in Docker
The image contains the FAIRy MCP server and the skills under `fairy/skills/`.
```sh
docker build -t fairy-mcp .
docker run --rm -p 127.0.0.1:8000:8000 fairy-mcp
```
Connect a Streamable HTTP MCP client to `http://127.0.0.1:8000/mcp`.
## Publish to GitHub Container Registry
The [GitHub Actions workflow](.github/workflows/publish-image.yml) builds the
image, calls `ping` over HTTP, and reads the bundled skills before pushing.
It runs on pushes to `main` and can be run manually from `main`. It publishes
`ghcr.io/biofairuk/biofair-fairy:COMMIT_SHA` using the workflow's built-in
`GITHUB_TOKEN` with `packages: write`.
New packages are private by default. To allow anonymous pulls, set the package
visibility to public. If the package already exists, give this repository write
access under the package's **Manage Actions access** settings.
[GitHub Container Registry documentation](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry)
## Deploy to GKE
The publish workflow can deploy to GKE after the image passes its MCP checks
and is pushed to GHCR. The deploy job applies the manifest with that image's
digest and waits for the StatefulSet rollout.
1. Configure [Workload Identity Federation for GitHub Actions](https://docs.cloud.google.com/iam/docs/workload-identity-federation-with-deployment-pipelines)
with a dedicated deployer service account. Restrict the provider to this
GitHub repository's numeric ID and `refs/heads/main`, and grant the
federated principal `roles/iam.workloadIdentityUser` on the service account.
2. Grant the deployer `roles/container.clusterViewer` in the cluster's project.
In the target namespace, use [Kubernetes RBAC](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/role-based-access-control)
to let the service account create, get, and patch Services and StatefulSets,
and list and watch StatefulSets for rollout status.
3. Add the following GitHub Actions variables. Set the cluster and authentication
variables in the `gke` GitHub environment or at repository level.
| Variable | Value |
| --- | --- |
| `GCP_WORKLOAD_IDENTITY_PROVIDER` | Full Workload Identity Provider resource name |
| `GCP_SERVICE_ACCOUNT` | Google Cloud deployer service account email |
| `GKE_CLUSTER` | `projects/PROJECT_ID/locations/REGION_OR_ZONE/clusters/CLUSTER_NAME` |
| `GKE_NAMESPACE` | Existing Kubernetes namespace |
| `GKE_DEPLOY_ENABLED` | Set to `true` at repository level when setup is complete |
4. Ensure the GitHub-hosted runner can reach the Kubernetes API and GKE can
pull the GHCR image. For a private GHCR package, configure an
[image pull secret](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/)
in the namespace with a GitHub token that has read access to the package.
Reference it from the StatefulSet pod template or the namespace's default
ServiceAccount. Run the workflow on `main` to verify the deployment.
### Service and DNS
The [GKE manifest](deploy/gke/fairy-mcp.yaml) runs one FAIRy replica and
exposes the unauthenticated Streamable HTTP endpoint at
`http://fairy.biofair.uk/mcp`. The single replica keeps requests for a
FastMCP session on the same process. The external LoadBalancer Service
forwards TCP port 80 to the MCP server on port 8000. The cluster needs an
`amd64` node. HTTPS requires a component that
terminates TLS. [GKE LoadBalancer Services](https://docs.cloud.google.com/kubernetes-engine/docs/concepts/service-load-balancer)
1. After the workflow deploys, get the Service address from the target
context and namespace.
```sh
kubectl --context "$GKE_CONTEXT" -n "$NAMESPACE" get service fairy-mcp-lb --watch
```
2. Point the DNS A record for `fairy.biofair.uk` at the Service's
`EXTERNAL-IP`. For an address that survives Service recreation, [configure
a regional static IP](https://docs.cloud.google.com/kubernetes-engine/docs/concepts/service-load-balancer-parameters#static-ip).
3. Connect a Streamable HTTP MCP client to `http://fairy.biofair.uk/mcp`
and call `ping`.
If the Gateway variant is already deployed, the new `fairy-mcp-lb` Service
can be provisioned alongside it. After verifying the DNS cutover, retire the
old Gateway, HTTPRoute, HealthCheckPolicy, GCPBackendPolicy, and its
`fairy-mcp` ClusterIP Service.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues