Skip to content

feat: add createSandboxServer export for registry scanning#42

Closed
jeff-atriumn wants to merge 2 commits intomainfrom
feat/smithery-compat
Closed

feat: add createSandboxServer export for registry scanning#42
jeff-atriumn wants to merge 2 commits intomainfrom
feat/smithery-compat

Conversation

@jeff-atriumn
Copy link
Member

Change Summary

Refactor server creation into a factory function and export createSandboxServer for MCP registries that scan server capabilities at publish time.

  • Extract createServer() factory function — no more module-level server singleton
  • Export createSandboxServer() for registry scanning (Smithery, etc.)
  • Guard main() so stdio transport only starts on direct execution, not on import
  • Make __dirname in pricing.ts resilient to CJS bundling (fallback to process.cwd())

Risk & Impact Assessment

Risk Level: low

  • Server behavior is identical when run via npx tokencost-dev
  • Only affects import-time behavior (new: no side effects on import)
  • All 92 tests pass

Test Plan

  • npx tsc --noEmit — passes
  • npm run lint — passes
  • npm run test:run — 92/92 pass
  • npm run build — passes
  • Smithery CLI scan succeeded (found all 4 tools)

Manual Verification Steps

  1. npm start — verify server still starts normally
  2. Test with Claude Code to confirm tools work end-to-end

🤖 Generated with Claude Code

jeff-atriumn and others added 2 commits February 26, 2026 18:16
Match the published npm and MCP registry version.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract server creation into a factory function and export
createSandboxServer for MCP registries (like Smithery) that need
to scan server capabilities without starting stdio transport.

Also make __dirname resilient to CJS bundling environments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tokencost Building Building Preview, Comment Feb 27, 2026 0:25am

Request Review

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