diff --git a/.gitignore b/.gitignore index 01455638fed7..11028706f3be 100644 --- a/.gitignore +++ b/.gitignore @@ -84,6 +84,8 @@ t/plugin/grpc-web/grpc-web-server t/plugin/grpc-web/node_modules/ pack pack-v*-linux.tgz* +t/plugin/mcp/servers/ +t/node_modules/ # release tar package *.tgz diff --git a/ci/init-common-test-service.sh b/ci/init-common-test-service.sh index 602f01a4ad23..bdf5fe4bb654 100755 --- a/ci/init-common-test-service.sh +++ b/ci/init-common-test-service.sh @@ -25,3 +25,7 @@ sleep 3s docker exec -i localstack sh -c "awslocal secretsmanager create-secret --name apisix-key --description 'APISIX Secret' --secret-string '{\"jack\":\"value\"}'" sleep 3s docker exec -i localstack sh -c "awslocal secretsmanager create-secret --name apisix-mysql --description 'APISIX Secret' --secret-string 'secret'" + +# prepare filesystem mcp server +sleep 3s +./ci/prepare_filesystem_mcp.sh diff --git a/ci/prepare_filesystem_mcp.sh b/ci/prepare_filesystem_mcp.sh new file mode 100755 index 000000000000..dbf423fa34ea --- /dev/null +++ b/ci/prepare_filesystem_mcp.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" + +VERSION="2025.7.1" +URL="https://github.com/modelcontextprotocol/servers/archive/refs/tags/${VERSION}.tar.gz" + +WORKDIR="$(mktemp -d)" +DEST_DIR="${REPO_ROOT}/t/plugin/mcp/servers" + +curl -L "${URL}" | tar -xz -C "${WORKDIR}" + +rm -rf "${DEST_DIR}" +mkdir -p "$(dirname "${DEST_DIR}")" + +cp -R "${WORKDIR}/servers-${VERSION}" "${DEST_DIR}" + +( + cd "${DEST_DIR}" + npm install + npm run build -w @modelcontextprotocol/server-filesystem +) + +echo "[OK] filesystem MCP ready: ${DEST_DIR}" diff --git a/t/plugin/mcp-bridge.t b/t/plugin/mcp-bridge.t index ed9c6e0c5897..ead6ce7972de 100644 --- a/t/plugin/mcp-bridge.t +++ b/t/plugin/mcp-bridge.t @@ -14,10 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -use t::APISIX; - -# This test cannot be executed normally at the moment, so it will be temporarily skipped and fixed in a later PR. -plan(skip_all => 'skip test case'); +use t::APISIX 'no_plan'; repeat_each(1); no_long_string(); @@ -74,8 +71,8 @@ property "args" validation failed: wrong type: expected array, got string "plugins": { "mcp-bridge": { "base_uri": "/mcp", - "command": "pnpm", - "args": ["dlx", "@modelcontextprotocol/server-filesystem@2025.7.1", "/"] + "command": "node", + "args": ["t/plugin/mcp/servers/src/filesystem/dist/index.js", "/"] } }, "uri": "/mcp/*" @@ -90,6 +87,7 @@ property "args" validation failed: wrong type: expected array, got string } --- response_body passed +--- wait: 2