We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ashwin2912/saleor-dashboard-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
"""Main entry point for Saleor MCP Server - Orchestration Only."""
import sys
import traceback
from mcp.server.fastmcp import FastMCP
from .config.settings import settings
from .client.saleor_client import SaleorClient
from .tools.products import GetProductsTool
from .utils.logger import logger
def register_tools(mcp: FastMCP, client: SaleorClient) -> None:
"""Register all MCP tools with the server."""
# Initialize tools
get_products_tool = GetProductsTool(client)
# Register get_products tool
@mcp.tool()
def get_products(
limit: int = 10, channel: str = "default-channel", category_id: str = None
):
"""Get list of products from the Saleor storefront."""
return get_products_tool.execute(
limit=limit, channel=channel, category_id=category_id
)
logger.info("✅ Registered tools: get_products")
def create_server() -> FastMCP:
"""Create and configure the MCP server."""
# Validate settings
try:
settings.validate()
except ValueError as e:
logger.error(f"❌ Configuration error: {e}")
sys.exit(1)
# Create server
mcp = FastMCP(settings.SERVER_NAME)
logger.info(f"🚀 Created MCP server: {settings.SERVER_NAME}")
# Initialize Saleor client
try:
client = SaleorClient()
logger.info("✅ Saleor client initialized")
except Exception as e:
logger.error(f"❌ Failed to initialize Saleor client: {e}")
sys.exit(1)
# Register all tools
register_tools(mcp, client)
return mcp
def main():
"""Main entry point - pure orchestration."""
try:
logger.info("🔄 Starting Saleor MCP Server...")
# Create configured server
mcp = create_server()
logger.info("✅ Server configured successfully")
logger.info("🎯 Ready to handle requests...")
# Start the server
mcp.run(transport="stdio")
except KeyboardInterrupt:
logger.info("⏹️ Server stopped by user")
except Exception as e:
logger.error(f"💥 Failed to start MCP server: {e}")
traceback.print_exc()
sys.exit(1)
if __name__ == "__main__":
main()