Rewrite MCP server to use FastMCP high-level API#3
Open
scottyallen wants to merge 3 commits intoSiddhant-K-code:mainfrom
Open
Rewrite MCP server to use FastMCP high-level API#3scottyallen wants to merge 3 commits intoSiddhant-K-code:mainfrom
scottyallen wants to merge 3 commits intoSiddhant-K-code:mainfrom
Conversation
Replace low-level Server API with FastMCP for proper tool registration. The low-level API had complex async handling that caused TaskGroup errors and prevented tools from registering with Claude Code. - Switch from Server to FastMCP class - Use @mcp.tool() decorator instead of @server.call_tool() - Simplify function signatures (remove self parameter, use typed args) - Return strings directly instead of List[TextContent] - Replace async def with sync def (FastMCP handles async internally) - Simplify main() to just mcp.run() Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Enhance PhotosDBLoader with better state tracking: - Add _loading and _error state tracking - Add is_ready property to check load status - Provide clearer error messages for different failure states - Log photo count on successful load Improve logging throughout: - Use named logger instead of root logging module - Add filename and line numbers to log format - Add exc_info=True to error logs for stack traces Fix null safety in helper functions: - Handle None photo.path in get_photo_details - Handle None photo.date in formatting - Return empty lists instead of None for persons/labels/keywords - Add datetime.min fallback for sorting photos with no date Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Some photos have a place object but place.name is None, causing AttributeError when calling .lower() on None. Add explicit null check for photo.place.name before string comparison. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem
The original implementation used the low-level Server API with @server.call_tool() decorators that had incorrect function signatures (using self parameter). This caused TaskGroup errors and prevented tools from registering properly with Claude Code.
Solution
Switched to FastMCP high-level API which:
Test plan
Generated with Claude Code