Skip to main content
Glama

Breadcrumb MCP Server

by ScottHoang
server.py2.16 kB
"""Breadcrumb MCP Server - Main entry point.""" import asyncio import logging import os from pathlib import Path from mcp.server import Server from mcp.server.stdio import stdio_server from .tools import register_tools from .resources import register_resources # Configure logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger("breadcrumb-mcp") def get_breadcrumb_root() -> Path: """Get the breadcrumb root directory from environment or default.""" root = os.environ.get("BREADCRUMB_ROOT") if not root: # Default to home directory with breadcrumbs folder root = str(Path.home() / "breadcrumbs") root_path = Path(root) # Create root directory if it doesn't exist root_path.mkdir(parents=True, exist_ok=True) # Create projects directory if it doesn't exist (root_path / "projects").mkdir(exist_ok=True) return root_path def get_templates_dir() -> Path: """Get the templates directory from the package.""" # Templates are now in the package directory templates_dir = Path(__file__).parent / "templates" if not templates_dir.exists(): raise ValueError(f"Templates directory not found: {templates_dir}") return templates_dir async def main(): """Run the MCP server.""" try: breadcrumb_root = get_breadcrumb_root() templates_dir = get_templates_dir() logger.info(f"Starting Breadcrumb MCP server with root: {breadcrumb_root}") logger.info(f"Using templates from: {templates_dir}") # Create server instance server = Server("breadcrumb") # Register tools and resources register_tools(server, breadcrumb_root, templates_dir) register_resources(server, breadcrumb_root) # Run server async with stdio_server() as (read_stream, write_stream): await server.run( read_stream, write_stream, server.create_initialization_options() ) except Exception as e: logger.error(f"Server error: {e}", exc_info=True) raise if __name__ == "__main__": asyncio.run(main())

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/ScottHoang/breadcrumbs_mcp'

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