Skip to main content
Glama

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.

Related MCP server: dag-mcp-server

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 format in 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; run package_api on 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

Available Tools

3 tools
list_type_filesList declaration files in a packageA

List every TypeScript declaration (.d.ts) file shipped in an npm package@version. Use when package_api can't find the entry, when a package splits its types across many files, or to locate the declaration for one submodule/export.

ParametersJSON Schema
NameRequiredDescriptionDefault
packageYesnpm package name.
versionNoVersion or dist-tag. Defaults to 'latest'.

TDQS

A4.2/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 transparency burden. It clearly implies a read-only listing operation, but does not explicitly state the return format, network behavior, or any side effects. For a simple list tool, this is adequate but not rich in behavioral detail.

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-loaded with the core action and then usage conditions. Every word earns its place; no fluff or redundancy.

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 2-parameter tool with no output schema, the description covers purpose and usage scenarios effectively. It does not describe the return value, but for a listing operation that is self-evident; overall complete enough for an agent to invoke 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 description coverage is 100% (both package and version are described). The description adds context by combining package@version in the purpose, but does not add significant meaning beyond the schema. Baseline 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 action: 'List every TypeScript declaration (.d.ts) file shipped in an npm package@version.' This specifies the verb (list), resource (declaration files), and scope (package@version), distinguishing it from sibling tools like package_api and package_types.

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

Usage Guidelines5/5

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

Explicit usage conditions are given: 'Use when package_api can't find the entry, when a package splits its types across many files, or to locate the declaration for one submodule/export.' This provides when-to-use guidance and names an alternative, making sibling differentiation clear.

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

package_apiExported API surface of a packageA

Get the REAL exported API — functions, classes, constants, interfaces, types — of an npm package at a specific version, extracted from its published TypeScript declarations (.d.ts). Reach for this WHENEVER you're about to call into a library and aren't 100% certain a function/option exists with that exact name and signature. It is the antidote to inventing APIs: if it isn't in this list, the package doesn't export it. Grouped by kind, with one-line signatures.

ParametersJSON Schema
NameRequiredDescriptionDefault
entryNoOverride the .d.ts entry path (e.g. 'dist/index.d.ts') if auto-detection misses it.
packageYesnpm package name, e.g. 'zod', 'date-fns', '@tanstack/react-query'.
versionNoExact version or dist-tag (e.g. '3.23.8', 'latest', 'next'). Defaults to 'latest'.

TDQS

A4/5.0
Behavior4/5

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

No annotations are provided, so the description carries full burden. It discloses that the API is extracted from published TypeScript declarations (.d.ts), a key behavioral constraint, and reveals the output structure ('Grouped by kind, with one-line signatures'). Edge cases like missing .d.ts files aren't covered, but for a read-only introspection tool this is reasonably transparent.

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?

The description is three sentences and front-loaded with the core purpose, with each sentence contributing what, when, and why. There is minor redundancy ('antidote to inventing APIs' restates the previous sentence), but overall it's efficient.

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?

With no output schema, the description gives a partial return shape ('Grouped by kind, with one-line signatures') but doesn't elaborate on the exact structure or error behavior. It covers the main use case well but lacks sufficient detail about limitations, given the tool's complexity.

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 100% description coverage for all three parameters (package, version, entry), so the baseline is 3. The description echoes the version concept but adds no additional semantics beyond what the schema documents.

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 a specific verb 'Get' with a precise resource ('REAL exported API' of an npm package at a specific version) and explicitly enumerates what's included (functions, classes, constants, interfaces, types). It distinguishes itself from sibling tools by claiming to be the authoritative source ('antidote to inventing APIs: if it isn't in this list, the package doesn't export it').

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 an explicit when-to-use: 'Reach for this WHENEVER you're about to call into a library and aren't 100% certain a function/option exists with that exact name and signature.' This is clear context, though it does not name sibling tools or exclusions, so it stops short of a 5.

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

package_typesRaw TypeScript declarations of a packageA

Return the raw .d.ts declaration text for an npm package@version — the ground-truth type definitions. Use when you need exact signatures, generic parameters, overloads, or option-object shapes that a summary can't capture (e.g. the precise props of a component or the full options of a function). Defaults to the package's types entry; pass file (from list_type_files) to read a specific declaration file.

ParametersJSON Schema
NameRequiredDescriptionDefault
fileNoSpecific .d.ts path to read (from list_type_files). Defaults to the types entry.
packageYesnpm package name.
versionNoVersion or dist-tag. Defaults to 'latest'.
maxCharsNoTruncate output (default 16000) to protect the context window.

TDQS

A4.7/5.0
Behavior4/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 clearly implies a read-only operation ('Return the raw .d.ts declaration text') and explains the default and override behavior. It lacks an explicit statement about non-destructiveness, but the framing is sufficient. It does not cover edge cases like missing packages, but that's not required for basic transparency.

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?

Three sentences, front-loaded with the core purpose. The first sentence states what it does, the second explains when to use it, and the third provides a practical default and override. No redundant or filler content—every sentence earns its place.

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

Completeness5/5

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

For a simple read tool, the description covers the key aspects: what it returns, when to prefer it, and how to specify a particular file. Combined with the fully-documented schema and absence of an output schema (raw text), the description provides adequate context for selecting and using the tool. It even references the sibling `list_type_files` to complete the usage flow.

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

Parameters4/5

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

The schema already covers 100% of parameters, so the baseline is 3. The description adds value by linking `file` to `list_type_files`, clarifying the `package@version` syntax, and noting the default types entry. This goes beyond mere schema repetition, earning a 4.

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 opens with a clear and specific verb phrase: 'Return the raw .d.ts declaration text for an npm package@version'. It explicitly identifies the resource (TypeScript declaration files) and distinguishes itself from siblings by mentioning 'ground-truth type definitions' and 'a summary can't capture', which sets it apart from package_api.

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

Usage Guidelines5/5

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

Usage guidance is explicit: 'Use when you need exact signatures, generic parameters, overloads, or option-object shapes that a summary can't capture'. It also clarifies when to use the `file` parameter ('from list_type_files') and the default behavior, effectively directing the agent to the right alternative.

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. Dates show when Glama detected each change.

  1. 3 tool updatesv0.1.0
    • First observedlist_type_files
    • First observedpackage_api
    • First observedpackage_types

TDQS

A4.2/5.0
Disambiguation5/5

Each tool has a distinct role: package_api provides a summarized list of exports, list_type_files lists declaration files, and package_types returns raw text. The descriptions clearly differentiate these, so an agent can choose correctly without confusion.

Naming Consistency3/5

Two tools follow a package_ prefix pattern (package_api, package_types) but the third uses a verb_noun style (list_type_files). This mixed convention is readable but not fully consistent.

Tool Count4/5

With 3 tools, the server is minimal but well-scoped. Each tool covers a necessary aspect of inspecting package declarations, and none feel redundant.

Completeness5/5

The toolset covers the full read-only workflow: locate declaration files, get a summarized API, and retrieve raw type text. There are no obvious gaps for its stated purpose.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Anicodeth/pkg-api-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server