From b8ebac941c2a09eb255caf120363e2baf3e88286 Mon Sep 17 00:00:00 2001 From: Dan Barr <6922515+danbarr@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:52:16 -0400 Subject: [PATCH 1/3] Run thv version to verify installation Signed-off-by: Dan Barr <6922515+danbarr@users.noreply.github.com> --- scripts/install-thv.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/install-thv.sh b/scripts/install-thv.sh index e20a6fbc..6b8d3d18 100755 --- a/scripts/install-thv.sh +++ b/scripts/install-thv.sh @@ -72,5 +72,9 @@ chmod +x /tmp/thv cp /tmp/thv "$INSTALL_DIR/thv" rm -f /tmp/toolhive.tar.gz /tmp/thv -echo "ToolHive CLI (thv) installed successfully. Version: $RELEASE_VERSION" -echo "The 'thv' command is now available in your PATH." \ No newline at end of file +thv version || { + echo "Installation failed: 'thv' command is not working." + exit 1 +} + +echo "ToolHive CLI (thv) installed successfully." From adf6e1489648e11b85070a1a8cc272985b120eba Mon Sep 17 00:00:00 2001 From: Dan Barr <6922515+danbarr@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:52:45 -0400 Subject: [PATCH 2/3] Fail production builds if MCPMetadata fetch fails Signed-off-by: Dan Barr <6922515+danbarr@users.noreply.github.com> --- docusaurus.config.ts | 2 ++ plugins/mcp-metadata-plugin/src/index.ts | 7 ++++++- plugins/mcp-metadata-plugin/src/types.ts | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 9c615ea4..d2265fe7 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -23,6 +23,8 @@ const config: Config = { './plugins/mcp-metadata-plugin', { thvCommand: 'thv', // Can be customized if thv is in a different path + failOnError: + process.env.NODE_ENV === 'production' || process.env.CI === 'true', }, ], ], diff --git a/plugins/mcp-metadata-plugin/src/index.ts b/plugins/mcp-metadata-plugin/src/index.ts index 4ccd94cd..46ca55a4 100644 --- a/plugins/mcp-metadata-plugin/src/index.ts +++ b/plugins/mcp-metadata-plugin/src/index.ts @@ -14,7 +14,7 @@ export default function mcpMetadataPlugin( context: LoadContext, options: PluginOptions = {} ): Plugin { - const { thvCommand = 'thv' } = options; + const { thvCommand = 'thv', failOnError = false } = options; return { name: 'mcp-metadata-plugin', @@ -53,6 +53,11 @@ export default function mcpMetadataPlugin( `Failed to fetch data for MCP server: ${serverName}`, error ); + + if (failOnError) { + throw error; // This will fail the build + } + // Store error message as fallback serverData[serverName] = `# Error fetching data for ${serverName} # ${error.message} diff --git a/plugins/mcp-metadata-plugin/src/types.ts b/plugins/mcp-metadata-plugin/src/types.ts index 750d0ccc..c01fe65c 100644 --- a/plugins/mcp-metadata-plugin/src/types.ts +++ b/plugins/mcp-metadata-plugin/src/types.ts @@ -3,6 +3,7 @@ export interface PluginOptions { thvCommand?: string; // Custom thv command path + failOnError?: boolean; // Whether to fail the build on thv command errors } export interface PluginContent { From c647ee36a6b6322aacec961c1601f53af86df384 Mon Sep 17 00:00:00 2001 From: Dan Barr <6922515+danbarr@users.noreply.github.com> Date: Thu, 18 Sep 2025 09:30:19 -0400 Subject: [PATCH 3/3] Revert temporary fix Signed-off-by: Dan Barr <6922515+danbarr@users.noreply.github.com> --- scripts/install-thv.sh | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/scripts/install-thv.sh b/scripts/install-thv.sh index 6b8d3d18..96620435 100755 --- a/scripts/install-thv.sh +++ b/scripts/install-thv.sh @@ -13,28 +13,23 @@ if ! command -v jq >/dev/null 2>&1; then exit 1 fi -#API_ENDPOINT="https://api.github.com/repos/stacklok/toolhive/releases/latest" +API_ENDPOINT="https://api.github.com/repos/stacklok/toolhive/releases/latest" # Fetch release information -#RELEASE_JSON=$(curl -sf "$API_ENDPOINT" || { -# echo "Failed to fetch release information from GitHub API" -# exit 1 -#}) -#RELEASE_VERSION=$(echo "$RELEASE_JSON" | jq -r '.tag_name // empty' | sed 's/^v//') -#RELEASE_TARBALL=$(echo "$RELEASE_JSON" | jq -r \ -# --arg version "$RELEASE_VERSION" \ -# '.assets[] | select(.name == "toolhive_" + $version + "_linux_amd64.tar.gz") | .browser_download_url // empty') - -#if [ -z "$RELEASE_TARBALL" ]; then -# echo "Failed to get release tarball URL for release: ${RELEASE_VERSION}" -# echo "Please check if the tag exists in the repository" -# exit 1 -#fi - -# Temporary fix for early exit if container runtime isn't found +RELEASE_JSON=$(curl -sf "$API_ENDPOINT" || { + echo "Failed to fetch release information from GitHub API" + exit 1 +}) +RELEASE_VERSION=$(echo "$RELEASE_JSON" | jq -r '.tag_name // empty' | sed 's/^v//') +RELEASE_TARBALL=$(echo "$RELEASE_JSON" | jq -r \ + --arg version "$RELEASE_VERSION" \ + '.assets[] | select(.name == "toolhive_" + $version + "_linux_amd64.tar.gz") | .browser_download_url // empty') -RELEASE_VERSION="v0.2.17" -RELEASE_TARBALL="https://github.com/stacklok/toolhive/releases/download/v0.2.17/toolhive_0.2.17_linux_amd64.tar.gz" +if [ -z "$RELEASE_TARBALL" ]; then + echo "Failed to get release tarball URL for release: ${RELEASE_VERSION}" + echo "Please check if the tag exists in the repository" + exit 1 +fi # Determine installation location based on write permissions if [[ -w "/usr/local/bin" ]]; then