File size: 1,625 Bytes
82bf89e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import sys
import os

# Add current directory to Python path
current_dir = os.path.dirname(os.path.abspath(__file__))
if current_dir not in sys.path:
    sys.path.insert(0, current_dir)

# Set environment variables
os.environ['PYTHONPATH'] = current_dir

from fastapi_mcp import FastApiMCP

# import logging
# If relative import fails, try absolute import
from app import app
# logger = get_logger(__name__)


# Create an MCP server based on this app
# mcp = FastApiMCP(app)

review_mcp = FastApiMCP(app, name="Review MCP", include_operations=["review_generate"],describe_full_response_schema=True,  # Describe the full response JSON-schema instead of just a response example
    describe_all_responses=True, )
check_mcp = FastApiMCP(app, name="Check MCP", include_operations=["health_check"],describe_full_response_schema=True,  # Describe the full response JSON-schema instead of just a response example
    describe_all_responses=True, )

# Mount the MCP server directly to your app
# mcp.mount_sse()
review_mcp.mount_sse(mount_path="/review")
check_mcp.mount_sse(mount_path="/check")

if __name__ == "__main__":
    import uvicorn
    import sys
    import os
    
    # Add current directory to Python path
    current_dir = os.path.dirname(os.path.abspath(__file__))
    sys.path.insert(0, current_dir)
    
    print("πŸš€ Starting Review service...")
    print("πŸ“‘ MCP Endpoints:")
    print("   - Review MCP: http://localhost:8880/review")
    print("   - Check MCP: http://localhost:8880/check")
    print("🌐 API Documentation: http://localhost:8880/docs")
    
    uvicorn.run(app, host="0.0.0.0", port=8880)