Skip to content

fastmcp dev inspector` imports the server before applying its uv environment #5524

Description

@mikamikasuki

What happened?

fastmcp dev inspector loads a filesystem server in the invoking Python process before it launches MCP Inspector and the configured uv run command. When a server imports a dependency supplied through --with, --with-editable, --with-requirements, or --project that is not installed in the caller's environment, the preliminary import raises ModuleNotFoundError and the configured subprocess never starts.

For example, a server that imports a package provided only through --with cannot be inspected even though the Inspector command is configured to install and run with that package.

The same preflight also imports the module and resolves its factory before launching fastmcp run, which imports the module and invokes the factory again. Factories with side effects therefore run twice.

Expected behavior: resolve and validate the server in the configured environment used by Inspector, and invoke its factory once for the server process.

Example Code

Version Information

- FastMCP main: `5baeacfe20eca735cb949564b4915f93a622b916`
- Python: 3.12.15
- OS: macOS 15.0.1 arm64

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.cliRelated to FastMCP CLI commands (run, dev, install) or CLI functionality.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions