Skip to content

filsystem MCP default args is appended instead of replaced #1184

@reegnz

Description

@reegnz

Bug description

The filesystem MCP config in the registry is misbehaving, and the default args cannot be overridden properly.

Steps to reproduce

thv run --volume /Users/$USER/repos/github.com/stacklok/toolhive:/Users/$USER/repos/github.com/stacklok/toolhive filesystem -- /Users/$USER/repos/github.com/stacklok/toolhive

After launching I'm seeing this error:

❯ thv logs filesystem
Error accessing directory /projects: Error: ENOENT: no such file or directory, stat '/projects'
    at async Object.stat (node:internal/fs/promises:1031:18)
    at async file:///app/dist/index.js:33:23
    at async Promise.all (index 1)
    at async file:///app/dist/index.js:31:1 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'stat',
  path: '/projects'
}

The docker image launched by the thv cli seems to append the default /projects to the args, even if there's user-provided args:

❯ docker inspect filesystem  | jq '.[].Args'
[
  "/app/dist/index.js",
  "/Users/zoltanreegn/reegnz/github.com/stacklok/toolhive",
  "/projects"
]

Expected behavior

When providing cli args to the thv run command they override the default args.

Actual behavior

The default args are not overridden, they are appended to the user-provided arg list.
The docker container spawned by the command appends /projects to the provided list of args, making it /home/user/mydir /projects.

Environment (if relevant)

  • OS/version: macOS 15.5
  • ToolHive version: v0.2.0

Additional context

Seems like #1118 introduced this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions