How huangwh826/halo-mcp-server works
Project type and purpose
• This is a Python-based MCP (Model Context Protocol) server for AI assistants (e.g., Claude Desktop) to manage a Halo blog system via natural-language commands. It acts as a microservice or plugin that registers “Tools” (CRUD operations) and “Prompts” (content generation workflows) to the MCP client, translates incoming requests into HTTP calls to Halo’s REST API, and returns results.
File structure
• Top level:
• configuration & metadata files (.env.example, pyproject.toml, setup scripts, version management, publish scripts)
• assets, examples, halo_apis_docs, tests
• src/halo_mcp_server:
• __main__.py → entrypoint when invoked via python -m halo_mcp_server
• server.py → MCP server initialization, tool/prompt registration, request dispatch
• config.py → reads environment variables for HALO_BASE_URL, HALO_TOKEN, logging, timeouts, feature flags
• client/halo_client.py & base.py → adapter to call Halo HTTP APIs (GET/POST/PUT/DELETE), handles authentication, retries, JSON serialization
• models/common.py → domain data models mapping Halo API schemas
• tools/*.py → implementations of 30 MCP Tools (post_tools, category_tools, tag_tools, attachment_tools) that invoke HaloClient methods
• prompts/blog_prompts.py → definitions of 10 Prompt templates for AI-driven content workflows
• utils/logger.py → centralized logging configuration
• tests/ and examples/ folders support development, not part of runtime.
README for additional insights
• Describes core features (CRUD tools vs AI prompts), integration steps, environment configuration, and natural-language workflows.
• Mentions layering: Tools (explicit API operations) vs Prompts (implicit content generation).
• Highlights async architecture (asyncio-based HTTP calls) and use of mcp.types to define Tool/Prompt schemas.
Detail and clarity
• Every runtime component that processes or routes data
• Data flow paths and dependencies explicitly