慣性聚合 高效追讀感興趣之博客、新聞、科技資訊
閱原文 以慣性聚合開啟

推薦訂閱源

aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
阮一峰的网络日志
阮一峰的网络日志
博客园 - 司徒正美
月光博客
月光博客
宝玉的分享
宝玉的分享
Recent Announcements
Recent Announcements
小众软件
小众软件
H
Hackread – Cybersecurity News, Data Breaches, AI and More
美团技术团队
博客园 - 三生石上(FineUI控件)
A
About on SuperTechFans
J
Java Code Geeks
云风的 BLOG
云风的 BLOG
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
IT之家
IT之家
Vercel News
Vercel News
量子位
Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
腾讯CDC
有赞技术团队
有赞技术团队

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Your AI assistant is blind to your data. Here's how to fi...
Paulo Anchet · 2026-05-24 · via DEV Community

AI has become a normal part of how we write software. It reads code, suggests fixes, and explains things faster than most Stack Overflow answers. But there's something it still can't do on its own: look at your actual data.

That turns out to be a bigger problem than it sounds.

The bug assistant that can actually investigate

You get a Sentry alert. You paste the stack trace into Claude. The error, the params, the line numbers. It reads everything and takes a guess at what went wrong.

The problem is it's just that. A guess. It doesn't know what the user record looked like. It doesn't know what state the associated objects were in. It doesn't know if this is a one-off or whether a whole segment of users ends up here consistently.

So you become its hands. Run the queries, paste the results back, run a few more. It's not the worst workflow, but the AI is doing half the job it could be doing.

With an MCP server wired into your Rails app, it can investigate on its own. It describes your models, pulls the relevant records, and comes back with something like: "Users hitting this error all have onboarding_completed_at null but subscription_active true. Looks like they're skipping a step in the flow." No back and forth. No copy-pasting query results.

Your AI-powered junior analyst

Same problem, different context: you shipped a feature three months ago and someone from product wants to know if it's actually being used.

Normally that means writing a query, building a small report, or filing a ticket with whoever owns analytics. None of that is hard, but there's enough friction that the question quietly dies more often than it gets answered.

With your data accessible via MCP, you just ask. "How many users have used the new export feature in the last 30 days? Break it down by plan." It calls the right tools, counts, groups, and answers in seconds. No SQL, no dashboard, no waiting.

It's the difference between an AI that knows your codebase and one that actually understands what's running in production.

Why not just hand it the database URL?

Fair question. The short answer is that raw database access means raw SQL, and raw SQL means anything goes. Joins across tables you didn't intend to expose, queries hitting your primary instead of your replica, no record of what was accessed.

activerecord-mcp gives the AI access through your application layer instead. Queries go through ActiveRecord with hash conditions validated against actual column names. Sensitive columns like password_digest, tokens, and secrets are blocked by regex deny lists before anything hits the database, and stripped from output after just in case. Everything runs against a read-only role by default. OAuth 2.1 tokens scope access so MCP credentials can't bleed into anything else in your stack.

It's the same access control you'd apply to any internal API, applied to your AI tooling.

Getting started

# Gemfile
gem "activerecord-mcp"
gem "doorkeeper"

Enter fullscreen mode Exit fullscreen mode

bundle install
bin/rails generate doorkeeper:install
bin/rails generate doorkeeper:migration
bin/rails db:migrate
bin/rails generate rails_mcp:install

Enter fullscreen mode Exit fullscreen mode

Restrict it to the models you want to expose, mount it, and connect:

claude mcp add --transport http my-app https://your-app.com/mcp \
  --header "Authorization: Bearer $MY_APP_TOKEN"

Enter fullscreen mode Exit fullscreen mode

Full setup at github.com/pauloancheta/activerecord-mcp.