pkg-api-mcp
Provides the real exported API surface and type signatures of any npm package, extracted from its published TypeScript declarations, enabling AI coding agents to use functions accurately and avoid inventing nonexistent APIs.
README
pkg-api-mcp
The antidote to your coding agent inventing functions that don't exist.
An MCP server that feeds Claude, Cursor, and any MCP client the real exported API surface and type signatures of any npm package — extracted straight from its published .d.ts declarations. If a function isn't in the output, the package doesn't export it. Full stop.
Why this exists
The most common way an AI coding agent wastes your time: confidently calling library.doThing(...) where doThing never existed, or passing an option the API doesn't accept. The ground truth — the package's own TypeScript declarations — is sitting on a CDN. This server puts it in the agent's context, version-pinned, before it writes the call.
Tools
| Tool | What it does |
|---|---|
package_api |
The exported surface of package@version — functions, classes, consts, interfaces, types — grouped by kind with one-line signatures. Check this before calling into any unfamiliar library. |
package_types |
The raw .d.ts text — exact generics, overloads, and option-object shapes when a summary isn't enough. |
list_type_files |
Every declaration file in the package — for split types or submodule imports. |
No API key. Types are read from jsDelivr, version-pinned.
Quick start
npx pkg-api-mcp
Claude Code
claude mcp add pkg-api -- npx -y pkg-api-mcp
Claude Desktop / Cursor / Windsurf / any MCP client
{
"mcpServers": {
"pkg-api": {
"command": "npx",
"args": ["-y", "pkg-api-mcp"]
}
}
}
Example prompts
- "What does zod@3.23.8 actually export? Use pkg-api before writing the schema."
- "Show me the real signature of
formatin date-fns@latest." - "I need the exact props type for the Query client in @tanstack/react-query — pull the raw types."
Config
| Env var | Default | Purpose |
|---|---|---|
PKG_API_MAX_CHARS |
16000 |
Max characters returned per call, to protect the context window. |
How it works
package[@version]
│
├─ jsDelivr resolve ──► exact version
├─ read package.json "types"/"typings" (or derive from "main")
├─ fetch the .d.ts from the CDN
└─ extract every `export …` ──► grouped, signature-level API index
The extractor is deliberately dependency-free (no TypeScript compiler in your runtime) and handles functions, classes, consts, interfaces, types, enums, namespaces, export default, and export { … } from/export * re-exports.
Develop
npm install
npm run build
node dist/index.js
Caveats
- Packages that ship no types (pure JS, no bundled
.d.ts) won't resolve here — their types usually live in a separate@types/<name>package; runpackage_apion that instead. - The extractor is regex-based, not a full TS parse: it's built for an accurate at-a-glance index. For byte-exact overloads, use
package_types.
License
MIT © Anicodeth
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.