Module: Otto::MCP::Core

Included in:
Otto
Defined in:
lib/otto/mcp/core.rb

Overview

Core MCP (Model Context Protocol) methods included in the Otto class. Provides the public API for enabling and querying MCP server support.

Instance Method Summary collapse

Instance Method Details

#enable_mcp!(options = {}) ⇒ Object

Enable MCP (Model Context Protocol) server support

Examples:

otto.enable_mcp!(http: true, endpoint: '/api/mcp')

Parameters:

  • options (Hash) (defaults to: {})

    MCP configuration options

Options Hash (options):

  • :http (Boolean)

    Enable HTTP endpoint (default: true)

  • :stdio (Boolean)

    Enable STDIO communication (default: false)

  • :endpoint (String)

    HTTP endpoint path (default: ‘/_mcp’)



18
19
20
21
22
23
24
# File 'lib/otto/mcp/core.rb', line 18

def enable_mcp!(options = {})
  ensure_not_frozen!
  @mcp_server ||= Otto::MCP::Server.new(self)

  @mcp_server.enable!(options)
  Otto.logger.info '[MCP] Enabled MCP server' if Otto.debug
end

#mcp_enabled?Boolean

Check if MCP is enabled

Returns:

  • (Boolean)


28
29
30
# File 'lib/otto/mcp/core.rb', line 28

def mcp_enabled?
  @mcp_server&.enabled?
end