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

推荐订阅源

V
V2EX
P
Proofpoint News Feed
D
DataBreaches.Net
C
Check Point Blog
L
LangChain Blog
量子位
美团技术团队
Vercel News
Vercel News
人人都是产品经理
人人都是产品经理
N
Netflix TechBlog - Medium
V
Visual Studio Blog
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
The GitHub Blog
The GitHub Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
U
Unit 42
腾讯CDC
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
Blog — PlanetScale
Blog — PlanetScale

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 agent reads tsconfig.json. It has absolutely no i...
Albert Alov · 2026-05-18 · via DEV Community

Your agent sees "extends": "@tsconfig/strictest" and hallucinates the rest. Here's an MCP server that uses the TypeScript compiler API to resolve the full inheritance chain and return what actually applies.

Here's a scene that happens more than you'd think.

You ask your AI agent to help with a TypeScript error. It reads your tsconfig.json, sees this:

{
  "extends": "@tsconfig/strictest",
  "compilerOptions": {
    "paths": { "@/*": ["./src/*"] }
  }
}

Enter fullscreen mode Exit fullscreen mode

And confidently suggests:

// "This should work fine — I don't see strict mode enabled"
const users = getUsers();
const first = users[0].name; // ❌ Object is possibly 'undefined'

Enter fullscreen mode Exit fullscreen mode

It's wrong. @tsconfig/strictest sets noUncheckedIndexedAccess: true. users[0] is User | undefined, not User. The agent doesn't know this because it never looked inside @tsconfig/strictest. It just guessed.

This is tsconfig-inheritance-flattener-mcp. 🔍


🙈 What the agent actually sees

When your agent reads tsconfig.json, it reads exactly what's in the file. Nothing more.

The extends field points to a package or another file — and the agent stops there. It doesn't chase the chain. It doesn't know what that base config sets. It fills in the blanks from training data, and training data is not your project.

In a typical monorepo this chain can be 3 levels deep:

apps/web/tsconfig.json
  → tsconfig.base.json
    → node_modules/@tsconfig/strictest/tsconfig.json

Enter fullscreen mode Exit fullscreen mode

The final target, module, moduleResolution, strict, paths, baseUrl — all of it is scattered across these files. Without resolving the full chain, the agent is flying blind.


🔧 What the TypeScript compiler API actually knows

Here's the thing: TypeScript already solves this problem. Every time tsc runs, it resolves the full chain and produces a single merged set of compiler options. The API is right there:

const raw = ts.readConfigFile(configPath, ts.sys.readFile);
const parsed = ts.parseJsonConfigFileContent(
  raw.config, ts.sys, path.dirname(configPath), {}, configPath
);
// parsed.options = fully merged CompilerOptions ✅

Enter fullscreen mode Exit fullscreen mode

We're not reimplementing anything. We're just exposing what TypeScript already computes — via MCP, so your agent can ask.


🛠️ Three tools

get_effective_compiler_options

Resolves the full extends chain and returns the merged options that actually apply. Enums come back as readable strings, not magic numbers ("ES2022" not 9, "NodeNext" not 199).

Effective TypeScript Configuration
  Config:            /project/apps/web/tsconfig.json
  Inheritance chain: /project/apps/web/tsconfig.json
                      /project/tsconfig.base.json
                      node_modules/@tsconfig/strictest/tsconfig.json

Compiler Options (merged):
  target: "ES2022"
  module: "NodeNext"
  moduleResolution: "NodeNext"
  strict: true
  noUncheckedIndexedAccess: true
  exactOptionalPropertyTypes: true
  baseUrl: "/project"
  paths: { "@/*": ["apps/web/src/*"] }

Enter fullscreen mode Exit fullscreen mode

Now the agent knows why users[0] is User | undefined. No guessing.

resolve_module_alias

Maps @/hooks/useAuth to the physical file on disk. Uses the resolved paths and baseUrl from the full inheritance chain — not just what's in the nearest tsconfig.json.

Alias Resolution: @/hooks/useAuth
  Config:   /project/apps/web/tsconfig.json
  Base URL: /project

Resolved physical paths:
  /project/apps/web/src/hooks/useAuth.ts   ✓ exists

Enter fullscreen mode Exit fullscreen mode

When the agent needs to navigate to the file behind an import, it no longer has to guess the folder structure.

analyze_project_references

Validates the references array in monorepo root configs. Checks that each referenced package has composite: true — without it, TypeScript's incremental build silently breaks.

Project References Analysis
  Config: /project/tsconfig.json
  References found: 2

  [✓] packages/shared → /project/packages/shared/tsconfig.json
  [✗] packages/legacy → /project/packages/legacy/tsconfig.json (NOT FOUND)

Violations:
  ✗ packages/shared is referenced but does not have composite: true
    Fix: add "composite": true to packages/shared/tsconfig.json

Enter fullscreen mode Exit fullscreen mode


⚡ Setup

{
  "mcpServers": {
    "tsconfig-flattener": {
      "command": "npx",
      "args": ["-y", "tsconfig-inheritance-flattener-mcp"]
    }
  }
}

Enter fullscreen mode Exit fullscreen mode

That's it. Works in Claude Desktop, Cursor, or any MCP-compatible client.


🐸 The pattern

Every MCP server in this series follows the same logic: find a place where an AI agent is structurally blind — not because it's dumb, but because it literally cannot see the data — and expose that data via a tool.

tsconfig.json inheritance is a perfect example. The agent isn't hallucinating out of laziness. It's hallucinating because the information it needs is locked inside a chain of files it never opened, or inside a npm package it can't inspect at runtime.

The TypeScript compiler API already resolves all of this. We just asked it nicely. 🔍


📦 Links