name: CI
on:
push:
branches: [main]
pull_request:
branches-ignore: [ci-cd-maintenance]
# Cancel duplicate runs
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
continue-on-error: false
- name: Test MCP server installation
run: |
markitdown-mcp --help || echo "Console script test"
- name: Test MCP protocol
run: |
python -c "
import json
import subprocess
import sys
# Test MCP server initialization
test_request = {'jsonrpc': '2.0', 'id': 1, 'method': 'initialize', 'params': {}}
try:
proc = subprocess.Popen(
['markitdown-mcp'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
stdout, stderr = proc.communicate(
input=json.dumps(test_request) + '\n',
timeout=30
)
if stdout:
response = json.loads(stdout.strip())
if 'result' in response:
print('SUCCESS: MCP server working correctly')
sys.exit(0)
print('FAILED: MCP server test failed')
print('STDOUT:', stdout)
print('STDERR:', stderr)
sys.exit(1)
except Exception as e:
print(f'FAILED: Test failed: {e}')
sys.exit(1)
"
- name: Test tools list
run: |
python -c "
import json
import subprocess
import sys
# Test tools/list endpoint
test_request = {'jsonrpc': '2.0', 'id': 2, 'method': 'tools/list', 'params': {}}
try:
proc = subprocess.Popen(
['markitdown-mcp'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
stdout, stderr = proc.communicate(
input=json.dumps(test_request) + '\n',
timeout=30
)
if stdout:
response = json.loads(stdout.strip())
tools = response.get('result', {}).get('tools', [])
expected_tools = {'convert_file', 'list_supported_formats', 'convert_directory'}
actual_tools = {tool['name'] for tool in tools}
if expected_tools.issubset(actual_tools):
print(f'SUCCESS: All {len(expected_tools)} MCP tools available')
sys.exit(0)
print(f'FAILED: Missing tools. Expected: {expected_tools}, Got: {actual_tools}')
else:
print('FAILED: No response from tools/list')
print('STDERR:', stderr)
sys.exit(1)
except Exception as e:
print(f'FAILED: Tools test failed: {e}')
sys.exit(1)
"
package-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Test package build
run: |
python -m pip install --upgrade pip build
python -m build
- name: Test package installation
run: |
pip install dist/*.whl
which markitdown-mcp && echo "SUCCESS: Console script installed" || echo "FAILED: Console script missing"