Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add checks and better error messages on server object for mcp run #297

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

john0312
Copy link
Contributor

mcp run/dev command expects the server object in the python file to be a global variable, and it must be of the FastMCP type and not the low level Server type. The previous error messages may be confusing to users who are not aware of these facts.

Motivation and Context

It is a bit confusing to users who tries to run an MCP server of the low level Server variant with the mcp run command and get unrelated error messages.

How Has This Been Tested?

Run an MCP server of the low level Server variant and check that the correct error message is displayed.

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

N/A

@dsp-ant dsp-ant self-requested a review March 19, 2025 12:03
@john0312
Copy link
Contributor Author

(Force pushed to resolve merge conflict.)

Copy link
Member

@dsp-ant dsp-ant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to merge this, but there are two minor nits I'd love to be addressed.

@john0312 john0312 force-pushed the server_obj_check branch 4 times, most recently from 6105346 to 2dfdada Compare March 25, 2025 14:43
@john0312 john0312 requested a review from dsp-ant March 25, 2025 14:59
…n/dev

mcp run/dev command expects the server object in the python file to be a
global variable, and it must be of the FastMCP type and not the low level
Server type. The previous error messages may be confusing to users who
are not aware of these facts.
@john0312
Copy link
Contributor Author

Hello @dsp-ant
Just want to let you know that this PR is ready to be merged.
Thank you.

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.

2 participants