惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
Microsoft Azure Blog
Microsoft Azure Blog
L
LangChain Blog
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
B
Blog RSS Feed
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
D
Docker
B
Blog
Engineering at Meta
Engineering at Meta
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
G
Google Developers Blog
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42

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.