We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/M-H-Amini/Overleaf-MCP-Server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
__main__.py•1.03 KiB
from fastmcp import FastMCP
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
from mh_overleaf import MHOverleaf
import logging as log
mcp = FastMCP("overleaf_mcp")
project_id = os.getenv("PROJECT_ID")
token = os.getenv("OVERLEAF_TOKEN")
log.info(f"Project ID: {project_id}")
log.info(f"Overleaf Token: {token}")
overleaf = MHOverleaf(project_id, token)
@mcp.tool()
def list_of_files():
"""Returns a list of files in the Overleaf project.
Returns:
list: A list of file paths in the Overleaf project.
"""
return overleaf.list_files()
@mcp.tool()
def read_file(filename):
"""Reads the content of a specific file in the Overleaf project.
Args:
filename (str): The name (path) of the file to read. The name is relative to the project root.
For example, "main.tex" or "sections/chapter1.tex".
Returns:
str: The content of the specified file.
"""
return overleaf.read_file(filename)
def main():
mcp.run(transport='stdio')
if __name__ == "__main__":
main()