Skip to main content
Glama
OSS License Auditor

OSS License Auditor

by vinkius-labs
README.md
# ๐Ÿ” OSS License Auditor

> MCP server that audits open-source package licenses against corporate policy โ€” detects viral (GPL, AGPL, SSPL) and unknown licenses before they enter the codebase. Built with [Vurb.ts](https://github.com/vinkius-labs/vurb.ts).

[![TypeScript](https://img.shields.io/badge/TypeScript-5.7+-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![Vurb.ts](https://img.shields.io/badge/Built%20with-Vurb.ts-blueviolet?style=flat-square)](https://github.com/vinkius-labs/vurb.ts)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)

## Why This Exists

A single GPL or AGPL dependency can legally contaminate your entire codebase, forcing you to open-source your proprietary code. Most developers don't check licenses before running `npm install`.

This MCP server gives any LLM client a **deterministic license firewall** โ€” call `license.audit` before adding any dependency. The classification is SPDX-based lookup (no regex, no hallucination), resolved live from the npm registry.

<img width="887" height="633" alt="image" src="https://github.com/user-attachments/assets/3fe9cd75-6996-4a1f-94d3-c3a914e0d654" />


## Architecture

```
Agent reads package.json
        โ†“
Sends dependencies to MCP
        โ†“
MCP fetches license metadata from npm registry (parallel, 8s timeout)
        โ†“
Normalises SPDX โ†’ classifies into 5 categories โ†’ applies corporate policy
        โ†“
Returns audit report: BLOCKED โŒ / WARNING โš ๏ธ / ALLOWED โœ…
        โ†“
Agent presents verdict with Mermaid distribution chart
```

**Deterministic core โ€” live data:** The classification logic is a pure SPDX lookup table (no AI, no drift). The only network call is to the npm registry for license metadata.

## License Categories

| Category | Examples | Verdict |
|---|---|---|
| **Permissive** | MIT, ISC, Apache-2.0, BSD | โœ… Allowed |
| **Public Domain** | Unlicense, CC0-1.0, WTFPL | โœ… Allowed |
| **Weak Copyleft** | LGPL, MPL-2.0, EPL | โš ๏ธ Warning โ€” legal review needed |
| **Strong Copyleft** | GPL-2.0, GPL-3.0 | โŒ Blocked โ€” viral, incompatible with proprietary code |
| **Network Copyleft** | AGPL-3.0, SSPL, EUPL | โŒ Blocked โ€” strongest viral, applies over network use |
| **Unknown** | Unrecognised SPDX | โš ๏ธ Warning โ€” manual review required |

## Tools

| Tool | Verb | Description |
|---|---|---|
| `license.audit` | `query` | Audit all deps from a package.json against corporate policy |
| `license.check` | `query` | Check a single package before `npm install` |
| `license.policy` | `query` | List the full corporate license policy (cached) |
| `license.tree` | `query` | Direct + first-level transitive deps with license annotations |

## Usage Examples

### โŒ Example 1 โ€” Detecting a Viral Dependency

> **User:** "Audit the dependencies of my project before we ship."

The LLM reads `package.json` and calls `license.audit`:

```json
{
  "dependencies": "{\"express\":\"^4.18.0\",\"lodash\":\"^4.17.21\",\"@ffmpeg-installer/ffmpeg\":\"^1.1.0\"}"
}
```

**Result:**
```
total_packages: 3
allowed_count:  2
blocked_count:  1

@ffmpeg-installer/ffmpeg โ€” GPL-2.0-only
  โŒ BLOCKED: strong copyleft โ€” requires derivative works to be
  distributed under the same license. Incompatible with proprietary software.
```

The Presenter renders a Mermaid pie chart and urgently suggests removing or replacing the blocked package.

---

### โœ… Example 2 โ€” Checking Before Installing

> **User:** "Is it safe to add `sequelize` to our project?"

The LLM calls `license.check`:

```json
{ "package": "sequelize" }
```

**Result:**
```
sequelize@6.x โ€” MIT
โœ… ALLOWED: permissive โ€” safe for commercial use.
```

---

### โš ๏ธ Example 3 โ€” Scanning a Mixed Project

> **User:** "Audit all deps including devDependencies."

```json
{
  "dependencies": "{\"react\":\"^18.0.0\",\"axios\":\"^1.6.0\"}",
  "dev_dependencies": "{\"vitest\":\"^1.0.0\",\"webpack\":\"^5.0.0\"}"
}
```

**Result:**
```
total_packages: 4
allowed_count:  4  โœ… No issues โ€” all permissive
```

---

### ๐Ÿ” Example 4 โ€” Tracing a Transitive License

> **User:** "Show me the full license tree including transitive deps."

The LLM calls `license.tree` โ€” resolves each direct dep's own dependencies (one level deep) and annotates all with their license verdict.

## Deploy

### Vinkius Cloud โ€” One Command โšก

The fastest path to production. [`vurb deploy`](https://vurb.vinkius.com/quickstart) publishes your server to [Vinkius Cloud](https://vinkius.com)'s global edge โ€” zero infrastructure, built-in DLP, kill switch, audit logging, and a managed MCP token:

```bash
npm install
vurb deploy
```

No Dockerfile, no CI/CD pipeline, no servers to manage. You get a connection token that works with **any MCP client** โ€” Cursor, Claude Desktop, Claude Code, Windsurf, Cline, VS Code + Copilot.

```bash
# Deploy with a custom name
vurb deploy --name oss-license-auditor
```

> **๐Ÿ’ก Tip:** Install the [Vinkius extension](https://marketplace.visualstudio.com/items?itemName=vinkius.cloud-extension) to manage your deployed server directly from VS Code, Cursor, or Windsurf โ€” live connections, requests, P95 latency, token management, tool toggling, logs, and deployment history.

### Connect Your MCP Client

After deploying, share the managed token with any MCP-compatible client:

#### Claude Desktop / Cursor / Windsurf

```json
{
  "mcpServers": {
    "oss-license-auditor": {
      "url": "https://edge.vinkius.com/your-token/mcp"
    }
  }
}
```

### Self-Hosted Alternatives

The same `ToolRegistry` runs anywhere โ€” no code changes required:

| Platform | Adapter |
|---|---|
| Vercel Edge Functions | `@vurb/vercel` |
| Cloudflare Workers | `@vurb/cloudflare` |
| Any Node.js server | Stdio / HTTP+SSE transport |

Full deployment guides: [Production Server](https://vurb.vinkius.com/cookbook/production-server) ยท [Vercel Adapter](https://vurb.vinkius.com/vercel-adapter) ยท [Cloudflare Adapter](https://vurb.vinkius.com/cloudflare-adapter)

### Running Locally via stdio

If you prefer to run the server locally and connect via **stdio** โ€” the native MCP transport used by Claude Desktop, Cursor, and Windsurf:

```bash
# 1. Install dependencies
npm install

# 2. Build
npm run build

# 3. Test it directly (optional)
node dist/server.js
```

Then add it to your MCP client config (e.g. `claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "oss-license-auditor": {
      "command": "node",
      "args": ["/absolute/path/to/oss-license-auditor/dist/server.js"]
    }
  }
}
```

Or run without cloning via `npx` (after the package is published):

```json
{
  "mcpServers": {
    "oss-license-auditor": {
      "command": "npx",
      "args": ["-y", "@vinkius/oss-license-auditor"]
    }
  }
}
```

> **Note:** The classification logic is fully offline โ€” only the npm registry fetch requires network. The SPDX lookup table and policy engine have no external dependencies.

## Development

```bash
# Install dependencies
npm install

# Development server with HMR
vurb dev

# Type-check
npm run typecheck

# Run tests
npm test
```

### Project Structure

```
src/
โ”œโ”€โ”€ data/              โ† License policy and SPDX classification
โ”‚   โ”œโ”€โ”€ types.ts
โ”‚   โ””โ”€โ”€ license-policy.ts   47 SPDX identifiers + alias normalization + OR/AND expressions
โ”œโ”€โ”€ engine/            โ† npm registry resolution and audit logic
โ”‚   โ”œโ”€โ”€ npm-registry.ts     Batch fetch, 10 concurrent, 8s timeout, graceful fallback
โ”‚   โ””โ”€โ”€ audit-engine.ts     fetch โ†’ classify โ†’ apply policy โ†’ build report
โ”œโ”€โ”€ models/            M โ€” defineModel()
โ”‚   โ””โ”€โ”€ index.ts
โ”œโ”€โ”€ views/             V โ€” definePresenter()
โ”‚   โ””โ”€โ”€ index.ts
โ”œโ”€โ”€ agents/            A โ€” Tool definitions
โ”‚   โ””โ”€โ”€ license/
โ”‚       โ”œโ”€โ”€ audit.tool.ts
โ”‚       โ”œโ”€โ”€ check.tool.ts
โ”‚       โ”œโ”€โ”€ policy.tool.ts
โ”‚       โ””โ”€โ”€ tree.tool.ts
โ”œโ”€โ”€ vurb.ts            Shared Vurb instance
โ””โ”€โ”€ server.ts          Bootstrap
```

## Built with Vurb.ts

| Feature | Usage |
|---|---|
| `defineModel()` | Domain models with guidance labels |
| `definePresenter()` | Dynamic rules based on blocked count, Mermaid charts, suggestActions |
| `f.query()` | All tools are read-only โ€” no state mutation |
| `.concurrency()` | 5 active / 20 queued for audit, 3/10 for tree |
| `.egress()` | 2MB guard on audit, 4MB on tree |
| `.stale()` | Real-time โ€” npm registry data must not be cached |
| `.cached()` | Static policy rules for `license.policy` |
| `f.error()` | Self-healing errors with recovery suggestions |
| `.instructions()` | AI-first guidance: "call BEFORE npm install" |
| `agentLimit` | Results truncated at 50 with pagination guidance |
| Explicit tool imports | V8-safe bootstrap โ€” no filesystem access at runtime |

[Get started with Vurb.ts โ†’](https://github.com/vinkius-labs/vurb.ts) ยท [Documentation โ†’](https://vurb.vinkius.com)

## License

Apache 2.0 โ€” See [LICENSE](LICENSE) for details.

TDQS

A4.1/5.0

Scored across 4 tools

Disambiguation4/5

Each tool maps to a distinct scope: batch audit of a package.json, single-package check, static policy reference, and a one-level transitive dependency tree. The only real overlap is audit vs. license_tree, but the descriptions explicitly steer users (tree = transitive tracing, audit = fast summary), which resolves most confusion.

Naming Consistency5/5

All four tools use a uniform snake_case `license_<noun/verb>` pattern (audit, check, policy, tree) with no style deviations. Minor cosmetic issue: descriptions refer to tools as `license.check`/`license.audit` with dots, which doesn't match the actual underscore names, but the naming convention itself is consistent.

Tool Count5/5

Four tools is well-scoped for a narrow license-auditing domain, and each one covers a genuinely different need (bulk audit, pre-install check, policy lookup, transitive tracing). No filler or redundant tools.

Completeness4/5

The surface covers the core lifecycle: check a candidate package, audit a whole manifest, inspect transitive origins, and reference the policy that drives verdicts. Gaps are minor โ€” the policy is read-only with no way to override/configure it, there's no remediation suggestion tool (e.g. finding an allowed alternative) and it's npm-only, but agents can work around these via the existing tools.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues