Skip to main content
Glama

gitSERVER README Manager

main.py2.27 kB
from mcp.server.fastmcp import FastMCP import os #create a mcp server mcp = FastMCP("gitSERVER") if not os.path.exists("README.md"): readme_file = os.path.join(os.path.dirname(__file__), "README.md") def ensure_readme(): if not os.path.exists(readme_file): with open(readme_file, 'w') as file: file.write("") #create tools for the server @mcp.tool() def create_file(response: str) -> str: """ Generate the content for the readme file after understanding the project. Args: response(str): Gets the context of the project from the response and uses it to generate content for the readme file. Returns: str: A detailed description about the project, how to use it in a structred format of a standard github readme file. """ ensure_readme() with open(readme_file, "a") as file: file.write(response + "\n") return "Readme File content has been generated." @mcp.tool() def sumamrize_readme() -> str: """ Access the readme file and read all of its content to summarize it. Returns: str: A summary of the entire readme file. """ ensure_readme() with open(readme_file, "r") as file: content = file.read().strip() return content or "The readme file is empty." #provide resources for the server @mcp.resource("README://content") def get_folder() -> str: """ Get the required folder and read all of the files within the folder. Args: folder (str): The folder which is to be accessed. Returns: str: All the files that exists within the accessed directory. """ if not os.path.isdir(readme_file): raise ValueError ("No such directory exists.") else: with open(readme_file, "r") as file: content = file.readlines().strip() return content @mcp.prompt() def readme_summary() -> str: """ Generate a prompt asking to summarize the readme file. Returns: str: A prompt string that asks for the step by step summary of the readme file. If the readme file is empty then displat a message about that. """ ensure_readme() with open(readme_file, "r") as file: content = file.read().strip() if not content: return "The readme file is empty." response = f"Summarize the content of the readme file: {content}" return response

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/rudra-pratapsingh/mcp-server-git-readme-file-'

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