pgurazada1 commited on
Commit
00424c5
·
verified ·
1 Parent(s): 736316b

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +0 -83
server.py CHANGED
@@ -1,86 +1,3 @@
1
- # import os
2
- # import uvicorn
3
-
4
- # from mcp.server.fastmcp import FastMCP
5
- # from starlette.requests import Request
6
- # from starlette.responses import PlainTextResponse, Response
7
-
8
- # from langchain_community.utilities import SQLDatabase
9
- # from langchain_community.tools.sql_database.tool import QuerySQLCheckerTool
10
- # from langchain_openai import ChatOpenAI
11
-
12
- # llm = ChatOpenAI(
13
- # api_key=os.environ.get('OPENAI_API_KEY', None),
14
- # base_url=os.environ['OPENAI_BASE_URL'],
15
- # model='gpt-4o-mini',
16
- # temperature=0
17
- # )
18
-
19
- # # Create an MCP server
20
- # mcp = FastMCP("Credit Card Database Server")
21
-
22
- # credit_card_db = SQLDatabase.from_uri(r"sqlite:///data/ccms.db")
23
- # query_checker_tool = QuerySQLCheckerTool(db=credit_card_db, llm=llm)
24
-
25
-
26
- # @mcp.custom_route("/", methods=["GET"])
27
- # async def home(request: Request) -> PlainTextResponse:
28
- # return PlainTextResponse(
29
- # """
30
- # Credit Card Database MCP Server
31
- # ----
32
- # This server gives you access to the following tools:
33
- # 1. sql_db_list_tables: This tool can be used to list the tables in the database.
34
- # 2. sql_db_schema: This tool can be used to get the schema of a table.
35
- # 3. sql_db_query_checker: This tool can be used to check if a query is valid.
36
- # 4. sql_db_query: This tool can be used to execute a query.
37
- # """
38
- # )
39
-
40
-
41
- # @mcp.tool()
42
- # def sql_db_list_tables():
43
- # """
44
- # Returns a comma-separated list of table names in the database.
45
- # """
46
- # return credit_card_db.get_usable_table_names()
47
-
48
-
49
- # @mcp.tool()
50
- # def sql_db_schema(table_names: list[str]) -> str:
51
- # """
52
- # Input 'table_names_str' is a comma-separated string of table names.
53
- # Returns the DDL SQL schema for these tables.
54
- # """
55
- # return credit_card_db.get_table_info(table_names)
56
-
57
-
58
- # @mcp.tool()
59
- # def sql_db_query_checker(query: str) -> str:
60
- # """
61
- # Input 'query' is a SQL query string.
62
- # Checks if the query is valid.
63
- # If the query is valid, it returns the original query.
64
- # If the query is not valid, it returns the corrected query.
65
- # This tool is used to ensure the query is valid before executing it.
66
- # """
67
-
68
- # return query_checker_tool.run(query)
69
-
70
- # @mcp.tool()
71
- # def sql_db_query(query: str) -> str:
72
- # """
73
- # Input 'query' is a SQL query string.
74
- # Executes the query (SELECT only) and returns the result.
75
- # """
76
- # return credit_card_db.run(query)
77
-
78
-
79
- # if __name__ == "__main__":
80
- # uvicorn.run(mcp.streamable_http_app, host="0.0.0.0", port=8000)
81
-
82
-
83
-
84
  import os
85
  import uvicorn
86
  import inspect
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import os
2
  import uvicorn
3
  import inspect