fetch-cwe-list-mcp logo

fetch-cwe-list-mcp

Community
alejandrosaenz117

A Node.js module to fetch, extract, and parse the latest or any specific CWE list from MITRE.

Publisheralejandrosaenz117
Repositoryfetch-cwe-list
LanguageJavaScript
Forks
2
Stars
10
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    fetch-cwe-list-mcp exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    10 stars and 2 forks from the linked repository.

fetch-cwe-list

npm

A simple, secure Node.js module that fetches and parses the latest Common Weakness Enumeration (CWE) list from MITRE.

Quick Start

bash
npm install fetch-cwe-list
javascript
const fetchCweList = require('fetch-cwe-list')

// Fetch latest CWE list
const cweList = await fetchCweList()
console.log(`Fetched ${cweList.length} CWE entries`)

// Fetch specific version
const cweListV413 = await fetchCweList('4.13')

That's it. Each entry includes parsed CWE data with enriched external references.

Features

  • Live data — Always current, fetched directly from MITRE
  • Enriched — CAPEC mappings, CVE context, hierarchy relationships, external references
  • Cached — Optional 1-hour TTL cache (configurable)
  • Query helpers — findById, findByName, findByCapec for common lookups
  • Secure — 30s timeout, 100MB size limit, XXE protection, no shared state
  • TypeScript — Full type definitions included

Usage

Fetch and iterate

javascript
const cweList = await fetchCweList()
cweList.forEach(cwe => {
  console.log(`${cwe.ID}: ${cwe.Name}`)
})

Use query helpers

javascript
const { findById, findByName, findByCapec } = require('fetch-cwe-list')
const cweList = await fetchCweList()

const cwe79      = findById(cweList, '79')
const injections = findByName(cweList, 'injection')
const xssCwes    = findByCapec(cweList, '209')  // CAPEC-209: XSS Using MIME Type Mismatch

Access enriched data

javascript
const cweList = await fetchCweList()
const cwe79 = findById(cweList, '79')

// CAPEC attack patterns
console.log(cwe79.CAPEC_IDs)  // ['63', '85', '209', '588', '591', '592']

// Hierarchy (parent weaknesses)
console.log(cwe79.Hierarchy.parents)  // ['74']

// Known CVEs
cwe79.Known_CVEs.forEach(({ id, description }) => {
  console.log(`${id}: ${description}`)
})

Cache control

javascript
const { clearCache } = require('fetch-cwe-list')

const list1 = await fetchCweList()  // Downloads, caches for 1 hour
const list2 = await fetchCweList()  // Instant (cached)

// Bypass cache
const fresh = await fetchCweList('latest', { cache: false })

// Invalidate cache
clearCache()

API Reference

fetchCweList([version], [opts])

Parameters:

  • version (string, optional) — CWE version to fetch (e.g., '4.13'). Defaults to 'latest'.
  • opts (object, optional) — Options:
    • cache (boolean, optional) — Set to false to bypass cache. Default: true

Returns:

  • Promise resolving to array of CWE objects

Throws:

  • Error if download fails, timeout occurs, or version not found

clearCache()

Clears the in-memory cache. The cache instance itself is not exposed to prevent external poisoning via cache.set().

findById(cweList, id)

Find a single CWE by its ID string.

Parameters:

  • cweList — Array returned by fetchCweList()
  • id (string) — The CWE ID, e.g., '79'

Returns:

  • CWE object or undefined

findByName(cweList, pattern)

Find all CWEs whose name contains the given string (case-insensitive).

Parameters:

  • cweList — Array returned by fetchCweList()
  • pattern (string) — Case-insensitive substring

Returns:

  • Array of CWE objects

Note: RegExp is intentionally not supported to prevent ReDoS attacks.

findByCapec(cweList, capecId)

Find all CWEs that map to a given CAPEC ID string.

Parameters:

  • cweList — Array returned by fetchCweList()
  • capecId (string) — The CAPEC ID, e.g., '86'

Returns:

  • Array of CWE objects

Data Structure

Each CWE entry contains MITRE's fields plus enriched data after v0.1.0:

FieldTypeAlways presentDescription
IDstringYesCWE ID (normalized from numeric parser output)
CAPEC_IDsstring[]YesMapped CAPEC attack pattern IDs (empty array if none)
Known_CVEs{ id, description }[]YesCVEs from Observed_Examples (empty array if none)
HierarchyobjectNoParent relationships (absent if no Related_Weaknesses)
References.Full_Detailsobject[]NoEnriched external reference objects

Example entry:

javascript
{
  ID: "79",
  Name: "Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')",
  Status: "Stable",
  Description: "...",
  CAPEC_IDs: ['63', '85', '209', '588', '591', '592'],
  Known_CVEs: [
    { id: 'CVE-2021-1879', description: '...' }
  ],
  Hierarchy: {
    parents: ['74'],
    relationships: [
      { nature: 'ChildOf', cweId: '74', viewId: '1000', ordinal: 'Primary' }
    ]
  },
  References: {
    Reference: [{ External_Reference_ID: "REF-2" }],
    Full_Details: [
      {
        Reference_ID: "REF-2",
        Author: "OWASP",
        Title: "Cross Site Scripting (XSS)",
        URL: "https://www.owasp.org/..."
      }
    ]
  }
}

Note: Single references are automatically normalized to arrays and enriched just like multiple references. IDs are normalized to strings for consistency across all API surfaces.

MCP Server

Experimental: Alpha release. APIs may change.

An MCP server is available for using this library as tools in LLM agents like Claude Code, Codex, etc.:

bash
npx fetch-cwe-list-mcp

See packages/fetch-cwe-list-mcp for full setup and usage.

License

MIT

Author

Alejandro Saenz

Use fetch-cwe-list-mcp MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once fetch-cwe-list-mcp is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add fetch-cwe-list-mcp as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the fetch-cwe-list-mcp MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "fetch-cwe-list-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the fetch-cwe-list-mcp MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the fetch-cwe-list-mcp MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use fetch-cwe-list-mcp to help me with this task?
fetch-cwe-list-mcp
Sure. I read it.
Here is what I found using fetch-cwe-list-mcp.

Frequently asked questions

What is the fetch-cwe-list-mcp MCP server used for?

fetch-cwe-list-mcp is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use fetch-cwe-list-mcp MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use fetch-cwe-list-mcp with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use fetch-cwe-list-mcp MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With fetch-cwe-list-mcp connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect fetch-cwe-list-mcp MCP to TypingMind?

fetch-cwe-list-mcp runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does fetch-cwe-list-mcp MCP provide in TypingMind?

fetch-cwe-list-mcp exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use fetch-cwe-list-mcp MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If fetch-cwe-list-mcp requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇