swift-sdk/scripts/run-conformance.sh
Maksym Mova 6112a3995a
V0.11.x (#199)
* Support 2025-06-18 Spec (#167)

* Support OpenAI _meta for Tool

* Update init

* Add title and outputSchema

* Concurreny issue

* General fields

* Add Generate Fields to Server elements

* 4 tab spacing

* Update Version

* Elicitation

* Format

* More tests and inits

* Elicitation in README

* Fix orphaned test

* Add title to more structs

* Public init

* Fix meta validation and make tests more generic

* Format and make Result properties public again

* Revert more visibility changes

* feat: 2025-11-25 phase 1, includes Version, Icon, Progress (#181)

* chore: fixed unit tests

* feat: added icon and progess base structs

* feat: added progress notification and meta to callTool

* feat: added tests

* feat: simplified RequestMeta encoding/decoding

* tests: added unit test to track progress

* chore: rebased v0.11.x

* feat: implemented cancellation

* feat: added overloaded callTool method

* fix: encoding Response _meta fix

* chore: added old version to the versions list

* feat: 2025-11-25 phase 2; added Logging and Completions (#196)

* feat: added Logging and Completions

* feat: updated EmbeddedResource for the latest spec

* chore: changed encoding of meta in Prompts to encodeIfPresent

* feat: compliance tests + http server transport (#197)

* feat: http server transport

* feat: added http server transport

* feat: removed unused files

* feat: added conformance tests

* feat: improved conformace testing

* chore: removed redundant files

* feat/2025-11-25: sampling, elicitation, roots (#198)

* feat: Roots implementation

* feat: added unit testing

* feat: improved unit tests and fixed NetworkTransport crash

* feat: implemented sampling and elicitation

* feat: improved sampling tests

* feat: improved elicitation tests

* feat: improved confirmance tests

* feat: improved Prompts unit tests

* feat: removed test code

* feat: updated conformance tests

* chore: removed redundant commas

* chore: removed 6.0.3 swift version from ci

* chore: improved unit tests a little bit

* chore: update README.md

* chore: add server progress tracking example to README.md

* chore: updated README.md

* chore: updated transports table formatting

* chore: updated MockNetworkConnection

---------

Co-authored-by: Austin Evans <austinjevans@me.com>
Co-authored-by: yehorsobko <yehorsobko@macpaw.com>
2026-02-19 13:09:31 +02:00

113 lines
2.6 KiB
Shell
Executable file

#!/bin/bash
set -euo pipefail
# Color output helpers
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
log_info() { echo -e "${GREEN}[INFO]${NC} $*"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
log_error() { echo -e "${RED}[ERROR]${NC} $*"; }
# Configuration
CONFORMANCE_PKG="@modelcontextprotocol/conformance"
CLIENT_EXEC="mcp-everything-client"
SERVER_EXEC="mcp-everything-server"
BASELINE_FILE="${BASELINE_FILE:-conformance-baseline.yml}"
MODE="${MODE:-both}"
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--mode)
MODE="$2"
shift 2
;;
--baseline)
BASELINE_FILE="$2"
shift 2
;;
*)
log_error "Unknown option: $1"
exit 1
;;
esac
done
# Validate mode
if [[ ! "$MODE" =~ ^(client|server|both)$ ]]; then
log_error "Invalid mode: $MODE. Must be one of: client, server, both"
exit 1
fi
# Build Swift executables
log_info "Building Swift executables..."
swift build --product "$CLIENT_EXEC" || {
log_error "Failed to build client"
exit 1
}
swift build --product "$SERVER_EXEC" || {
log_error "Failed to build server"
exit 1
}
CLIENT_PATH="$(swift build --show-bin-path)/$CLIENT_EXEC"
SERVER_PATH="$(swift build --show-bin-path)/$SERVER_EXEC"
log_info "Client executable: $CLIENT_PATH"
log_info "Server executable: $SERVER_PATH"
# Check for baseline file
BASELINE_ARG=""
if [[ -f "$BASELINE_FILE" ]]; then
log_info "Using baseline file: $BASELINE_FILE"
BASELINE_ARG="--expected-failures $BASELINE_FILE"
else
log_warn "No baseline file found at $BASELINE_FILE"
fi
# Run client tests
if [[ "$MODE" == "client" || "$MODE" == "both" ]]; then
log_info "Running client conformance tests..."
npx "$CONFORMANCE_PKG" client \
--command "$CLIENT_PATH" \
--suite core \
$BASELINE_ARG || {
log_error "Client conformance tests failed"
exit 1
}
log_info "Client tests completed"
fi
# Run server tests
if [[ "$MODE" == "server" || "$MODE" == "both" ]]; then
log_info "Starting server for conformance testing..."
# Start server in background
"$SERVER_PATH" &
SERVER_PID=$!
# Wait for server to be ready
log_info "Waiting for server to start (PID: $SERVER_PID)..."
sleep 3
# Run server tests
log_info "Running server conformance tests..."
npx "$CONFORMANCE_PKG" server \
--url http://localhost:3001/mcp \
--suite all \
$BASELINE_ARG || {
log_error "Server conformance tests failed"
kill $SERVER_PID 2>/dev/null || true
exit 1
}
# Cleanup
log_info "Stopping server..."
kill $SERVER_PID 2>/dev/null || true
log_info "Server tests completed"
fi
log_info "All conformance tests completed successfully"