We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/prefrontalsys/mnemex'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
context.py•862 B
"""Shared context for CortexGraph."""
from __future__ import annotations
from mcp.server.fastmcp import FastMCP
from .storage.jsonl_storage import JSONLStorage
# Create the FastMCP server instance
mcp = FastMCP(
name="cortexgraph",
)
# Create the database instance (lazy initialization available via get_db())
_db: JSONLStorage | None = None
def get_db() -> JSONLStorage:
"""Get the storage instance (lazy initialization).
Returns:
Configured JSONLStorage instance
Note:
This getter pattern allows agents to be imported without
immediately initializing storage, improving testability.
"""
global _db
if _db is None:
_db = JSONLStorage()
return _db
# Legacy: keep `db` for backwards compatibility with existing code
# that imports `from cortexgraph.context import db`
db = JSONLStorage()