We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/HC010602/MainMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
fastapi_mod.cpython-310.pyc•4.81 KiB
o
}�&h � @ st d dl Z d dlmZmZ d dlmZmZmZmZ d dl m
Z
d dlZd dlZ
d dlmZ d dlZd dlZdd� ZdS )� N)�FastAPI�Query)�HTMLResponse�PlainTextResponse�FileResponse�JSONResponse)�CORSMiddleware)�
messageboxc C s� t � } | jtdgddgdgd� | jdtd�dd� �}| jdtd�d d
� �}| jdtd�dd
� �}| jdtd�td �fdtfdd��}| jdtd�dd� �}| �d�dd� �}tj | ddd� d S )N�*T)Z
allow_originsZallow_credentialsZ
allow_methodsZ
allow_headers�/)�response_classc � s\ �t j�t j�t j�t��d�} t| ddd��
}|�� }W d � |S 1 s'w Y |S )Nztemplates/index.html�r�utf-8��encoding)�os�path�join�dirname�__file__�open�read��html_file_path�f�html_content� r �?/Users/houyan.2/Downloads/MasterMCP-main_1/utils/fastapi_mod.py�root s �
��z run_fastapi_server.<locals>.rootz/randomc � s� �t �ddg�} tj�tj�tj�t��d| � ��}z t|ddd��}|�� }W d � |W S 1 s3w Y |W S t yM t
d| � d�d d
� Y S w )Nz gold.htmlzgold_evil.htmlz
templates/r
r r zFile z does not exist� ��content�status_code)�random�choicer r r r r r r �FileNotFoundErrorr )Z
template_namer r r r r r �random_gold s �$
���z'run_fastapi_server.<locals>.random_goldz/imagec � s( �t j�t j�t j�t��d�} t| �S )Nztemplates/evil.png)r r r r r r )Z
image_pathr r r � get_image- s �z%run_fastapi_server.<locals>.get_imagez/error_info�worldc � s"