typescript-type-fetcher
v1.0.3
Published
MCP Tool for providing TypeScript type definitions from npm packages
Readme
TypeScript Type Fetcher
A Model Context Protocol (MCP) tool for providing TypeScript type definitions from npm packages.
Description
TypeScript Type Fetcher is a Model Context Protocol (MCP) service that provides TypeScript type definitions from npm packages. It runs as an MCP server that communicates through standard input/output (stdio), making it compatible with any MCP-enabled development environment.
MCP Service Details
This tool implements an MCP server that:
- Communicates via stdio using the MCP protocol
- Provides a tool endpoint for fetching TypeScript types
- Offers a resource endpoint for package information
- Handles errors with meaningful messages and package suggestions
The server exposes:
- Tool:
typescript-types- For fetching type definitions - Resource:
typescript-package://{name}@{version}- For package information
Features
- Fetch TypeScript type definitions from any npm package
- Support for specific package versions
- Fuzzy matching for package names with suggestions
- Direct integration with MCP-compatible environments
Installation
You can install globally:
npm install -g typescript-type-fetcherOr install as a project dependency:
npm install typescript-type-fetcherUsage
Running with npx
You can run the tool directly using npx:
npx typescript-type-fetcherThis will start the MCP server that communicates through stdio. Note that this tool is designed to be used as an MCP service, so it expects MCP protocol messages through stdin and responds through stdout.
MCP Integration
The tool can be used as an MCP server that provides two main functionalities:
1. TypeScript Types Tool
Fetch type definitions for a specific package:
{
"tool": "typescript-types",
"args": {
"packageName": "lodash",
"version": "4.17.21", // optional
"fuzzyMatch": true // optional
}
}2. Package Resource
Access package information using the resource URI format:
typescript-package://{name}@{version}API Response Format
TypeScript Types Tool Response
On success:
{
"content": [
{
"type": "text",
"text": "Type definitions for package@version"
},
{
"type": "text",
"text": "// Type definition content",
"language": "typescript"
}
// ... additional type files
]
}On error:
{
"error": "Error message"
}Package Resource Response
{
"name": "package-name",
"version": "1.0.0",
"fileCount": 5,
"success": true,
"error": null
}Requirements
- Node.js >= 14.16
Development
# Install dependencies
npm install
# Build the project
npm run build
# Start the server
npm start
# Watch mode during development
npm run dev
# Clean build artifacts
npm run cleanLicense
[License type to be specified]
