Skip to main content
Glama

FastMCP Boilerplate

by rainer85ah
chat.py669 B
from mcp.server.fastmcp import Context from typing import List, Dict from utils.logger_config import configure_logger LAST_N_MESSAGES = 2 chat_memory_store: Dict[str, List[Dict]] = {} logger = configure_logger("ChatContext") def get_chat_context(ctx: Context) -> List[Dict]: return chat_memory_store.get(ctx.request_id, []) def update_chat_context(ctx: Context, new_turn: Dict): session_id = ctx.request_id chat_memory_store.setdefault(session_id, []).append(new_turn) chat_memory_store[session_id] = chat_memory_store[session_id][-LAST_N_MESSAGES:] logger.info(f"[{session_id}] Memory updated with {len(chat_memory_store[session_id])} turns.")

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/rainer85ah/mcp-server'

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