Skip to main content
Glama

analyze_makepkg_conf

Parse and analyze makepkg.conf to extract CFLAGS, MAKEFLAGS, compression settings, and build configuration for Arch Linux package compilation.

Instructions

Parse and analyze makepkg.conf. Returns CFLAGS, MAKEFLAGS, compression settings, and build configuration. Only works on Arch Linux.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core implementation of the analyze_makepkg_conf MCP tool. Parses /etc/makepkg.conf as shell variables using regex, extracts and processes key settings (CFLAGS, CXXFLAGS, MAKEFLAGS with job count parsing, BUILDENV and OPTIONS as lists, CARCH, PKGEXT), handles errors for non-Arch or missing file, returns structured dict.
    async def analyze_makepkg_conf() -> Dict[str, Any]: """ Parse and analyze makepkg.conf. Returns: Dict with parsed makepkg configuration """ if not IS_ARCH: return create_error_response( "NotSupported", "This feature is only available on Arch Linux" ) logger.info("Analyzing makepkg.conf") try: makepkg_conf = Path(MAKEPKG_CONF) if not makepkg_conf.exists(): return create_error_response( "NotFound", f"makepkg.conf not found at {MAKEPKG_CONF}" ) config = {} # Parse as shell script variables with open(makepkg_conf, 'r') as f: for line in f: line = line.strip() # Skip comments and empty lines if not line or line.startswith('#'): continue # Match VAR=value or VAR="value" match = re.match(r'^([A-Z_]+)=(.+)$', line) if match: key = match.group(1) value = match.group(2) # Remove quotes value = value.strip('"').strip("'") config[key] = value # Extract important settings cflags = config.get("CFLAGS", "") cxxflags = config.get("CXXFLAGS", "") makeflags = config.get("MAKEFLAGS", "") buildenv = config.get("BUILDENV", "") options = config.get("OPTIONS", "") # Parse MAKEFLAGS for job count jobs = 1 jobs_match = re.search(r'-j\s*(\d+)', makeflags) if jobs_match: jobs = int(jobs_match.group(1)) # Parse BUILDENV buildenv_list = [opt.strip() for opt in buildenv.split()] if buildenv else [] # Parse OPTIONS options_list = [opt.strip() for opt in options.split()] if options else [] # Detect architecture carch = config.get("CARCH", "unknown") # Compression settings pkgext = config.get("PKGEXT", ".pkg.tar.zst") logger.info(f"Parsed makepkg.conf: {jobs} jobs, {carch} arch") return { "config_path": str(makepkg_conf), "cflags": cflags, "cxxflags": cxxflags, "makeflags": makeflags, "jobs": jobs, "buildenv": buildenv_list, "options": options_list, "carch": carch, "pkgext": pkgext, "all_config": config } except Exception as e: logger.error(f"Failed to analyze makepkg.conf: {e}") return create_error_response( "ConfigParseError", f"Failed to analyze makepkg.conf: {str(e)}" )
  • Imports the analyze_makepkg_conf function from config.py and includes it in __all__ for export, effectively registering it as an available MCP tool in the package namespace.
    from .config import ( analyze_pacman_conf, analyze_makepkg_conf, check_ignored_packages, get_parallel_downloads_setting ) from .utils import IS_ARCH, run_command # Import server from the server module from .server import server # Main function will be defined here async def main(): """ Main entry point for the MCP server. Runs the server using STDIO transport (default for Docker MCP Catalog). """ import asyncio import mcp.server.stdio import logging # Set up logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) logger.info("Starting Arch Linux MCP Server (STDIO)") logger.info(f"Running on Arch Linux: {IS_ARCH}") # Run the server using STDIO async with mcp.server.stdio.stdio_server() as (read_stream, write_stream): await server.run( read_stream, write_stream, server.create_initialization_options() ) def main_sync(): """Synchronous wrapper for the main function (STDIO transport).""" import asyncio asyncio.run(main()) def main_http_sync(): """ Main entry point for HTTP server (for Smithery). Runs the server using SSE (Server-Sent Events) HTTP transport. """ from .http_server import main_http main_http() __all__ = [ # Wiki "search_wiki", "get_wiki_page", "get_wiki_page_as_text", # AUR "search_aur", "get_aur_info", "get_pkgbuild", "get_aur_file", "analyze_pkgbuild_safety", "analyze_package_metadata_risk", "install_package_secure", # Pacman "get_official_package_info", "check_updates_dry_run", "remove_package", "remove_packages_batch", "list_orphan_packages", "remove_orphans", "find_package_owner", "list_package_files", "search_package_files", "verify_package_integrity", "list_package_groups", "list_group_packages", "list_explicit_packages", "mark_as_explicit", "mark_as_dependency", "check_database_freshness", # System "get_system_info", "check_disk_space", "get_pacman_cache_stats", "check_failed_services", "get_boot_logs", # News "get_latest_news", "check_critical_news", "get_news_since_last_update", # Logs "get_transaction_history", "find_when_installed", "find_failed_transactions", "get_database_sync_history", # Mirrors "list_active_mirrors", "test_mirror_speed", "suggest_fastest_mirrors", "check_mirrorlist_health", # Config "analyze_pacman_conf", "analyze_makepkg_conf", "check_ignored_packages", "get_parallel_downloads_setting", # Utils "IS_ARCH", "run_command", # Main functions "main", "main_sync", "main_http_sync", ]
  • ToolMetadata definition providing schema-like information: name, category 'config', requires Arch platform, read permission, 'explore' workflow, related to analyze_pacman_conf.
    "analyze_makepkg_conf": ToolMetadata( name="analyze_makepkg_conf", category="config", platform="arch", permission="read", workflow="explore", related_tools=["analyze_pacman_conf"], prerequisite_tools=[] ),

Latest Blog Posts

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/nihalxkumar/arch-mcp'

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