Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 197 additions & 0 deletions .github/workflows/extra-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
name: Extra MCP integration

on:
workflow_call:
inputs:
evo_ref:
type: string
required: false
default: 3.5.x
emcp_ref:
type: string
required: false
default: main
php_version:
type: string
required: false
default: '8.4'
server_handle:
type: string
required: false
default: content
expected_tools:
description: Tool names (space or newline separated) the Extra contributes; each must be listed by tools/list
type: string
required: false
default: ''

permissions:
contents: read

jobs:
integration:
runs-on: ubuntu-latest
steps:
- name: Checkout calling Extra
uses: actions/checkout@v4
with:
path: extra

- name: Checkout eMCP
uses: actions/checkout@v4
with:
repository: evolution-cms/evo-mcp
ref: ${{ inputs.emcp_ref }}
path: emcp

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php_version }}
extensions: sqlite3, pdo_sqlite, mbstring, xml, curl, gd, zip, intl
tools: composer:v2
coverage: none

# A CMS build pulls a few hundred dist archives from api.github.com, which
# rate-limits anonymous callers; the run's own token lifts that.
- name: Authenticate Composer against GitHub
env:
GH_TOKEN: ${{ github.token }}
run: composer config --global --auth github-oauth.github.com "$GH_TOKEN"

- name: Download Evolution CMS
env:
EVO_REF: ${{ inputs.evo_ref }}
run: git clone --depth 1 --branch "$EVO_REF" https://github.com/evolution-cms/evolution.git evo

- name: Install Evolution CMS dependencies
working-directory: evo/core
env:
COMPOSER_ALLOW_SUPERUSER: '1'
run: composer install --no-dev --no-interaction --prefer-dist --no-progress

# A clean CMS first, then the packages, as on a real site: with eMCP (and its sTask)
# already in vendor, the CLI installer runs their migrations without recording them,
# and the later migrate stops at "table already exists".
- name: Install test Evolution CMS using SQLite
working-directory: evo/install
run: |
php cli-install.php \
--typeInstall=1 \
--databaseType=sqlite \
--database=evolution \
--tablePrefix=evo_ \
--cmsAdmin=admin \
--cmsAdminEmail=admin@example.com \
--cmsPassword=IntegrationOnly123 \
--language=en \
--removeInstall=y \
--skipComposer=y < /dev/null

- name: Add local Extra and eMCP as Composer path repositories
env:
EXTRA_PATH: ${{ github.workspace }}/extra
EMCP_PATH: ${{ github.workspace }}/emcp
EVO_PATH: ${{ github.workspace }}/evo
run: |
php <<'PHP'
<?php
$extraPath = getenv('EXTRA_PATH');
$emcpPath = getenv('EMCP_PATH');
$evoPath = getenv('EVO_PATH');
$composer = json_decode(file_get_contents($extraPath . '/composer.json'), true, 512, JSON_THROW_ON_ERROR);
$package = $composer['name'] ?? null;
if (!is_string($package) || !preg_match('~^[a-z0-9_.-]+/[a-z0-9_.-]+$~i', $package)) {
fwrite(STDERR, "Extra composer.json must define a valid package name\n");
exit(1);
}
// Evo merges core/custom/composer.json via composer-merge-plugin, which prefixes
// "custom/" to every path repository URL, so URLs must be relative to core/custom.
$customDir = $evoPath . '/core/custom';
$relative = static function (string $target) use ($customDir): string {
$from = explode('/', trim($customDir, '/'));
$to = explode('/', trim(realpath($target), '/'));
while ($from !== [] && $to !== [] && $from[0] === $to[0]) {
array_shift($from);
array_shift($to);
}
return str_repeat('../', count($from)) . implode('/', $to);
};
$custom = [
'name' => 'evolutioncms/custom',
'minimum-stability' => 'dev',
'prefer-stable' => true,
'repositories' => [
['type' => 'path', 'url' => $relative($extraPath), 'options' => ['symlink' => true]],
['type' => 'path', 'url' => $relative($emcpPath), 'options' => ['symlink' => true]],
],
'require' => [
$package => '*@dev',
'evolution-cms/emcp' => '*@dev',
],
'autoload' => ['psr-4' => new stdClass()],
];
$destination = $evoPath . '/core/custom/composer.json';
if (!is_dir(dirname($destination))) {
mkdir(dirname($destination), 0775, true);
}
file_put_contents($destination, json_encode($custom, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR) . "\n");
file_put_contents(getenv('GITHUB_ENV'), 'EXTRA_PACKAGE=' . $package . "\n", FILE_APPEND);
PHP

- name: Install Extra and eMCP dependencies
working-directory: evo/core
env:
COMPOSER_ALLOW_SUPERUSER: '1'
COMPOSER_MEMORY_LIMIT: '-1'
run: composer update --no-dev --no-interaction --prefer-dist --no-progress --with-all-dependencies "$EXTRA_PACKAGE" evolution-cms/emcp

- name: Register packages and run migrations
working-directory: evo/core
shell: bash
run: |
rm -f storage/cache/env.php
php artisan package:discover
php artisan vendor:publish --provider='EvolutionCMS\eMCP\eMCPServiceProvider' --tag=emcp-config --force --no-interaction
php artisan vendor:publish --provider='EvolutionCMS\eMCP\eMCPServiceProvider' --tag=emcp-mcp-config --force --no-interaction
php artisan migrate --force --no-interaction
# artisan migrate exits 0 even when a migration fails, so check what is left.
php artisan migrate:status --no-interaction | tee "$RUNNER_TEMP/migrate-status.txt"
if grep -q 'Pending' "$RUNNER_TEMP/migrate-status.txt"; then
echo '::error::Migrations are still pending after migrate'
exit 1
fi

- name: Verify eMCP and Extra installation
working-directory: evo/core
run: |
composer show evolution-cms/emcp
composer show "$EXTRA_PACKAGE"
php artisan emcp:list-servers

- name: Verify MCP initialize and tools/list
working-directory: evo/core
env:
SERVER_HANDLE: ${{ inputs.server_handle }}
EXPECTED_TOOLS: ${{ inputs.expected_tools }}
EVO_REF: ${{ inputs.evo_ref }}
EMCP_REF: ${{ inputs.emcp_ref }}
PHP_VERSION: ${{ inputs.php_version }}
# bash with pipefail, so a failing emcp:test is not hidden by tee.
shell: bash
run: |
args=(--server="$SERVER_HANDLE")
for tool in $EXPECTED_TOOLS; do
args+=(--expect-tool="$tool")
done
php artisan emcp:test "${args[@]}" | tee "$RUNNER_TEMP/emcp-test.log"
{
echo "### eMCP integration: $EXTRA_PACKAGE"
echo
echo "- Evolution CMS: \`$EVO_REF\`, eMCP: \`$EMCP_REF\`, PHP $PHP_VERSION"
echo "- Expected tools: ${EXPECTED_TOOLS:-none (protocol checks only)}"
echo
echo '```'
cat "$RUNNER_TEMP/emcp-test.log"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
29 changes: 29 additions & 0 deletions EXTRA_CI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Reusable CI for Evolution CMS Extras

The workflow `.github/workflows/extra-integration.yml` is reusable from third-party Extra repositories. It checks out the calling repository and eMCP, installs both as local Composer path repositories in a fresh Evolution CMS, runs migrations, and verifies MCP `initialize` and `tools/list` using `emcp:test`.

Add a job to an Extra repository's GitHub Actions workflow:

```yaml
jobs:
emcp:
uses: evolution-cms/evo-mcp/.github/workflows/extra-integration.yml@main
with:
evo_ref: 3.5.x
php_version: '8.4'
server_handle: content
# Optional: tools your Extra contributes; each must appear in tools/list.
expected_tools: >-
vendor.tool_one
vendor.tool_two
```

Inputs (all optional): `evo_ref` (Evolution CMS branch or tag, default `3.5.x`), `emcp_ref` (eMCP ref, default `main`), `php_version` (default `8.4`), `server_handle` (default `content`), `expected_tools` (space- or newline-separated tool names, default empty).

The job, in order: installs a clean Evolution CMS on SQLite, adds the Extra and eMCP from the checked-out sources (as a site owner adding them later would), runs `package:discover`, publishes the eMCP config, runs all migrations and fails if any is still pending (`artisan migrate` itself exits 0 when one fails), shows both packages and the configured servers, then runs `emcp:test`. The run summary contains the `emcp:test` output, including every tool name `tools/list` returned (all pages).

The caller must have a valid root `composer.json` declaring the Extra's Composer package name. The workflow tests the calling commit rather than a published Packagist version. It does not require a Claude Code plugin, and it does not install optional API credentials.

`emcp:test` verifies MCP `initialize` and `tools/list` for the selected server, and with `expected_tools` it fails when any named tool is missing (`php artisan emcp:test --server=content --expect-tool=vendor.tool_one`). It does not call the tools: invoking them needs a manager identity and data the Extra must set up, so `tools/call` coverage remains the Extra's own test suite. Without `expected_tools` the workflow does not assert that the Extra contributes any tool.

Pin the reusable workflow to a release tag or commit SHA for reproducible CI once a stable version is available.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ toolset is package-owned and the registry will reject that external server.
`php artisan emcp:test --server=<handle>` runs generic `initialize` and
`tools/list` checks for third-party servers. When the selected class is the
canonical eMCP `ContentServer`, it also verifies the required Evolution toolset.
Add `--expect-tool=<name>` (repeatable) to fail when a tool an Extra contributes
is missing; [EXTRA_CI.md](EXTRA_CI.md) wires this into a reusable workflow.
Use `php artisan emcp:list-servers` to see both accepted servers and concrete
reasons why configured entries were rejected.

Expand Down
Loading
Loading