ts-diagnostics-mcp
Automatically detects lerna-managed monorepos and allows querying diagnostics per package.
Automatically detects npm workspaces and allows querying diagnostics per workspace package in monorepos.
Automatically detects pnpm workspaces and allows querying diagnostics per workspace package in monorepos.
Provides real-time TypeScript diagnostics with intelligent caching, allowing instant queries for errors and warnings without running tsc.
Automatically detects yarn workspaces and allows querying diagnostics per workspace package in monorepos.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ts-diagnostics-mcp check for TypeScript errors in the project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TypeScript Diagnostics MCP
Live TypeScript type checking without constant recompilation - A Model Context Protocol (MCP) server that provides real-time TypeScript diagnostics with intelligent caching, perfect for AI agents working in TypeScript codebases.
The Problem
When multiple AI agents work simultaneously in a TypeScript codebase, they often run tsc or type-check commands repeatedly, causing:
Massive performance degradation - Each agent triggers full recompilation
System slowdown - Multiple concurrent TypeScript processes consume CPU/memory
Redundant work - Same files get type-checked repeatedly
Poor agent responsiveness - Agents wait for slow compilation before proceeding
Related MCP server: ts-language-mcp
The Solution
ts-diagnostics-mcp runs TypeScript's compiler in watch mode once, maintaining a live cache of diagnostics that all agents can query instantly:
80-95% faster than running
tscrepeatedlySingle background process serves all agents
Instant queries - milliseconds instead of seconds
Monorepo support - handles multiple packages seamlessly
Smart caching - LRU cache with file-level granularity
Features
Real-time TypeScript diagnostics via MCP
Monorepo support - Auto-detects pnpm, yarn, npm workspaces, Rush, Lerna
Intelligent caching - LRU cache with configurable size limits
Package filtering - Query diagnostics by workspace package
Fast queries -
has_errors()in microsecondsWatch mode - TypeScript Compiler API with incremental builds
Zero configuration - Auto-detects project structure
Flexible - Works with single projects and monorepos
Installation
No installation required! Just configure and run via npx.
Claude Desktop
Edit your Claude Desktop configuration file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Add this configuration:
{
"mcpServers": {
"ts-diagnostics": {
"command": "npx",
"args": [
"-y",
"ts-diagnostics-mcp@latest",
"/absolute/path/to/your/typescript/project"
]
}
}
}Restart Claude Desktop
Claude Code (CLI)
Add to your .mcp.json:
{
"mcpServers": {
"ts-diagnostics": {
"command": "npx",
"args": [
"-y",
"ts-diagnostics-mcp@latest",
"/absolute/path/to/your/typescript/project"
]
}
}
}Alternative: Global Install
If you prefer a global installation:
npm install -g ts-diagnostics-mcpThen configure with:
{
"mcpServers": {
"ts-diagnostics": {
"command": "ts-diagnostics-mcp",
"args": ["/absolute/path/to/your/project"]
}
}
}Quick Start
1. Configure (see Installation above)
2. Start Using in Claude
Hey Claude, check if there are any TypeScript errors in the project.Claude will use the has_errors tool to instantly check without running tsc!
Usage Examples
For AI Agents
# Quick error check (microseconds)
Tool: has_errors
Result: { "hasErrors": true }
# Get all errors across project
Tool: get_all_diagnostics
Result: { errors: 12, warnings: 3, diagnostics: [...] }
# Check specific file
Tool: get_file_diagnostics
Args: { "filePath": "src/server/auth.ts" }
# Get diagnostics for specific package (monorepo)
Tool: get_package_diagnostics
Args: { "packageName": "@degentalk/server" }
# Get summary counts
Tool: get_diagnostic_count
Result: { errors: 12, warnings: 3, suggestions: 0 }
# List available packages
Tool: list_packages
Result: { packages: ["@degentalk/app", "@degentalk/server", ...] }Available MCP Tools
Tool | Description | Speed |
| Boolean check for errors | Instant (μs) |
| Get error/warning counts | Instant (μs) |
| Get all diagnostics | Fast (ms) |
| Get diagnostics for specific file | Fast (ms) |
| Get diagnostics for package | Fast (ms) |
| Check watch process status | Instant |
| View cache performance | Instant |
| List monorepo packages | Instant |
| Clear diagnostic cache | Instant |
Configuration
Auto-Detection (Default)
No configuration needed! The server auto-detects:
Monorepo type (pnpm, yarn, npm, Rush, Lerna)
Workspace packages
TypeScript configs
Custom Configuration
Create .ts-diagnostics.json in your project root:
{
"maxCacheSize": 100,
"debounceMs": 500,
"enableIncrementalMode": true,
"autoDetectWorkspaces": true,
"ignorePatterns": [
"**/*.test.ts",
"**/*.spec.ts",
"**/test/**",
"**/migrations/**"
]
}Default Ignore Patterns (always applied):
**/node_modules/****/dist/****/build/****/.git/****/coverage/****/.next/****/.turbo/****/.cache/****/out/****/*.min.js**/*.bundle.js**/.tsbuildinfo
Add your own patterns to exclude additional files from diagnostics.
Environment Variables
TS_DIAG_MAX_CACHE_SIZE=200 # Cache size in MB
TS_DIAG_DEBOUNCE_MS=300 # Debounce delay
TS_DIAG_INCREMENTAL=true # Enable incremental builds
TS_DIAG_AUTO_DETECT=true # Auto-detect workspacesManual Configuration
For complex setups, specify configs manually:
{
"projectRoot": "/path/to/project",
"tsConfigs": [
{
"configPath": "/path/to/packages/app/tsconfig.json",
"name": "@myapp/app",
"rootDir": "/path/to/packages/app"
},
{
"configPath": "/path/to/packages/server/tsconfig.json",
"name": "@myapp/server",
"rootDir": "/path/to/packages/server"
}
]
}Monorepo Support
Supported Monorepo Tools
✅ pnpm workspaces (via
pnpm-workspace.yaml)✅ Yarn workspaces (via
package.jsonworkspaces)✅ npm workspaces (via
package.jsonworkspaces)✅ Rush (via
rush.json)✅ Lerna (via
lerna.json)
Example: Monorepo Structure
# Project structure
my-monorepo/
├── packages/
│ ├── app/tsconfig.json
│ ├── server/tsconfig.json
│ ├── db/tsconfig.json
│ └── shared/tsconfig.json
├── pnpm-workspace.yaml
└── tsconfig.base.json
# Auto-detected configs:
# - @myapp/app
# - @myapp/server
# - @myapp/db
# - @myapp/sharedAgents can query specific packages:
Tool: get_package_diagnostics
Args: { "packageName": "@myapp/server" }Performance Benchmarks
Scenario: 4 AI agents working on a TypeScript monorepo
Method | Time | CPU Usage | Result |
Running | ~45s total | 100% spike | System lag |
Using ts-diagnostics-mcp | ~2.3s first, <50ms cached | <15% steady | Smooth |
Performance Gains:
95%+ reduction in type-check time (cached queries)
80%+ reduction in CPU usage
Near-instant feedback for agents
Architecture
┌─────────────────────────────────────────────────┐
│ AI Agents (Claude, GPT, etc.) │
│ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ │
│ │Agent1│ │Agent2│ │Agent3│ │Agent4│ │
│ └──┬───┘ └──┬───┘ └──┬───┘ └──┬───┘ │
└─────┼────────┼────────┼────────┼──────────────┘
│ │ │ │
└────────┴────────┴────────┘
│ MCP Protocol
┌────────▼──────────────────┐
│ ts-diagnostics-mcp │
│ ┌─────────────────────┐ │
│ │ Query Router │ │
│ │ (Package Filter) │ │
│ └─────────┬───────────┘ │
│ ┌─────────▼───────────┐ │
│ │ LRU Cache Layer │ │
│ │ (100MB default) │ │
│ └─────────┬───────────┘ │
│ ┌─────────▼───────────┐ │
│ │ TypeScript Watch │ │
│ │ (Compiler API) │ │
│ └─────────┬───────────┘ │
└────────────┼───────────────┘
│
┌────────────▼───────────────┐
│ TypeScript Source Files │
│ (Auto-recompiles) │
└────────────────────────────┘Development
# Install dependencies
pnpm install
# Build
pnpm build
# Development mode (watch)
pnpm dev
# Type check
pnpm typecheckTesting Locally
# Build the MCP server
cd ts-diagnostics-mcp
npm install
npm run build
# Run directly with your project
node dist/index.js /path/to/your/typescript/projectTroubleshooting
MCP Server Not Responding
Check if the watch process is active:
Tool: get_watch_statusHigh Memory Usage
Reduce cache size:
export TS_DIAG_MAX_CACHE_SIZE=50Diagnostics Out of Date
Clear the cache to force refresh:
Tool: clear_cacheContributing
Contributions welcome! This is an open-source project.
Fork the repository
Create a feature branch
Make your changes
Submit a pull request
License
MIT License - see LICENSE file for details
Credits
Built with:
Support
Issues: GitHub Issues
Discussions: GitHub Discussions
Made with ❤️ for AI agents working in TypeScript
Available Tools
9 toolsclear_cacheB
Clear cached diagnostics. Optionally clear cache for a specific file only.
Inputs: filePath.
get_all_diagnosticsA
Get all TypeScript diagnostics from all watched projects. Returns errors, warnings, and suggestions with file locations.
Inputs: no named parameters.
get_cache_statsA
Get cache performance statistics including hit rate, size, and evictions.
Inputs: no named parameters.
get_diagnostic_countA
Get summary counts of errors, warnings, and suggestions. Faster than getting full diagnostics.
Inputs: no named parameters.
get_file_diagnosticsA
Get TypeScript diagnostics for a specific file. Much faster than running tsc on the whole project.
Inputs: filePath (required).
get_package_diagnosticsA
Get TypeScript diagnostics for a specific package in a monorepo. Useful for filtering diagnostics by workspace.
Inputs: packageName (required).
get_watch_statusA
Get status of the TypeScript watch process including watched configs, file count, and last compilation time.
Inputs: no named parameters.
has_errorsA
Quick boolean check if there are any TypeScript errors. Optionally check a specific file. Extremely fast - use this before full diagnostic queries.
Inputs: filePath.
list_packagesA
List all packages in the monorepo that are being watched. Useful for discovering available package names.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool has a clearly distinct purpose: retrieving diagnostics by scope (all, file, package), counting, quick boolean check, cache management, cache stats, watch status, and package listing. No overlap.
All tool names follow a verb_noun pattern in snake_case (e.g., get_all_diagnostics, clear_cache, has_errors, list_packages), which is consistent and predictable.
Nine tools cover the key operations for a TypeScript diagnostics server without being excessive. The scope is well-balanced – enough to be useful but not overwhelming.
The tool surface covers all essential operations: retrieving diagnostics at various levels, cache management, status monitoring, and package discovery. No obvious gaps for the intended purpose.
Maintenance
Related MCP Connectors
Ship production-ready TypeScript code in half the time, at half the cost.
Coding agents in multi-service codebases routinely rebuild existing helpers, trust stale type definitions, and modify API contracts without knowing who consumes them. Carrick solves this by indexing your entire TypeScript ecosystem across service and repository boundaries. By integrating deeply with the TypeScript compiler, Carrick traces every route, type, and cross-service call while recording function behaviour so agents search by intent rather than name. Delivered via MCP for AI agents and LSP for IDEs, Carrick ensures models see existing endpoints and utilities before generating new code. The scanner is source-available and runs from your CLI or CI pipeline.
Build, test and cache insights for Xcode, Gradle and Bazel projects, for coding agents.
Stateless TS/JS compiler facts for agents: references, imports, impact. No repo index or OAuth.
Related MCP Servers
- AlicenseBqualityDmaintenanceExposes 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.9297 npm3MIT
- AlicenseAqualityBmaintenanceEnables AI coding agents to interact with TypeScript projects through compiler-level code intelligence, providing tools for navigation, type information, diagnostics, refactoring, and semantic search.29194 npm4Apache 2.0
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to access real-time VSCode LSP diagnostics, type information, and code navigation without slow tsc/eslint checks, plus symbol renaming and file operations.-
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to retrieve real-time LSP diagnostics, symbol and type information, and code references, and to perform workspace-aware file operations such as symbol renaming. This avoids waiting for slow tsc/eslint checks while improving code navigation and editing accuracy.-