impl

claude_desktop_config.impl.get_default_claude_desktop_config_path() Path[source]

See https://modelcontextprotocol.io/quickstart/user

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%Claudeclaude_desktop_config.json

claude_desktop_config.impl.enable_mcp_server(config: dict[str, Any], name: str, settings: dict[str, Any]) bool[source]

Enable an MCP server by setting its configuration in the provided dictionary.

This is an idempotent operation - no error if the server already exists with the same settings.

Parameters:
  • config – The configuration dictionary to modify.

  • name – The name of the MCP server.

  • settings – The settings for the MCP server.

Returns:

True if the configuration was changed, False if it was unchanged.

claude_desktop_config.impl.disable_mcp_server(config: dict[str, Any], name: str) bool[source]

Remove an MCP server by deleting its entry from the provided configuration dictionary.

This is an idempotent operation - no error if the server doesn’t exist.

Parameters:
  • config – The configuration dictionary to modify.

  • name – The name of the MCP server to remove.

Returns:

True if the configuration was changed, False if it was unchanged.

class claude_desktop_config.impl.ClaudeDesktopConfig(path: pathlib.Path = PosixPath('/home/docs/.config/Claude/claude_desktop_config.json'))[source]
read() dict[str, Any][source]

Read the configuration from the file.

write(config: dict[str, Any])[source]

Write the configuration to the file.

class claude_desktop_config.impl.Mcp(name: str, settings: dict[str, Any])[source]
class claude_desktop_config.impl.BaseMcpEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
classmethod apply(wanted_mcps: set[BaseMcpEnum] | list[BaseMcpEnum], cdc: ClaudeDesktopConfig) bool[source]

Apply the MCP configuration to the Claude Desktop Config.

This method should be overridden by subclasses to define Mcp Enumerations.

Parameters:
  • wanted_mcps – A set of MCPs that should be enabled.

  • cdc – An instance of ClaudeDesktopConfig to read and write the configuration.

Returns:

True if the configuration was changed, False if it was unchanged.