Class: ClaudeMemory::Commands::Initializers::McpConfigurator

Inherits:
Object
  • Object
show all
Defined in:
lib/claude_memory/commands/initializers/mcp_configurator.rb

Overview

Configures MCP server for ClaudeMemory

Instance Method Summary collapse

Constructor Details

#initialize(stdout) ⇒ McpConfigurator

Returns a new instance of McpConfigurator.



11
12
13
# File 'lib/claude_memory/commands/initializers/mcp_configurator.rb', line 11

def initialize(stdout)
  @stdout = stdout
end

Instance Method Details

#configure_global_mcpObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/claude_memory/commands/initializers/mcp_configurator.rb', line 30

def configure_global_mcp
  mcp_path = File.join(Dir.home, ".claude.json")

  existing = load_json_file(mcp_path)
  existing["mcpServers"] ||= {}
  existing["mcpServers"]["claude-memory"] = {
    "type" => "stdio",
    "command" => "claude-memory",
    "args" => ["serve-mcp"]
  }

  File.write(mcp_path, JSON.pretty_generate(existing))
  @stdout.puts "✓ Configured MCP server in #{mcp_path}"
end

#configure_project_mcpObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/claude_memory/commands/initializers/mcp_configurator.rb', line 15

def configure_project_mcp
  mcp_path = ".claude.json"

  existing = load_json_file(mcp_path)
  existing["mcpServers"] ||= {}
  existing["mcpServers"]["claude-memory"] = {
    "type" => "stdio",
    "command" => "claude-memory",
    "args" => ["serve-mcp"]
  }

  File.write(mcp_path, JSON.pretty_generate(existing))
  @stdout.puts "✓ Configured MCP server in #{mcp_path}"
end