Skip to main content
Glama
main.py1.07 kB
import datetime import os from app.mcp_server import lifespan, setup_mcp_server from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware # Configuration USER_ID = os.getenv("USER_ID", "default") DEFAULT_APP_ID = os.getenv("DEFAULT_APP_ID", "selfmemory") # Initialize FastAPI app with lifespan for MCP session management app = FastAPI( title="SelfMemory API", description="Memory operations API with MCP protocol support", lifespan=lifespan, ) app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) # Setup MCP server setup_mcp_server(app) @app.get("/") def read_root(): return {"message": "SelfMemory API", "status": "running"} @app.get("/health") def health_check(): return {"status": "healthy", "timestamp": datetime.datetime.now().isoformat()} if __name__ == "__main__": import uvicorn host = os.getenv("API_HOST", "0.0.0.0") port = int(os.getenv("API_PORT", "8765")) uvicorn.run(app, host=host, port=port)

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/shrijayan/SelfMemory'

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