Skip to content

[bounty] tavily-mcp version flag prints unknown from npm package #269

@wowsofine

Description

@wowsofine

Public repository URL

https://github.com/tavily-ai/tavily-mcp

Upstream issue URL, if any

No separate upstream issue found. Upstream fix PR: tavily-ai/tavily-mcp#175

Bug or task summary

The published tavily-mcp@0.2.20 package exposes the tavily-mcp bin, but its top-level version flag returns unusable metadata:

  • tavily-mcp --version exits 0 and prints unknown.
  • tavily-mcp --help exits 0 and prints normal help.

Expected behavior: --version should print the installed package version. This makes npm metadata checks, CI smoke tests, and agent setup probes able to identify the installed package.

Root cause: the published bin runs through npm's .bin symlink path, and yargs cannot infer the package version in that installed-package execution path. The PR resolves the real entrypoint path, walks up to the installed package.json, binds that version explicitly, reuses the value for MCP server metadata, and adds a packed-tarball test that runs through npm exec.

Exact reproduction commands

npm exec --yes --package=tavily-mcp@0.2.20 -- tavily-mcp --version
npm exec --yes --package=tavily-mcp@0.2.20 -- tavily-mcp --help

Observed before the patch:

tavily-mcp --version
unknown

tavily-mcp --help
Options:
  --version     Show version number
  --list-tools  List all available tools and exit
  --help        Show help

File/function/test pointers

  • src/index.ts: resolves the real bin entrypoint, walks up to package.json, passes that value to yargs .version(...), and uses it for MCP server metadata.
  • tests/cli-metadata.test.mjs: builds the package, creates a tarball with npm pack, and runs npm exec --package=<tarball> -- tavily-mcp --version so the test covers the published-package path.
  • package.json: adds npm test.

Verification after patch

Run in the upstream checkout:

npm test
npm pack --pack-destination /tmp
npm exec --yes --package=/tmp/tavily-mcp-0.2.20.tgz -- tavily-mcp --version
npm exec --yes --package=/tmp/tavily-mcp-0.2.20.tgz -- tavily-mcp --help
git diff --check

Results:

  • Red test first: packed tarball test failed before implementation with unknown !== 0.2.20.
  • Node test suite: 2 passed.
  • Local tarball smoke: installed tarball prints 0.2.20 for --version.
  • Local tarball help smoke: exits 0 and prints yargs help.
  • Diff check: passed.

Duplicate or active-work check

Rule check

  • Public open-source work.
  • No secrets, credentials, private data, KYC, paid services, scraping, spam, or destructive action required.
  • Reproduction uses npm metadata commands only and does not require a Tavily API key.

Payout details can be provided privately after selection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions