Espone API JSON e MCP HTTP per far lavorare gli agenti sul CRM.

Gli agenti autenticati con token Bearer possono leggere today/pipeline e annotare attività, con host MCP allineati a quelli di produzione.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-02 22:43:46 +02:00
co-authored by Cursor
parent 1f946f63ba
commit 936930e691
44 changed files with 1693 additions and 4 deletions
+28
View File
@@ -0,0 +1,28 @@
module Api
class BaseController < ActionController::API
wrap_parameters false
before_action :authenticate_api_token!
attr_reader :current_user, :current_api_token
private
def authenticate_api_token!
token = ApiToken.authenticate(bearer_token)
unless token
render json: { error: "Non autenticato" }, status: :unauthorized
return
end
@current_api_token = token
@current_user = token.user
Current.user = @current_user
token.touch_last_used!
end
def bearer_token
header = request.authorization.to_s.presence || request.headers["Authorization"].to_s
header[/Bearer\s+(.+)/i, 1]
end
end
end