@cedar-policy/mcp-schema-generator-wasm weekly downloads statistics
By cedar-policy · npm · MCP servers
WASM bindings for cedar-policy-mcp-schema-generator, exposing SchemaGenerator to JavaScript/TypeScript.
@cedar-policy/mcp-schema-generator-wasm has 9,391 recorded weekly downloads on npm, ranking #1224 of 2,762 tracked listings.
About @cedar-policy/mcp-schema-generator-wasm
cedar-policy-mcp-schema-generator-wasm
WASM bindings for cedar-policy-mcp-schema-generator, exposing SchemaGenerator to JavaScript and TypeScript via wasm-bindgen.
This enables Node.js and browser environments to generate Cedar authorization schemas from MCP tool descriptions with the exact same behavior as the Rust implementation, including correct handling of:
- JSON
numberasLongorDecimal(configurable) additionalPropertiesas Cedar tagged entities- Namespaced type deduplication for nested objects
Usage
Install the npm package:
npm install @cedar-policy/mcp-schema-generator-wasm
const { generateSchema } = require('@cedar-policy/mcp-schema-generator-wasm');
const stub = `
namespace MyServer {
@mcp_principal
entity User;
@mcp_resource
entity McpServer;
action "call_tool" appliesTo {
principal: [User],
resource: [McpServer]
};
}
`;
const tools = JSON.stringify([
{
name: 'read_file',
description: 'Read a file from disk',
inputSchema: {
type: 'object',
properties: { path: { type: 'string' } },
required: ['path'],
},
},
]);
const result = JSON.parse(generateSchema(stub, tools));
if (result.isOk) {
console.log(result.schema); // Human-readable .cedarschema
console.log(result.schemaJson); // JSON for Cedar WASM isAuthorized()
} else {
console.error(result.error);
}
API
generateSchema(schemaStub, toolsJson, configJson?)
| Parameter | Type | Description |
|---|---|---|
schemaStub | string | Cedar schema stub with @mcp_principal and @mcp_resource annotations |
toolsJson | string | MCP tool descriptions as JSON (the tools array from tools/list) |
configJson | string? | Optional configuration as JSON |
Returns: JSON string with fields:
| Field | Type | Description |
|---|---|---|
schema | string | null | Generated Cedar schema as .cedarschema text |
schemaJson | string | null | Generated schema as JSON (for isAuthorized()) |
error | string | null | Error message if generation failed |
isOk | boolean | Whether generation succeeded |
Configuration
{
"includeOutputs": false,
"objectsAsRecords": false,
"eraseAnnotations": true,
"flattenNamespaces": false,
"numbersAsDecimal": false,
"deduplicateEntityTypes": false
}
| Option | Default | Description |
|---|---|---|
includeOutputs | false | Include tool output schemas in actions |
objectsAsRecords | false | Use records instead of entities for objects without additionalProperties |
eraseAnnotations | true | Remove @mcp_* annotations from output |
flattenNamespaces | false | Flatten all types into a single namespace |
numbersAsDecimal | false | Encode JSON number as Cedar Decimal instead of Long |
deduplicateEntityTypes | false | Consolidate identical entity types across tools into the lowest common ancestor namespace |
generateRequest(schemaStub, toolsJson, inputJson, principalType, principalId, resourceType, resourceId, configJson?)
Generates Cedar authorization request components from an MCP tool call.
| Parameter | Type | Description |
|---|---|---|
schemaStub | string | Cedar schema stub (same as generateSchema) |
toolsJson | string | MCP tool descriptions as JSON |
inputJson | string | MCP tool call input ({"params": {"tool": "...", "args": {...}}}) |
principalType | string | Cedar entity type for the principal (e.g., "User") |
principalId | string | Principal identifier (e.g., "alice") |
resourceType | string | Cedar entity type for the resource (e.g., "McpServer") |
resourceId | string | Resource identifier (e.g., "my-server") |
configJson | string? | Optional configuration as JSON |
Returns: JSON string with fields:
| Field | Type | Description |
|---|---|---|
principal | string | null | Principal EntityUID (e.g., MyServer::User::"alice") |
action | string | null | Action EntityUID (e.g., MyServer::Action::"read_file") |
resource | string | null | Resource EntityUID (e.g., MyServer::McpServer::"my-server") |
entitiesJson | string | null | Entities as a JSON array string |
error | string | null | Error message if generation failed |
isOk | boolean | Whether generation succeeded |
Example:
const { generateRequest } = require('@cedar-policy/mcp-schema-generator-wasm');
const stub = `
namespace MyServer {
@mcp_principal
entity User;
@mcp_resource
entity McpServer;
action "call_tool" appliesTo {
principal: [User],
resource: [McpServer]
};
}
`;
const tools = JSON.stringify([
{
name: 'read_file',
description: 'Read a file from disk',
inputSchema: {
type: 'object',
properties: { path: { type: 'string' } },
required: ['path'],
},
},
]);
const input = JSON.stringify({
params: { tool: 'read_file', args: { path: '/etc/config.yaml' } },
});
const result = JSON.parse(
generateRequest(stub, tools, input, 'User', 'alice', 'McpServer', 'my-server')
);
if (result.isOk) {
console.log(result.principal); // MyServer::User::"alice"
console.log(result.action); // MyServer::Action::"read_file"
console.log(result.resource); // MyServer::McpServer::"my-server"
console.log(result.entitiesJson); // JSON array of entities for isAuthorized()
} else {
console.error(result.error);
}
Building
# Install wasm-pack
cargo install wasm-pack
# Build for Node.js
wasm-pack build --target nodejs --scope cedar-policy
# Build for browsers
wasm-pack build --target web --scope cedar-policy
npm Release
The npm package name is:
@cedar-policy/mcp-schema-generator-wasm
```…
Description from the npm listing.
- cedar
- authorization
- security
- agents
- mcp
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (1)Similar npm MCP servers plugins
All 20 @cedar-policy/mcp-schema-generator-wasm alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@cedar-policy/mcp-schema-generator-wasm. First seen Nov 3, 2026; last successful collection Nov 3, 2026. See the methodology.