🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

primereact-mcp

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

primereact-mcp - npm Package Compare versions

Comparing version
1.2.1
to
1.2.2
+11
-0
CHANGELOG.md

@@ -5,2 +5,13 @@ # Changelog

## [1.2.2] - 2026-06-05
### Added
- Vitest-based unit and integration test suite (`test/unit/`, `test/integration/`, `test/fixtures/`)
- `npm test`, `npm run test:watch`, and `npm run test:coverage` scripts
- Fixture `.d.ts` files for deterministic integration tests (no real PrimeReact install required)
### Changed
- Exported core generator functions (`capitalize`, `extractModuleDescription`, `extractInterfaceBody`, `parseProps`, `buildSections`, `buildBasicJsx`, `processComponent`) to enable unit testing
- `processComponent` now accepts `primereactDir` as an explicit parameter instead of relying on top-level scope
## [1.0.0] - 2026-06-04

@@ -7,0 +18,0 @@

+21
-19
#!/usr/bin/env node
/**
* Generates components-data.json from primereact v10 TypeScript definitions.
* Generates components-data.json from primereact TypeScript definitions.
* Requires primereact to be installed (npm install primereact@10).

@@ -45,6 +45,3 @@ * Run once: node generate-data.mjs

const primereactDir = await findPrimereactDir();
console.error(`Using primereact from: ${primereactDir}`);
function capitalize(s) {
export function capitalize(s) {
return s.charAt(0).toUpperCase() + s.slice(1);

@@ -54,3 +51,3 @@ }

// Extract the module-level description from the file's first /** */ block
function extractModuleDescription(content) {
export function extractModuleDescription(content) {
const match = content.match(/^\/\*\*([\s\S]*?)\*\//);

@@ -67,3 +64,3 @@ if (!match) return '';

// Find a named interface block and return its body text
function extractInterfaceBody(content, interfaceName) {
export function extractInterfaceBody(content, interfaceName) {
const idx = content.indexOf(`interface ${interfaceName}`);

@@ -88,6 +85,4 @@ if (idx === -1) return null;

// Parse props from an interface body string
function parseProps(body) {
export function parseProps(body) {
const props = [];
// Split on property lines: identifier followed by ?: or : and ending with ;
// We walk line by line, accumulating JSDoc and then emitting on a prop line
const lines = body.split('\n');

@@ -119,3 +114,3 @@ let jsdocLines = [];

const [, name, rawType] = propMatch;
// Skip index signatures and generic helpers
// Skip children prop
if (name === 'children') { jsdocLines = []; continue; }

@@ -136,3 +131,3 @@

function buildSections(componentName, regularProps, eventProps) {
export function buildSections(componentName, regularProps, eventProps) {
const importStmt = `import { ${capitalize(componentName)} } from 'primereact/${componentName}';`;

@@ -163,3 +158,3 @@ const basicExample = buildBasicJsx(componentName, regularProps.slice(0, 3));

function buildBasicJsx(name, sampleProps) {
export function buildBasicJsx(name, sampleProps) {
const tag = capitalize(name);

@@ -179,3 +174,3 @@ if (sampleProps.length === 0) return `<${tag} />`;

async function processComponent(name) {
export async function processComponent(name, primereactDir) {
const dtsPath = join(primereactDir, name, `${name}.d.ts`);

@@ -196,3 +191,2 @@ try {

if (!body) {
// Some components use a different name (e.g. CalendarProps for calendar)
const match = content.match(/export interface (\w+Props)/);

@@ -223,3 +217,6 @@ if (match) body = extractInterfaceBody(content, match[1]);

async function main() {
console.error('Scanning primereact v10 components...');
const primereactDir = await findPrimereactDir();
console.error(`Using primereact from: ${primereactDir}`);
console.error('Scanning primereact components...');
const entries = await readdir(primereactDir);

@@ -232,3 +229,3 @@ const components = [];

if (['api', 'utils', 'hooks', 'componentbase', 'passthrough', 'csstransition', 'icons'].includes(entry)) continue;
const component = await processComponent(entry);
const component = await processComponent(entry, primereactDir);
if (component) {

@@ -241,4 +238,7 @@ components.push(component);

// Read version from the installed package to support any PrimeReact version
const pkgJson = JSON.parse(await readFile(join(primereactDir, 'package.json'), 'utf-8'));
const data = {
version: '10.9.8',
version: pkgJson.version,
generatedAt: new Date().toISOString().split('T')[0],

@@ -254,2 +254,4 @@ components,

main().catch(e => { console.error(e); process.exit(1); });
if (process.argv[1] === fileURLToPath(import.meta.url)) {
main().catch(e => { console.error(e); process.exit(1); });
}
{
"name": "primereact-mcp",
"version": "1.2.1",
"mcpName": "io.github.wisdomrock/primereact-mcp",
"version": "1.2.2",
"description": "MCP server for PrimeReact v10 component documentation — props, events, examples, and search for AI assistants",
"type": "module",
"bin": {
"primereact-mcp": "index.mjs"
"primereact-mcp": "./index.mjs"
},

@@ -20,3 +19,6 @@ "files": [

"generate": "node generate-data.mjs",
"start": "node index.mjs"
"start": "node index.mjs",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage"
},

@@ -40,3 +42,3 @@ "keywords": [

"type": "git",
"url": "git+https://github.com/jun-shi/primereact-mcp.git"
"url": "https://github.com/jun-shi/primereact-mcp.git"
},

@@ -54,4 +56,6 @@ "homepage": "https://github.com/jun-shi/primereact-mcp#readme",

"devDependencies": {
"primereact": "10.9.8"
"primereact": "10.9.8",
"vitest": "^3.0.0",
"@vitest/coverage-v8": "^3.0.0"
}
}