Class: Sxn::Commands::MCP
- Inherits:
-
Thor
- Object
- Thor
- Sxn::Commands::MCP
- Includes:
- Thor::Actions
- Defined in:
- lib/sxn/commands/mcp.rb
Overview
Manage MCP server for Claude Code integration
Instance Method Summary collapse
-
#initialize(args = ARGV, local_options = {}, config = {}) ⇒ MCP
constructor
A new instance of MCP.
- #install ⇒ Object
- #server ⇒ Object
- #status ⇒ Object
- #uninstall ⇒ Object
Constructor Details
Instance Method Details
#install ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sxn/commands/mcp.rb', line 20 def install sxn_mcp_path = find_sxn_mcp_executable if sxn_mcp_path.nil? @ui.error("Could not find sxn-mcp executable") @ui.recovery_suggestion("Ensure the sxn gem is properly installed") exit(1) end if [:project] install_to_project(sxn_mcp_path) else install_to_claude_code(sxn_mcp_path) end end |
#server ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/sxn/commands/mcp.rb', line 72 def server require "sxn/mcp" mcp_server = Sxn::MCP::Server.new case [:transport] when "stdio" @ui.info("Starting MCP server with STDIO transport...") mcp_server.run_stdio when "http" @ui.info("Starting MCP server on port #{[:port]}...") mcp_server.run_http(port: [:port]) end end |
#status ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/sxn/commands/mcp.rb', line 47 def status @ui.section("MCP Server Status") claude_installed = check_claude_installation project_installed = check_project_installation @ui.newline @ui.key_value("Claude Code (user)", claude_installed ? "Installed" : "Not installed") @ui.key_value("Project (.mcp.json)", project_installed ? "Installed" : "Not installed") sxn_mcp_path = find_sxn_mcp_executable @ui.newline if sxn_mcp_path @ui.key_value("Executable", sxn_mcp_path) else @ui.warning("sxn-mcp executable not found in PATH") end @ui.newline display_install_commands unless claude_installed || project_installed end |
#uninstall ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/sxn/commands/mcp.rb', line 38 def uninstall if [:project] uninstall_from_project else uninstall_from_claude_code end end |