Skip to main content
Glama
vola-trebla

tsconfig-inheritance-flattener-mcp

by vola-trebla

🔍 tsconfig-inheritance-flattener-mcp

npm CI License: MIT

Your AI agent reads tsconfig.json. It has no idea what it actually means.

MCP server that resolves the full TypeScript config inheritance chain and returns the effective compiler options that actually apply — including everything inherited from extended base configs, monorepo packages, and node_modules presets.


🤔 The problem

Your agent reads tsconfig.json and sees:

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

It has no idea that @tsconfig/strictest sets strict: true, noUncheckedIndexedAccess: true, exactOptionalPropertyTypes: true. It doesn't know that baseUrl is defined two levels up in your monorepo base config. So it:

  • Suggests code that would fail noUncheckedIndexedAccess

  • Gets confused about what @/ resolves to

  • Doesn't know your target is ES2022, not ES5

  • Gives wrong answers about module resolution

The TypeScript compiler API already resolves all of this. This MCP just exposes it.


Related MCP server: @aiready/ast-mcp-server

🛠️ Tools

get_effective_compiler_options

Resolves the full extends chain and returns the merged compiler options that actually apply to a given tsconfig.json. Shows the inheritance chain, all merged options (with enums as readable strings, not magic numbers), and include/exclude patterns.

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/*"] }

resolve_module_alias

Maps a TypeScript path alias (e.g. @/hooks/useAuth) to its physical file location on disk, using the resolved paths and baseUrl from the tsconfig. Returns all existing candidates with extension probing.

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

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

analyze_project_references

Inspects the references array in a root tsconfig.json and validates that each referenced package has composite: true. Catches broken cross-package dependencies in TypeScript monorepos before they cause silent build failures.

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

  [✓] packages/shared → /project/packages/shared/tsconfig.json
  [✗ NOT FOUND] packages/deprecated → /project/packages/deprecated/tsconfig.json

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

🧪 What it looks like in practice

Agent is helping debug a TypeScript error and asks:

"What compiler options are actually active in this project?"

Without this MCP, the agent guesses based on what it sees in tsconfig.json. With it:

get_effective_compiler_options("/project/apps/web/tsconfig.json")
→ strict: true, noUncheckedIndexedAccess: true, target: "ES2022", module: "NodeNext"

Now the agent knows exactly why arr[0] has type string | undefined and not just string. No more wrong suggestions.


⚡ Setup

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

🚀 Usage

"What compiler options actually apply to /project/apps/web/tsconfig.json? It extends a monorepo base and @tsconfig/strictest."

"Where does @/components/Button resolve to on disk?"

"Are the project references in my root tsconfig valid? Do all referenced packages have composite: true?"

Works great alongside:


License

MIT

Available Tools

6 tools
analyze_project_referencesA

Inspect a tsconfig.json's project references array and validate that each referenced package has composite:true enabled. Detects missing or broken cross-package references in TypeScript monorepos that would cause silent build failures.

ParametersJSON Schema
NameRequiredDescriptionDefault
configPathYesAbsolute path to the tsconfig.json to analyze for project references

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden. It discloses a read-only inspect/validate operation and explicitly states what it detects (missing/broken references causing silent build failures). However, it does not mention return format, potential side effects, or error behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loads the primary action, and adds a second sentence with the value proposition (detecting silent build failures). Every word contributes meaning; no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter tool with no output schema, the description covers the purpose, the validation target, and the problem it solves. It does not describe the output shape, but this is a minor gap for a validation tool; overall it is contextually sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds little beyond the schema—both say the parameter is the absolute path to the tsconfig.json. No extra semantic detail is provided about parameter format or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's specific function: inspecting a tsconfig.json's project references and validating composite:true. It distinguishes itself from sibling tools by focusing on project references and their validation, which is not mentioned in any sibling names.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage in TypeScript monorepo build scenarios (detecting silent build failures), but it does not explicitly state when to use this tool versus the sibling tools or provide exclusions. There is no mention of alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

detect_config_overlapsA

Find source files compiled by more than one tsconfig simultaneously and surface option conflicts (strict, module, target, etc.) between them. Essential for monorepos where tsconfig.app.json and tsconfig.spec.json share the same src/ tree with incompatible settings.

ParametersJSON Schema
NameRequiredDescriptionDefault
configPathsYesTwo or more absolute paths to tsconfig.json files to compare

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It implies a read-only static analysis behavior ('find', 'surface'), but it does not explicitly state that it does not modify files, what happens if the config paths are invalid, or whether it scans the entire project tree. The description gives some insight into the tool's purpose but lacks a clear statement of side effects or limitations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a concise two-sentence structure. The first sentence front-loads the primary function, and the second sentence adds practical usage context. No redundant words or filler. Every sentence contributes meaningful information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity, the description covers the core purpose and a common use case. It does not specify the return value format, but no output schema exists to compensate. It could be improved by stating what the tool returns, but overall it provides a reasonably complete picture for a simple analysis tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already provides a complete description of the single parameter (configPaths: 'Two or more absolute paths to tsconfig.json files to compare'). Since schema description coverage is 100%, the description does not need to add additional parameter details. It does not, so the baseline score of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function with specific verbs: 'find source files compiled by more than one tsconfig' and 'surface option conflicts.' It names concrete examples of conflicts (strict, module, target) and distinguishes itself from sibling tools like get_effective_compiler_options or resolve_module_alias by focusing on overlapping compilation and option conflicts.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives a clear use case: 'Essential for monorepos where tsconfig.app.json and tsconfig.spec.json share the same src/ tree with incompatible settings.' This provides context for when to use the tool, but it does not explicitly mention when not to use it or name alternative sibling tools. Thus it meets the 'clear context, no exclusions' bar for a score of 4.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

explain_emission_structureA

Build a virtual tree of what TypeScript will emit for each source file — compiled JS, declaration (.d.ts), and source map paths — without running the compiler. Useful when an agent needs to predict where output files will land or debug rootDir/outDir misconfigurations.

ParametersJSON Schema
NameRequiredDescriptionDefault
configPathYesAbsolute path to the tsconfig.json to analyze for emission structure

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the disclosure burden. It notably reveals that the tool does not run the compiler, a key behavioral trait, and discloses the output contents (JS, .d.ts, source map paths). It could add details about error handling or side effects but is substantially transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences with no fluff, front-loaded with the action and followed by targeted use-case examples. Every word contributes.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has one parameter and no output schema, but the description adequately conveys purpose, output elements, and use cases. It stops short of specifying the exact return format or how to interpret the tree, but is sufficiently complete for an agent to understand and invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with a clear parameter description for configPath. The tool description adds no additional parameter-specific meaning beyond what the schema already states, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function with a specific verb ('Build a virtual tree') and resource ('TypeScript emission structure'), and distinguishes it from sibling tools by focusing on output file paths and compiler behavior without executing the compiler.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit context for when the tool is useful ('predict where output files will land or debug rootDir/outDir misconfigurations'), but does not mention exclusions or explicitly contrast with alternatives, missing the top-tier 'when-not' guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_effective_compiler_optionsA

Resolve the full tsconfig.json inheritance chain and return the final merged compiler options that actually apply — including options inherited from extended base configs in node_modules or monorepo packages. Eliminates agent hallucinations about strict mode, moduleResolution, paths, and target.

ParametersJSON Schema
NameRequiredDescriptionDefault
configPathYesAbsolute path to the tsconfig.json file to resolve, e.g. /project/tsconfig.json
includeRawNoIf true, also return the raw per-file options before merging. Default false.

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the burden. It discloses the core behavior (resolving inheritance chain and returning merged options, including from node_modules/monorepo), but does not discuss side effects, error handling, or return format. This is adequate but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences that are front-loaded with purpose. The second sentence about eliminating hallucinations is slightly redundant but adds value by specifying which options are trustworthy. Overall concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, and no annotations. The description gives a high-level outcome but doesn't specify the return shape, error conditions, or how includeRaw affects output beyond schema. Sufficient for a straightforward tool but could be more complete given lack of output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema covers 100% of parameters, so description doesn't need to compensate. The description doesn't add parameter-specific details beyond the schema, but the baseline of 3 applies given full schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it resolves the full tsconfig.json inheritance chain and returns the final merged compiler options. It specifies the resource (tsconfig inheritance) and the output (final options), distinguishing it from sibling tools like resolve_module_alias or analyze_project_references.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It implies usage when accurate effective compiler options are needed, highlighting that it eliminates hallucinations about strict mode, moduleResolution, paths, and target. However, it doesn't explicitly contrast with sibling tools or state when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

resolve_module_aliasA

Map a TypeScript path alias (e.g. @/components/Button or @utils/format) to its physical file location on disk, using the paths and baseUrl from the resolved tsconfig. Useful when an agent needs to navigate to the actual file behind an import.

ParametersJSON Schema
NameRequiredDescriptionDefault
aliasYesThe import alias to resolve, e.g. @/hooks/useAuth or ~lib/helpers
configPathYesAbsolute path to the tsconfig.json whose paths config should be used

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It explains that resolution uses 'paths and baseUrl from the resolved tsconfig,' implying a read-only operation. It does not mention failure modes or return format, but the core behavior is transparent enough for a simple mapping tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences front-loaded with the primary action and a concrete use case. Every word earns its place, with no redundant language.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple two-parameter lookup tool, the description is sufficient to understand purpose and usage context. It lacks explicit return/error details, but given the tool's simplicity and no output schema, this is a minor gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema covers 100% of parameters with examples. The description adds minimal extra meaning beyond noting that tsconfig paths/baseUrl are used for resolution; the schema already documents both parameters with illustrative examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the verb 'Map' and clearly identifies the resource (TypeScript path alias) and the output (physical file location). It distinguishes itself from sibling tools focused on compiler options, emission structure, and config overlaps.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a clear use case: 'Useful when an agent needs to navigate to the actual file behind an import.' However, it does not explicitly state when not to use it or compare against alternative sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

simulate_module_resolutionA

Run TypeScript's exact module resolution algorithm for a given import and return the resolved file path plus every candidate path that was tried and rejected. Eliminates guesswork about why an import resolves (or fails to resolve) under Node16/NodeNext/Bundler strategies.

ParametersJSON Schema
NameRequiredDescriptionDefault
configPathYesAbsolute path to the tsconfig.json to use for resolution settings
moduleNameYesThe import specifier to resolve, e.g. ./utils/helpers or @/components/Button
containingFileYesAbsolute path to the source file that contains the import

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and adequately discloses the tool's behavior: it runs the resolution algorithm, returns the resolved path, and lists every candidate path tried and rejected. It could be more explicit about failure return behavior, but the core behavioral traits are clear.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long, front-loaded with the primary action, and the second sentence adds value by explaining the tool's benefit. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given there is no output schema, the description does explain the return value (resolved path plus rejected candidates) and the supported strategies. It lacks exact return structure details, but overall it is sufficiently complete for an agent to understand the tool's role.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

All three parameters are fully described in the schema (100% coverage), so the description adds no additional parameter semantics beyond what is already structured. This matches the baseline expectation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it runs TypeScript's exact module resolution algorithm and returns the resolved file path plus all rejected candidate paths, distinguishing it from simpler alias-resolution tools. The action is specific and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear use context: to eliminate guesswork about why imports resolve or fail under Node16/NodeNext/Bundler strategies. However, it does not explicitly mention when to prefer this over sibling tools like resolve_module_alias.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 6 tool updatesv0.2.0
    • First observedanalyze_project_references
    • First observeddetect_config_overlaps
    • First observedexplain_emission_structure
    • First observedget_effective_compiler_options
    • First observedresolve_module_alias
    • First observedsimulate_module_resolution

TDQS

A4.2/5.0

Scored across 6 tools

Disambiguation5/5

Each tool targets a distinct aspect of TypeScript configuration analysis, from compiler options to module resolution to emission structure. Even the two resolution-related tools are clearly differentiated: one maps path aliases, the other simulates the full resolution algorithm. No ambiguity.

Naming Consistency5/5

All tool names follow a consistent snake_case verb_noun pattern (get_, resolve_, analyze_, explain_, simulate_, detect_). The verbs are all distinct and clearly describe the action, making the set highly predictable.

Tool Count5/5

With 6 tools, the server is well-scoped for its purpose—covering the essential operations for tsconfig inheritance and resolution without bloat. Each tool fills a specific need, and the count is appropriate for a utility server of this kind.

Completeness5/5

The toolset comprehensively covers the main pain points in TypeScript configuration: effective compiler options, alias resolution, project references, emission output, module resolution, and overlapping configs. There are no obvious gaps that would leave an agent stuck.

Maintenance

ActivityInactive
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Exposes TypeScript Language Server Protocol functionality to AI agents, enabling them to query types at specific positions, find definitions and references, get diagnostics, run type tests, and type-check inline code just like in an IDE.
    9
    127 npm
    3
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    AST-aware TypeScript/JavaScript codebase exploration for AI agents, providing high-precision symbol resolution, reference finding, and structural analysis via MCP tools.
    135 npm
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Enables AI coding agents to interact with TypeScript projects through compiler-level code intelligence, providing tools for navigation, type information, diagnostics, refactoring, and semantic search.
    29
    202 npm
    3
    Apache 2.0