Class: Sxn::MCP::Server
- Inherits:
-
Object
- Object
- Sxn::MCP::Server
- Defined in:
- lib/sxn/mcp/server.rb
Overview
Main MCP server class that orchestrates tools, resources, and prompts
Instance Attribute Summary collapse
-
#config_manager ⇒ Object
readonly
Returns the value of attribute config_manager.
-
#workspace_path ⇒ Object
readonly
Returns the value of attribute workspace_path.
Instance Method Summary collapse
-
#initialize(workspace_path: nil) ⇒ Server
constructor
A new instance of Server.
-
#run_http(port: 3000) ⇒ Object
Run the server with HTTP transport (for web-based integrations).
-
#run_stdio ⇒ Object
Run the server with STDIO transport (for Claude Code integration).
Constructor Details
#initialize(workspace_path: nil) ⇒ Server
Returns a new instance of Server.
9 10 11 12 13 |
# File 'lib/sxn/mcp/server.rb', line 9 def initialize(workspace_path: nil) @workspace_path = workspace_path || ENV["SXN_WORKSPACE"] || discover_workspace @config_manager = initialize_config_manager @server = build_mcp_server end |
Instance Attribute Details
#config_manager ⇒ Object (readonly)
Returns the value of attribute config_manager.
7 8 9 |
# File 'lib/sxn/mcp/server.rb', line 7 def config_manager @config_manager end |
#workspace_path ⇒ Object (readonly)
Returns the value of attribute workspace_path.
7 8 9 |
# File 'lib/sxn/mcp/server.rb', line 7 def workspace_path @workspace_path end |
Instance Method Details
#run_http(port: 3000) ⇒ Object
Run the server with HTTP transport (for web-based integrations)
22 23 24 25 |
# File 'lib/sxn/mcp/server.rb', line 22 def run_http(port: 3000) transport = ::MCP::Server::Transports::StreamableHTTPTransport.new(@server) transport.run(port: port) end |
#run_stdio ⇒ Object
Run the server with STDIO transport (for Claude Code integration)
16 17 18 19 |
# File 'lib/sxn/mcp/server.rb', line 16 def run_stdio transport = ::MCP::Server::Transports::StdioTransport.new(@server) transport.open end |