Skip to main content
Glama
limouren01

MCP File Management Framework

by limouren01
mysql.py1 kB
import mysql.connector from mysql.connector import Error from config import config def create_connection(): """ 创建到MySQL数据库的连接。 :return: 成功时返回数据库连接对象,失败时返回None。 """ connection = None try: connection = mysql.connector.connect( host=config.MYSQL_HOST, user=config.MYSQL_USER, passwd=config.MYSQL_PASSWORD, database=config.MYSQL_DATABASE, port=int(config.MYSQL_PORT) ) if connection.is_connected(): print("成功连接到 MySQL 数据库") except Error as e: print(f"连接数据库失败: {e}") return connection def close_connection(connection): """ 关闭数据库连接。 :param connection: 要关闭的数据库连接对象 """ if connection and connection.is_connected(): connection.close() print("数据库连接已关闭")

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/limouren01/mcp-framework'

If you have feedback or need assistance with the MCP directory API, please join our Discord server