Skip to content

feat(mcp): migrate server to FastMCP with structured tool output #384

feat(mcp): migrate server to FastMCP with structured tool output

feat(mcp): migrate server to FastMCP with structured tool output #384

Workflow file for this run

name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install linting tools
run: |
pip install "ruff==0.15.1"
ruff version
- name: Run ruff linter
run: ruff check src/ tests/
- name: Check formatting with ruff
run: ruff format --check --diff src/ tests/
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libvips-dev
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run tests
run: |
pytest tests/ -v --tb=short -x
- name: Run tests with coverage
if: matrix.python-version == '3.10'
run: |
pytest tests/ --cov=src/kintsugi --cov-report=xml --cov-report=term
- name: Upload coverage
if: matrix.python-version == '3.10'
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
fail_ci_if_error: false
test-notebooks:
name: Test Notebooks Import
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libvips-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Test notebook imports
run: |
python -c "
import sys
import os
sys.path.insert(0, 'notebooks')
# Kreg is a vendored VALIS fork with heavy native deps
# (SimpleITK, torch, etc.) that are HPC-only. Validate
# module structure exists without triggering imports.
print('Testing Kreg module structure...')
kreg_modules = [
'registration', 'slide_io', 'preprocessing',
'non_rigid_registrars', 'warp_tools', 'feature_detectors',
]
for mod in kreg_modules:
path = os.path.join('notebooks', 'Kreg', f'{mod}.py')
assert os.path.exists(path), f'Missing: {path}'
print(f' OK: Kreg/{mod}.py exists')
print('Testing Kview2 import...')
from Kview import imshow, curtain, crop
print(' OK: visualization functions')
print('Testing Kstitch import...')
from Kstitch import stitch_images
print(' OK: stitch_images')
print('All notebook imports successful!')
"
dependency-check:
name: Dependency Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libvips-dev
- name: Install package
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Run dependency check
run: |
python -c "
from kintsugi.deps import check_dependencies
result = check_dependencies(verbose=True)
# Fail if required dependencies are missing
if not result['all_required_ok']:
missing = result['required']['missing']
print(f'Missing required dependencies: {missing}')
exit(1)
"
build:
name: Build Package
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install build tools
run: pip install build twine
- name: Build package
run: python -m build
- name: Check package
run: twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
docs:
name: Documentation
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Validate README
run: |
python -c "
import re
with open('README.md') as f:
content = f.read()
# Check for broken links (basic check)
links = re.findall(r'\[([^\]]+)\]\(([^)]+)\)', content)
print(f'Found {len(links)} links in README')
# Check for required sections
required = ['Installation', 'Notebooks']
for section in required:
if section not in content:
print(f'Warning: Missing section: {section}')
"