Skip to content

Avoid requiring duplicate version strings in runCLI and runMCP #244

@kamilio

Description

@kamilio

Summary

Toolcraft examples encourage passing version strings manually to both CLI and MCP runtime setup, for example:

await runCLI(root, { version: "0.1.0" });
await runMCP(root, { name: "mytool", version: "0.1.0" });

This is easy to forget or let drift from package.json.

Expected

It would be nicer if Toolcraft could infer the package version by default, or provide a helper for reading the nearest package metadata.

Possible options:

  • runCLI(root) reads nearest package.json and enables --version automatically.
  • runMCP(root, { name }) can infer version from package metadata.
  • Export a helper like packageMetadata(import.meta.url) so examples avoid hardcoded duplicate strings.

Why this matters

For small CLIs, a hardcoded version: "0.1.0" in the entrypoint feels like boilerplate and can become wrong when package versions change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions