forked from opea-project/GenAIComps
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
The text2cypher microservice currently lacks MCP (Model Context Protocol) support, preventing AI agents from utilizing its natural language to Cypher query translation capabilities. This feature request proposes adding MCP support to align with other microservices in the GenAIComps framework.
Problem Statement
As a developer building AI agent applications, I need the text2cypher microservice to support MCP so that AI agents can directly interact with Neo4j databases through natural language queries. Currently, AI agents cannot discover or use the text2cypher service through the standard MCP protocol, limiting integration possibilities.
Current State
- The text2cypher service is registered without MCP parameters in
/comps/text2cypher/src/opea_text2cypher_microservice.py - Other microservices (feedback_management, prompt_registry, web_retrievers, etc.) already have MCP support
- No
/sseendpoint is exposed for MCP client connections
Proposed Solution
Add MCP support to text2cypher by updating the service registration to include:
enable_mcpparameter (controlled by environment variable)mcp_func_typeset toMCPFuncType.TOOL- Descriptive
descriptionfor AI agent discovery
Implementation Details
# Add environment variable check
enable_mcp = os.getenv("ENABLE_MCP", "").strip().lower() in {"true", "1", "yes"}
# Update the service registration
@register_microservice(
name="opea_service@text2cypher",
service_type=ServiceType.TEXT2CYPHER,
endpoint="/v1/text2cypher",
host="0.0.0.0",
port=9097,
enable_mcp=enable_mcp,
mcp_func_type=MCPFuncType.TOOL,
description="Convert natural language queries to Neo4j Cypher queries for graph database operations"
)Benefits
- AI Agent Integration: Enables AI agents to query Neo4j databases using natural language
- Consistency: Aligns text2cypher with other MCP-enabled microservices
- Flexibility: Environment variable control allows optional enablement
- Discoverability: AI agents can discover and understand the service capabilities
Testing Plan
- Verify MCP SSE endpoint (
/sse) is exposed whenENABLE_MCP=true - Test discovery through
OpeaMCPToolsManager - Validate tool execution with sample natural language queries
- Ensure backward compatibility when MCP is disabled
- Add integration test similar to
test_feedback_management_mcp.sh
Acceptance Criteria
- text2cypher service can be enabled with MCP support via
ENABLE_MCPenvironment variable - Service is discoverable through MCP client tools
- AI agents can successfully execute natural language to Cypher translations
- No breaking changes to existing functionality
- Documentation updated to include MCP usage examples
Additional Context
- MCP implementation pattern is well-established in the codebase
- The change is minimal and follows existing conventions
- This enables powerful AI agent workflows for knowledge graph interactions
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request