Skip to content

docs: add warning about module name conflicts in FileSystemProvider#3812

Closed
vincent067 wants to merge 1 commit intoPrefectHQ:mainfrom
vincent067:docs/warn-about-module-name-conflicts
Closed

docs: add warning about module name conflicts in FileSystemProvider#3812
vincent067 wants to merge 1 commit intoPrefectHQ:mainfrom
vincent067:docs/warn-about-module-name-conflicts

Conversation

@vincent067
Copy link
Copy Markdown
Contributor

Summary

This PR adds a warning to the FileSystemProvider documentation about potential import conflicts when naming the components directory mcp.

Problem

Users have reported confusion when using mcp as their components directory name with an __init__.py file. This causes import conflicts with the mcp package that FastMCP depends on, resulting in errors like:

ImportError: cannot import name 'McpError' from 'mcp'

Solution

Add a clear warning in the Quick Start section advising users to avoid naming their components directory mcp when using package mode (with __init__.py).

Changes

  • Added <Warning> block in docs/servers/providers/filesystem.mdx
  • Suggested alternative directory names: mcp_components, server, or components

Checklist

  • Documentation change only
  • No code changes
  • Follows existing documentation style

Add a warning to the FileSystemProvider documentation advising users
against naming their components directory 'mcp' when it contains an
__init__.py file. This prevents import conflicts with the mcp package
that FastMCP depends on.

Fixes potential confusion reported in discussions about FileSystemProvider
import errors.
@marvin-context-protocol marvin-context-protocol Bot added the documentation Updates to docs, examples, or guides. Primary change is documentation-related. label Apr 10, 2026
@jlowin
Copy link
Copy Markdown
Member

jlowin commented Apr 12, 2026

Thanks for flagging this, but I don't want to add a warning. The real problem is that our own quickstart example tells users to name the directory mcp/:

FileSystemProvider(Path(__file__).parent / "mcp")

That's the footgun — the directory name collides with the installed mcp SDK package, so Python can't resolve component imports correctly. The right fix is to change the example (and the prose reference on the next line) to something neutral like components/ or server/. Once the example isn't leading people into the collision, there's nothing special to warn about. We'd be setting a bad precedent if we started adding cautionary blocks for every package name someone might accidentally shadow — that's what sys.path is for.

Going to close this, but happy to review a follow-up that just updates the example.

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

Labels

documentation Updates to docs, examples, or guides. Primary change is documentation-related.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants