Skip to content

fix: resolve CLI path for tier-check conformance subprocess#175

Merged
pcarleton merged 3 commits intomodelcontextprotocol:mainfrom
DePasqualeOrg:fix/tier-check-npx-compat
Mar 25, 2026
Merged

fix: resolve CLI path for tier-check conformance subprocess#175
pcarleton merged 3 commits intomodelcontextprotocol:mainfrom
DePasqualeOrg:fix/tier-check-npx-compat

Conversation

@DePasqualeOrg
Copy link
Contributor

Problem

tier-check shells out to run conformance tests using a relative path:

execSync(`node dist/index.js server --url ${options.serverUrl} -o ${outputDir}`, {
  cwd: process.cwd(),
  ...
});

When invoked via npx (or from any directory other than the conformance package root), process.cwd() points to the user's working directory, not the package directory. dist/index.js doesn't exist there, so the command fails silently (the error is caught on the next line), the output directory is empty, and reconcileWithExpected counts every expected scenario as a failure — producing 0% conformance scores.

Fix

Replace node dist/index.js with node "${process.argv[1]}", which resolves to the absolute path of the currently running CLI entry point regardless of working directory. Also removes the now-unnecessary cwd: process.cwd().

Testing

Ran tier-check from /tmp against my Swift SDK's conformance server.

Related

PR #168 addresses a similar issue on Windows (single-quote quoting in execSync) but retains the relative dist/index.js path, so the npx problem would persist even after that fix.

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling (n.a.)
  • I have added or updated documentation as needed (n.a.)

Use process.argv[1] instead of relative dist/index.js so tier-check
works when invoked via npx or from outside the package directory.
@pcarleton pcarleton enabled auto-merge (squash) March 12, 2026 10:01
@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 12, 2026

Open in StackBlitz

npx https://pkg.pr.new/@modelcontextprotocol/conformance@175

commit: 51b48bd

@pcarleton
Copy link
Member

Thank you for this!

@pcarleton pcarleton merged commit e702a25 into modelcontextprotocol:main Mar 25, 2026
4 checks passed
pcarleton added a commit to jeffhandley/mcp-conformance that referenced this pull request Mar 25, 2026
Combines the npx-compatibility fix from modelcontextprotocol#175 with this PR's execFileSync
approach. process.argv[1] resolves to the absolute path of the running CLI
regardless of working directory, so tier-check works when invoked via npx
or from any cwd.
pcarleton added a commit that referenced this pull request Mar 25, 2026
* Fix Windows compatibility in tier-check client conformance

Two issues prevented client conformance tests from running on Windows:

1. Single-quote quoting in execSync: The --command argument was wrapped in single quotes, which cmd.exe treats as literal characters rather than string delimiters. This caused the CLI to receive only the first word of the command. Switched to execFileSync with an args array to bypass shell quoting entirely.

2. Backslash path separators in parseOutputDir: dirname() on Windows returns auth\scenario-name but reconcileWithExpected compares against auth/scenario-name, causing auth scenarios to be double-counted. Normalize backslashes to forward slashes in parsed scenario names.

* fix: use process.argv[1] for CLI path in subprocess calls

Combines the npx-compatibility fix from #175 with this PR's execFileSync
approach. process.argv[1] resolves to the absolute path of the running CLI
regardless of working directory, so tier-check works when invoked via npx
or from any cwd.

---------

Co-authored-by: Paul Carleton <paulc@anthropic.com>
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.

2 participants