name: Conformance Tests

on:
  push:
    branches: [main]
  pull_request:
  workflow_dispatch:

concurrency:
  group: conformance-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  server-conformance:
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Set up Go
        uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
        with:
          go-version: "^1.25"
      - name: Start everything-server
        run: |
          go run ./conformance/everything-server/main.go -http=":3001" &
          # Wait for the server to be ready.
          timeout 30 bash -c 'until curl -s http://localhost:3001/mcp; do sleep 0.5; done'
      - name: "Run conformance tests" 
        uses: modelcontextprotocol/conformance@a2855b03582a6c0b31065ad4d9af248316ce61a3 # v0.1.15
        with:
          mode: server
          url: http://localhost:3001/mcp
          suite: active
          expected-failures: ./conformance/baseline.yml
          node-version: 22

  client-conformance:
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Set up Go
        uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
        with:
          go-version: "^1.25"
      - name: "Run conformance tests" 
        uses: modelcontextprotocol/conformance@a2855b03582a6c0b31065ad4d9af248316ce61a3 # v0.1.15
        with:
          mode: client 
          command: go run -tags mcp_go_client_oauth ./conformance/everything-client
          suite: core
          expected-failures: ./conformance/baseline.yml
          node-version: 22
