Update server.py
Browse files
server.py
CHANGED
|
@@ -2,6 +2,8 @@ import os
|
|
| 2 |
import uvicorn
|
| 3 |
|
| 4 |
from mcp.server.fastmcp import FastMCP
|
|
|
|
|
|
|
| 5 |
|
| 6 |
from langchain_community.utilities import SQLDatabase
|
| 7 |
from langchain_community.tools.sql_database.tool import QuerySQLCheckerTool
|
|
@@ -21,9 +23,14 @@ mcp = FastMCP("Credit Card Database Server")
|
|
| 21 |
credit_card_db = SQLDatabase.from_uri(r"sqlite:///data/ccms.db")
|
| 22 |
query_checker_tool = QuerySQLCheckerTool(db=credit_card_db, llm=llm)
|
| 23 |
|
| 24 |
-
@mcp.
|
| 25 |
-
def home():
|
| 26 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
|
| 29 |
@mcp.tool()
|
|
|
|
| 2 |
import uvicorn
|
| 3 |
|
| 4 |
from mcp.server.fastmcp import FastMCP
|
| 5 |
+
from starlette.requests import Request
|
| 6 |
+
from starlette.responses import JSONResponse, Response
|
| 7 |
|
| 8 |
from langchain_community.utilities import SQLDatabase
|
| 9 |
from langchain_community.tools.sql_database.tool import QuerySQLCheckerTool
|
|
|
|
| 23 |
credit_card_db = SQLDatabase.from_uri(r"sqlite:///data/ccms.db")
|
| 24 |
query_checker_tool = QuerySQLCheckerTool(db=credit_card_db, llm=llm)
|
| 25 |
|
| 26 |
+
@mcp.custom_route("/", methods=["GET"])
|
| 27 |
+
async def home(request: Request) -> Response:
|
| 28 |
+
return JSONResponse(
|
| 29 |
+
status_code=200,
|
| 30 |
+
content={
|
| 31 |
+
"message": "This is an MCP server that interfaces with a credit card database"
|
| 32 |
+
}
|
| 33 |
+
)
|
| 34 |
|
| 35 |
|
| 36 |
@mcp.tool()
|