Skip to content

Repository files navigation

PrimoMCP

An MCP (Model Context Protocol) server that wraps the Ex Libris Primo Search API, enabling LLMs to search library catalogs.

Prerequisites

  • Node.js 22+
  • npm
  • Docker (for containerized deployment)
  • Kubernetes cluster (for K8s deployment)
  • Ex Libris Primo API key

Local Development

npm install
npm run build
PRIMO_API_KEY=your-key PRIMO_VID=your-vid PRIMO_TAB=your-tab PRIMO_SCOPE=your-scope npm start

The server starts on port 3000 (configurable via PORT).

Health Checks

  • GET /healthz — liveness probe
  • GET /readyz — readiness probe

MCP Endpoint

  • POST /mcp — stateless Streamable HTTP transport (one request per MCP session)

Docker

docker build -t primomcp .
docker run -e PRIMO_API_KEY=your-key \
-e PRIMO_VID=your-vid \
-e PRIMO_TAB=your-tab \
-e PRIMO_SCOPE=your-scope \
-p 3000:3000 primomcp

Kubernetes Deployment

The manifests in k8s/ are managed with kustomize and deploy to the vtlib namespace (namespace, image, and ingress host are set in the committed manifests). Per-institution config and all secrets are kept out of version control: they live in .env and are rendered into gitignored kustomize generator inputs (k8s/config.env, k8s/secret.env, k8s/dockerconfigjson).

  1. Copy .env.sample to .env and fill in your values:
cp .env.sample .env
# PRIMO_API_KEY, PRIMO_VID/TAB/SCOPE, CONTAINER_REGISTRY, REGISTRY_* (deploy token)
  1. Build and push the Docker image:
./scripts/build.sh # builds and pushes $CONTAINER_REGISTRY/primomcp:latest
  1. Render the gitignored kustomize inputs from .env:
./scripts/gen-kustomize-inputs.sh
  1. Deploy with kustomize:
kubectl --kubeconfig endeavour.yaml apply -k k8s

Steps 3–4 are also wrapped by ./scripts/deploy.sh, which renders the inputs, applies k8s/ against endeavour.yaml, and waits for the rollout. Re-run gen-kustomize-inputs.sh whenever .env changes; otherwise kubectl apply -k k8s is self-contained.

MCP Tool: primo_search

Search a library catalog via the Primo Search API.

Inputs

ParameterTypeRequiredDescription
querystringOne of query or advancedQuery requiredSimple keyword search
advancedQuerystringOne of query or advancedQuery requiredRaw Primo q format (e.g., title,contains,machine learning)
limitintegerNoMax results, 1-50 (default 10)
offsetintegerNoPagination offset, 0-5000 (default 0)
sortstringNoSort order: rank, title, author, date, date_d, date_a
qIncludestringNoInclude facet filter
qExcludestringNoExclude facet filter
langstringNoLanguage code

Example

Simple search:

{ "query": "machine learning" }

Advanced search:

{ "advancedQuery": "title,contains,machine learning,AND;sub,contains,neural networks", "limit": 5 }

Configuration

Environment Variables

VariableRequiredDefaultDescription
PRIMO_API_KEYYesEx Libris API key
PRIMO_BASE_URLNohttps://api-na.hosted.exlibrisgroup.comPrimo API base URL
PRIMO_VIDYesView ID
PRIMO_TABYesTab name
PRIMO_SCOPEYesScope name
PRIMO_INSTNoInstitution code (on-premises only)
PORTNo3000Server listen port

About

An MCP server for Primo Search

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages