Supports TypeScript type definition lookup and mock generation for Angular projects, helping with component testing and type-safe development workflows.
Enables accurate mocking of Axios HTTP client types including AxiosResponse, AxiosError, and request configurations for comprehensive API testing scenarios.
Supports proper TypeScript typing for Jest testing framework including SpyInstance, mock functions, and test utilities to create accurate test mocks and assertions.
Enables TypeScript type definition access for Node.js projects and their dependencies, supporting server-side development and testing workflows.
Provides TypeScript type intelligence for React components, props interfaces, and React-specific libraries like react-hook-form for enhanced component testing and development.
Provides intelligent access to TypeScript type definitions from any TypeScript project, enabling AI to generate complete type-safe mocks, validate type structures, and understand project interfaces for enhanced test development and code assistance.
TypeScript Definitions MCP Server
Supercharge your test mocking with intelligent TypeScript type definitions
The Problem
When writing unit and integration tests with AI assistance, you've probably experienced this frustration:
Before this tool, I found myself constantly:
- Copy-pasting type definitions from
node_modules
into prompts - Manually looking up package types to write proper mocks
- Getting incomplete test mocks because AI couldn't see the full type structure
- Wasting time on back-and-forth to get the types right
The Solution
This MCP (Model Context Protocol) server gives Claude Code instant access to your project's TypeScript definitions—no more hunting through node_modules
or incomplete mocks.
Works with ANY TypeScript project: React, Vue, Angular, Node.js, whatever you're building. Just point it at your project directory and it automatically discovers all your dependencies.
Now your AI assistant can:
✅ See exact type structures from any package in your project
✅ Generate complete, type-safe mocks for your tests
✅ Understand your project's interfaces automatically
✅ Validate mock data against real type definitions
✅ Work with your specific package versions - no generic examples
Quick Example
Before (manual type hunting):
After (with this MCP server):
Installation & Setup
Step 1: Clone and Build
Step 2: Install Globally
This makes the typescript-definitions-mcp
command available globally.
Step 3: Install in Claude Code
The easiest way to install is using the Claude Code MCP command:
This automatically configures the MCP server for use in Claude Code.
Alternative Configuration Options
If you prefer manual configuration:
Option A: User-Wide (Works in all projects)
Create or edit ~/.claude/mcp_servers.json
:
macOS/Linux:
Windows:
Edit %APPDATA%\claude\mcp_servers.json
:
Option B: Project-Specific
In your TypeScript project root, create .mcp.json
:
Or if using local build:
Step 4: Restart Claude Code
Completely quit and restart Claude Code for the MCP server to load.
Step 5: Test It Out
Open Claude Code in any TypeScript project and try:
"Help me create a mock for a React component that uses these props: ButtonProps from my UI library"
"What's the exact structure of an AxiosResponse? I need to mock it for testing"
"Show me all the interfaces in this project that end with 'Config'"
Real-World Usage Examples
🧪 Test Mocking Made Easy
You: "I need to mock a jest.SpyInstance for testing. What's the exact type structure?"
Claude Code with MCP: Instantly knows jest.SpyInstance<ReturnType, Args>
and helps you create:
🔌 API Response Mocking
You: "Help me mock a complete axios error response for my error handling tests"
Claude Code: Now sees the full AxiosError
structure and creates proper mocks:
⚛️ React Component Testing
You: "I'm testing a component that takes complex props. Help me create comprehensive test data."
Claude Code: Analyzes your component's prop interface and generates complete mock data:
🏗 Complex Library Integration
You: "I'm using react-hook-form and need to mock the useForm return value. What's the complete structure?"
Claude Code: Understands UseFormReturn<T>
and creates accurate mocks:
Why This Matters
Before: Manual Type Hunting
- 🕐 Time wasted digging through
node_modules
- 😤 Frustrating copy-paste workflows
- ❌ Incomplete mocks that break tests
- 🐛 Type mismatches in test data
After: AI-Powered Type Intelligence
- ⚡ Instant type lookup and mock generation
- 🎯 Accurate test data that matches real types
- 🛡 Type-safe mocks prevent runtime errors
- 🚀 Faster test development workflow
Available Tools
The MCP server provides these tools to Claude Code:
lookup_type
- Find specific interfaces, types, or classesfind_interfaces
- Search for interfaces using patterns (e.g.,*Props
,User*
)get_package_types
- Get all exported types from a specific packagevalidate_type_usage
- Check if your code matches expected typescheck_type_compatibility
- Verify if two types are compatible
Advanced Configuration
Team Setup
For teams, commit the project-specific configuration to your repository so everyone gets the same setup:
Now everyone on your team will have TypeScript intelligence when they open the project in Claude Code.
Performance Optimization
For large codebases:
Troubleshooting
MCP server not connecting?
- Verify the JSON syntax in
mcp_servers.json
- Check that
typescript-definitions-mcp
is in your PATH - Restart Claude Code completely
- Test with:
typescript-definitions-mcp --version
Not finding types in your project?
- Make sure you're running Claude Code from your TypeScript project directory
- Check that
tsconfig.json
exists in your project - Verify your project builds with
npx tsc --noEmit
Contributing
Built with ❤️ by Blake Yoder
Found a bug or have a feature request? Open an issue or submit a PR!
License
MIT License - see LICENSE file for details.
Transform your TypeScript testing workflow today. No more manual type hunting, no more incomplete mocks. Just intelligent, type-safe test development with Claude Code.
local-only server
The server can only run on the client's local machine because it depends on local resources.
Tools
Provides AI assistants with instant access to TypeScript type definitions from your project dependencies. Enables generation of complete, type-safe mocks and test data by automatically discovering and exposing interface structures from node_modules.