Open
Conversation
Update pyproject.toml optional dependency from mcp>=1.0.0 to fastmcp>=2.0.0,<3 in preparation for FastMCP server rewrite. Add plans/ to .gitignore for local implementation plans. Resolves: neo4j-labs#3
Replace raw mcp SDK server with FastMCP-based implementation. - create_mcp_server(settings) as primary API with lifespan pattern - Neo4jMemoryMCPServer backward-compat wrapper for pre-connected clients - Support stdio, sse, and http transports via FastMCP - CLI entry point preserved with same argparse interface - Add unit tests for server creation, backward compat, and exports Phase 2 of issue neo4j-labs#3 implementation.
Add _tools.py with register_tools() that registers all 5 MCP tools as FastMCP decorated functions, porting logic from handlers.py: - memory_search: hybrid vector + graph search - memory_store: messages, facts, preferences - entity_lookup: entity with neighbor traversal - conversation_history: session message retrieval - graph_query: read-only Cypher with write-pattern blocking Renamed params to avoid Python builtins (type→memory_type, object→object_value). Uses ctx.request_context.lifespan_context for MemoryClient access. 25 new tests using FastMCP's in-memory Client for full tool execution. Phase 3 of issue neo4j-labs#3 implementation.
Add 4 MCP resources exposing memory data via URI templates:
- memory://conversations/{session_id} - conversation history
- memory://entities/{entity_name} - entity details
- memory://preferences/{category} - user preferences
- memory://graph/stats - knowledge graph statistics
Phase 4 of FastMCP migration (issue neo4j-labs#3).
Add 3 MCP prompts providing structured workflows: - memory_search_guide: guides effective memory searching - entity_analysis: structured entity relationship analysis - conversation_summary: conversation summarization workflow Phase 5 of FastMCP migration (issue neo4j-labs#3).
- Rewrite test_mcp_tools.py to test FastMCP registration (replaces old tools.py schema tests) - Rewrite test_mcp_handlers.py to use FastMCP Client (replaces direct MCPHandlers tests) - Update integration tests to use FastMCP test patterns - All tests now use consistent FastMCP in-memory Client approach - No more dependency on old handlers.py or tools.py modules Phase 6 of FastMCP migration (issue neo4j-labs#3).
- Wire register_tools/resources/prompts into create_mcp_server() and Neo4jMemoryMCPServer.__init__() so tools/resources/prompts are actually registered on the server - Delete old tools.py (hand-written JSON schemas) and handlers.py (old handler logic now in _tools.py) - Update example scripts to use FastMCP Client API instead of removed MCPHandlers and MEMORY_TOOLS - Update test_google_cloud_integration.py to use FastMCP registration - Update __init__.py module docstring All 699 unit tests + 23 example tests pass.
|
@MuddyBootsCode is attempting to deploy a commit to the lyonwj's projects Team on Vercel. A member of the Team first needs to authorize it. |
Resolve merge conflicts from upstream main adding add_reasoning_trace (6th MCP tool) while this branch migrated to FastMCP. - Port add_reasoning_trace from old handlers.py to FastMCP @mcp.tool() - Delete old handlers.py and tools.py (replaced by _tools.py) - Update all test files to expect 6 tools including add_reasoning_trace
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.
Migrated MCP server from raw mcp SDK to FastMCP
Added:
_common.py - shared get_client() helper to avoid duplicated context-access code
conftest.py for MCP tests - shared mock fixtures (make_mock_client, create_tool_server, create_resource_server)
Test for CALL db.* and CALL apoc.* procedure allowlisting in read-only query validation
Changed:
server.py - replaced monkey-patch (_lifespan_settings) with a closure-based lifespan pattern for managing MemoryClient lifecycle
server.py - removed hardcoded server_version from Neo4jMemoryMCPServer
_tools.py - fixed Cypher bug: neighbor.displayName → neighbor.name
_tools.py - removed CALL from write patterns so read-only procedures like CALL db.labels() and CALL apoc.meta.stats() are allowed
_tools.py, _resources.py, prompts.py - added TYPE_CHECKING imports and typed register*() signatures
_tools.py, _resources.py - use shared get_client() from _common
test_fastmcp_tools.py - rewrote to use shared fixtures, absorbed read-only query validation tests
test_mcp_resources.py - rewrote to use shared fixtures
test_mcp_server.py - updated lifespan tests to match new closure pattern
Deleted:
test_mcp_handlers.py - was a duplicate of test_fastmcp_tools.py