MCP HubMCP Hub
g0t4

mcp-server-macos-defaults

by: g0t4

macOS defaults - Model Context Protocol server

10created 28/11/2024
Visit
macOS
Protocol

📌Overview

Purpose: To provide a mechanism for reading and writing macOS default settings, facilitating system configuration management.

Overview: The MCP server for macOS defaults (mcp-server-macos-defaults) acts as an interface to interact with the macOS defaults system. It allows users to list, find, read, and write settings easily through command-line tools that replicate existing defaults commands.

Key Features:

  • list-domains: This tool lists all available domains in the macOS defaults system, similar to the command defaults domains, allowing users to quickly see which settings can be manipulated.

  • defaults-read: It allows reading specific settings from a designated domain (or all settings if no key is provided), akin to defaults read <domain> <key>, making it easier to retrieve configurations related to a particular application or system behavior.

  • defaults-write: This feature enables users to modify settings by writing values to specified domains and keys, akin to defaults write <domain> <key> <value>, providing straightforward ways to customize system preferences.


mcp-server-macos-defaults MCP server

MCP server for reading/writing macOS defaults (settings).

Components

Tools

  • list-domains:
    Equivalent to running defaults domains.
  • find:
    Equivalent to running defaults find <word>.
  • defaults-read:
    Equivalent to running defaults read <domain> <key>.
    If key is not provided, the entire domain is read.
  • defaults-write:
    Equivalent to running defaults write <domain> <key> <value>.

Quickstart

Install

Claude Desktop

  • On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • On Windows: %APPDATA%/Claude/claude_desktop_config.json

Development/Unpublished Servers Configuration:

"mcpServers": {
  "mcp-server-macos-defaults": {
    "command": "uv",
    "args": [
      "--directory",
      "/path/to/mcp-server-macos-defaults",
      "run",
      "mcp-server-macos-defaults"
    ]
  }
}

Published Servers Configuration:

"mcpServers": {
  "mcp-server-macos-defaults": {
    "command": "uvx",
    "args": [
      "mcp-server-macos-defaults"
    ]
  }
}

Development

Building and Publishing

To prepare the package for distribution:

  1. Sync dependencies and update lockfile:

    uv sync
    
  2. Build package distributions:

    uv build
    

    This will create source and wheel distributions in the dist/ directory.

  3. Publish to PyPI:

    uv publish
    

Note: You'll need to set PyPI credentials via environment variables or command flags:

  • Token: --token or UV_PUBLISH_TOKEN
  • Or username/password: --username/UV_PUBLISH_USERNAME and --password/UV_PUBLISH_PASSWORD

Debugging

Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector available at https://github.com/modelcontextprotocol/inspector.

You can launch the MCP Inspector via npm with this command:

npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-server-macos-defaults run mcp-server-macos-defaults

Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.