Class: API::Mcp::Handlers::Base
- Inherits:
-
Object
- Object
- API::Mcp::Handlers::Base
- Defined in:
- lib/api/mcp/handlers/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
NOTE: Tool execution needs OAuth token w/ mcp scope for authenticated REST API requests.
-
#current_user ⇒ Object
readonly
NOTE: Tool execution needs OAuth token w/ mcp scope for authenticated REST API requests.
-
#params ⇒ Object
readonly
NOTE: Tool execution needs OAuth token w/ mcp scope for authenticated REST API requests.
Instance Method Summary collapse
-
#initialize(params, access_token, current_user) ⇒ Base
constructor
A new instance of Base.
- #invoke ⇒ Object
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_token ⇒ Object (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_user ⇒ Object (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 |
#params ⇒ Object (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
#invoke ⇒ Object
22 23 24 |
# File 'lib/api/mcp/handlers/base.rb', line 22 def invoke raise NoMethodError end |