API Surface Analyzer
Map all public interfaces, exported functions, and detect breaking changes between versions of your codebase.
Get the CLI Tool
Run the API surface analyzer locally as an MCP server, or try it online below.
npx @clinetools/api-surface
- Map all exports with full signatures
- Detect breaking changes between versions
- Severity classification (breaking, potentially breaking, non-breaking)
- Semantic version bump suggestions
- Zero config — just run with npx
How to Use It
Three ways to analyze your API surface — pick the one that fits your workflow.
Try Online
Use the interactive demo below to paste code and compare API surfaces — no install needed.
Use via CLI
Run as a local MCP server and connect any MCP-compatible client.
Add to AI Agent
Add the tool to your MCP settings for instant access from your AI assistant.
MCP Client Configuration (Cline)
{
"mcpServers": {
"api-surface": {
"command": "npx",
"args": ["@clinetools/api-surface"]
}
}
}
Claude Code Configuration
# In your project's .mcp.json:
{
"mcpServers": {
"api-surface": {
"command": "npx",
"args": ["@clinetools/api-surface"]
}
}
}
Example Prompt: List All Exports
// Prompt to your AI agent:
"List all exported functions in this library"
// The agent calls:
analyze_api_surface({
path: "src/",
mode: "map"
})
Example Prompt: Compare Versions
// Prompt to your AI agent:
"Compare the public API between v1 and v2"
// The agent calls:
compare_api_surface({
base: "v1/src/",
head: "v2/src/"
})
// Returns breaking changes, additions, and suggested semver bump
Try It Online
Paste TypeScript code below to map exports or compare two versions for breaking changes.
API Surface Comparison
Paste base and new versions to detect breaking changes, or just the base to map exports.
Paste code and click Compare to detect breaking changes.
Or paste only a base version to see the full export map.
Understanding API Surface
Key concepts behind API surface analysis and semantic versioning.
Semantic Versioning
SemVer uses MAJOR.MINOR.PATCH: bump MAJOR for breaking changes, MINOR for additions, PATCH for fixes. This tool suggests the correct bump level based on detected changes.
Breaking Changes
Removing an export or adding a required parameter are breaking changes. Consumers relying on the old API will get errors. Always document these and bump the MAJOR version.
API Surface Area
The total set of public exports in a library: functions, classes, interfaces, types, and constants. A smaller surface area is easier to maintain and less likely to introduce breaking changes.
Export Types
TypeScript exports include function, class, interface, type, const, enum, and re-exports via export { }. Each type has different implications for breaking changes.
Need Automated API Checks?
Our Pro plan includes CI/CD API surface checks that block merges when breaking changes are unintentional.
View Plans