Skip to content

fix(mcp): read version from package.json instead of hardcoding#1270

Open
webdevpraveen wants to merge 1 commit intoruvnet:mainfrom
webdevpraveen:fix/hardcoded-mcp-version
Open

fix(mcp): read version from package.json instead of hardcoding#1270
webdevpraveen wants to merge 1 commit intoruvnet:mainfrom
webdevpraveen:fix/hardcoded-mcp-version

Conversation

@webdevpraveen
Copy link

@webdevpraveen webdevpraveen commented Mar 2, 2026

Replaces the hardcoded '3.0.0-alpha' version string in system_status and system_info MCP tools with a dynamic read from
package.json

Problem

The system_status and system_info tools both return version: '3.0.0-alpha', but the actual installed npm package is v3.5.2. This causes confusion when users check the running server version against the installed package:

// Actual output
{ "version": "3.0.0-alpha" }

// Expected output
{ "version": "3.5.2" }

Fix

Added a getPackageVersion() helper that reads the version field from the root
package.json at runtime. Falls back to 'unknown' if the file cannot be read. Both hardcoded occurrences (lines 97 and 291) are replaced with calls to this helper.

File changed: v3/@claude-flow/cli/src/mcp-tools/system-tools.ts


Why this is safe

  • Uses the same readFileSync and existsSync that are already imported in the file.
  • Reads from process.cwd() which is standard for CLI tools and matches how the rest of the system resolves project-relative paths (e.g., getSystemDir() on line 34).
  • Graceful fallback to 'unknown' - no crash if package.json is missing.

Fixes Issue #1253

system_status and system_info tools return a hardcoded '3.0.0-alpha'
version string, but the actual npm package is v3.5.2. This causes
confusion when users check the running server version against the
installed package version.

Replace the hardcoded string with a getPackageVersion() helper that
reads the version field from the root package.json at runtime. Falls
back to 'unknown' if the file cannot be read.

Fixes ruvnet#1253
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant