Class: API::Mcp::Handlers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/api/mcp/handlers/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params, access_token, current_user) ⇒ Base

Returns a new instance of Base.



16
17
18
19
20
# File 'lib/api/mcp/handlers/base.rb', line 16

def initialize(params, access_token, current_user)
  @params = params
  @access_token = access_token
  @current_user = current_user
end

Instance Attribute Details

#access_tokenObject (readonly)

NOTE: Tool execution needs OAuth token w/ mcp scope for authenticated REST API requests. This creates two authentication layers:

1. MCP endpoint authentication
2. REST API endpoint(s) authentication (i.e. when MCP tool performs API calls)

Since OAuth token only has ‘mcp’ scope instead of ‘api’ scope, REST API endpoints exposed as tools must include ::API::Concerns::McpAccess. As a result, MCP tokens can only access specific API endpoints needed for tools rather than being granted full API access.



14
15
16
# File 'lib/api/mcp/handlers/base.rb', line 14

def access_token
  @access_token
end

#current_userObject (readonly)

NOTE: Tool execution needs OAuth token w/ mcp scope for authenticated REST API requests. This creates two authentication layers:

1. MCP endpoint authentication
2. REST API endpoint(s) authentication (i.e. when MCP tool performs API calls)

Since OAuth token only has ‘mcp’ scope instead of ‘api’ scope, REST API endpoints exposed as tools must include ::API::Concerns::McpAccess. As a result, MCP tokens can only access specific API endpoints needed for tools rather than being granted full API access.



14
15
16
# File 'lib/api/mcp/handlers/base.rb', line 14

def current_user
  @current_user
end

#paramsObject (readonly)

NOTE: Tool execution needs OAuth token w/ mcp scope for authenticated REST API requests. This creates two authentication layers:

1. MCP endpoint authentication
2. REST API endpoint(s) authentication (i.e. when MCP tool performs API calls)

Since OAuth token only has ‘mcp’ scope instead of ‘api’ scope, REST API endpoints exposed as tools must include ::API::Concerns::McpAccess. As a result, MCP tokens can only access specific API endpoints needed for tools rather than being granted full API access.



14
15
16
# File 'lib/api/mcp/handlers/base.rb', line 14

def params
  @params
end

Instance Method Details

#invokeObject

Raises:

  • (NoMethodError)


22
23
24
# File 'lib/api/mcp/handlers/base.rb', line 22

def invoke
  raise NoMethodError
end