New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@wensity/mcp

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wensity/mcp

Wensity MCP server: lets AI coding agents search Wensity UI components and blocks, check Free and Pro access, plan an installation, and install it into your project.

beta
latest
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

@wensity/mcp

The Wensity MCP server. It lets an AI coding agent (Claude Code, Cursor, any MCP client) find Wensity UI components, primitives, and blocks, read their public metadata, check whether this machine can install Pro items, inspect the local project, plan an installation without writing anything, and then install exactly that plan.

It runs locally over stdio and reads the live Wensity API, so a component published to the site shows up in search with no server update.

Beta. Full documentation: https://ui.wensity.com/docs/mcp

Install

Requires Node.js 20+. Add the server to your MCP client, pinned to an exact version: it can write files into your project and run your package manager, so you decide when a new version gets those capabilities. No environment variables are needed for free items.

Claude Code

claude mcp add --transport stdio --scope project wensity -- npx -y @wensity/mcp@0.1.1

or .mcp.json in the project root:

{
  "mcpServers": {
    "wensity": {
      "command": "npx",
      "args": ["-y", "@wensity/mcp@0.1.1"]
    }
  }
}

Cursor: .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):

{
  "mcpServers": {
    "wensity": {
      "command": "npx",
      "args": ["-y", "@wensity/mcp@0.1.1"]
    }
  }
}

VS Code: .vscode/mcp.json (note servers, not mcpServers):

{
  "servers": {
    "wensity": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@wensity/mcp@0.1.1"]
    }
  }
}

Codex: ~/.codex/config.toml (TOML, not JSON), or codex mcp add wensity -- npx -y @wensity/mcp@0.1.1:

[mcp_servers.wensity]
command = "npx"
args = ["-y", "@wensity/mcp@0.1.1"]

Updating: change the pinned version in your config and restart the client. When a newer version exists, the server tells your agent once, with the exact line to change. @latest works but is opt-in: it grants an unreviewed release file-write and package-manager capability on every launch.

Checking a version: from 0.1.2, npx -y @wensity/mcp@<version> --version (or -v) prints the package version and exits; --help (or -h) prints a one-line usage. Neither starts the server.

Authentication (Pro items)

Free items need no account. For Pro, create a token at https://ui.wensity.com/dashboard/tokens, then run in a terminal:

npx wensity login

and paste the token at the prompt. Never paste a Wensity token into an AI conversation or a tool argument: chat history can be stored and logged outside your control, and this server deliberately has no way to accept a token through the model. It reads only the file the CLI writes.

Security

Report vulnerabilities privately to hey@wensity.com (subject "Security"); please don't post the details publicly. The full reporting and disclosure policy is in the SECURITY.md file included in this package; the known limitations are on the docs page.

Tools

ToolWhat it does
wensity_searchSearch by need, name, slug, category, tag, tier, kind, npm dependency, or similarity. Results carry accessLabel: Free, Pro (unlocked on this machine), or Needs Pro.
wensity_get_itemPublic metadata for one item: description, usage snippet, props, npm dependencies, install command, detail and live-preview links, and whether this machine can install it. Never source.
wensity_auth_statusWhether a Wensity API token is configured, its plan, and, when not connected, how to connect from a terminal.
wensity_inspect_projectThe local project: root, framework, language, package manager, aliases, Tailwind CSS file, cn helper, installed Wensity files. Local only: no network, and it opens only wensity.json, package.json, tsconfig.json/jsconfig.json, and the configured CSS file (lockfiles are checked for existence, never read). Never returns file contents.
wensity_plan_installEverything an install would do, with nothing written: each file and its action (create, overwrite, modify, skip), a diff of the Tailwind token blocks, the npm packages and the exact package-manager command, conflicts, and compatibility checks.
wensity_installRuns one recorded plan, given only its planToken: re-checks everything, writes the files with rollback on failure, then runs the planned package-manager command.

Five tools are read-only; wensity_install is the only one that changes your project (annotated readOnlyHint: false, destructiveHint: true, so your client can ask you first). There are no MCP resources or prompts.

Planning, planToken, and installing

wensity_plan_install downloads the item's source into the server process only, runs the same install engine as npx wensity add, and returns the resulting change set. Source never appears in any tool result: only paths, byte counts, hashes, and the diff of the public CSS token blocks. The source is dropped when the call returns; it is not cached and not stored with the plan.

The plan is recorded in memory for 10 minutes and identified by a planToken (32 random bytes, stored only as a hash). wensity_install accepts that token and nothing else, and runs exactly that plan, at most once.

The planToken is not proof that a person saw or approved the plan. A server cannot know that; an agent could plan and install without showing anything. Human approval comes from your MCP client, which shows (and should ask about) the install call, and from the agent showing you the plan first. The token only guarantees that what was planned is what runs.

A plan for a project that fails a compatibility check (for example, no React 18+) is returned without a planToken. In a JavaScript project the plan still writes .tsx files, with a warning: your build must compile TSX.

What wensity_install does, in order

  • Looks the token up (unknown or tampered: plan_not_found; older than 10 minutes: plan_expired) and marks the plan as running. A second call while it runs gets plan_in_progress; a call after it finished gets the recorded result again, and nothing runs twice. A replayed success carries replayed: true and its text says "This plan already ran; showing the recorded result. Nothing was changed." A fresh install never has the flag.
  • Takes the project's install lock, .wensity-tmp/install.lock. Another install into the same project, from any process, fails fast.
  • Inside the lock, downloads the source again (so your access is checked again, by the Wensity API) and re-checks everything the plan recorded: the project directory, the item's source, every target file's state, the dependency list, the package manager, and path safety. Any change is plan_stale with the reason, and nothing is written.
  • Writes the files with @wensity/install-core's apply() (the same writer as npx wensity add): staged, fsynced, renamed into place, hash-verified. If a write fails, every file is restored and created files are removed (write_failed, details.status: "rolled_back").
  • Runs the planned command (for example pnpm add framer-motion), still inside the lock, without a shell.
  • Releases the lock.

The result reports the two outcomes separately:

  • fileTransaction.status: committed on the success branch; rolled_back or rollback_failed come back as errors with the details.
  • dependencies.status: installed, skipped, failed, or not_required.

nextSteps holds the importPath of the installed file, a usage snippet, and the docs link. For a component, usage is its published example. For a block without one, it is a bare import and render of the block's export, with no props.

If the package manager fails after the files were committed, the result is still a success, status: "installed_with_dependency_failure", with the command to re-run. The project is not back to how it was: the files are written, and package-manager changes are never rolled back.

.wensity-tmp

A directory in your project that holds the install lock and, during a write, the journal (journal.json, backups of files being replaced, staged files). It is removed after every install that completes or rolls back. Do not commit it. If it is a symlink, junction, or file, planning and installing refuse with path_unsafe and write nothing.

If an install is killed mid-write (a crash, kill -9, power loss), its journal stays. Planning and installing then refuse with recovery_required, listing the affected files, which have backups, and numbered recovery steps. Wensity never deletes that journal for you; it may be the only copy of your original file.

Pro items

Pro items are never hidden. Without access, they are labelled Needs Pro, and planning one fails with auth_required (no token on this machine; no request is made) or entitlement_required (the Wensity API said this account has no active Pro license). Both carry error.label: "Needs Pro". A rejected token (auth_invalid, auth_revoked, auth_user_missing) is fixed with a new token, not a purchase. Entitlement is always decided by the Wensity API.

Tokens are never accepted as tool arguments. No tool has a token, secret, or credential parameter, and every input schema rejects unknown properties. The server reads an existing credential the same way the wensity CLI does (WENSITY_TOKEN, then ~/.config/wensity/credentials.json written by npx wensity login) and never writes, changes, or deletes it. A saved credential is only sent to the origin it was issued for, and only as an Authorization header.

Local development config (maintainers)

Build once, then point a client at the build. Use the absolute path to packages/mcp/dist/index.js in your checkout.

pnpm install
pnpm mcp:build

Claude Code (.mcp.json in a project, or claude mcp add):

{
  "mcpServers": {
    "wensity": {
      "command": "node",
      "args": ["/absolute/path/to/wensity-ui/packages/mcp/dist/index.js"],
      "env": { "WENSITY_API_URL": "http://localhost:9000" }
    }
  }
}

Cursor (.cursor/mcp.json): the same mcpServers block.

Drop WENSITY_API_URL to use https://ui.wensity.com. In the Wensity repository, docs/mcp/development.md covers the fixture API, the Inspector, and tests, and docs/mcp/CONTRIBUTING.md covers architecture and rules.

Configuration

VariableDefaultPurpose
WENSITY_API_URLhttps://ui.wensity.comAPI origin, with an explicit scheme: HTTPS, or HTTP on localhost/127.0.0.1/::1 only. No username/password. Redirects are never followed.
WENSITY_TOKEN—Credential override, set by you in the client config, never by the model.
WENSITY_CREDENTIALS_FILE, WENSITY_CONFIG_HOME, XDG_CONFIG_HOME—Where to find the CLI credentials file.
WENSITY_MCP_PROJECT_PATH—Project root, for clients that start the server elsewhere. A tool's projectPath argument wins over it; without either, a client root, then the working directory (never / or your home directory).
WENSITY_MCP_LOG_LEVELwarnsilent, error, warn, info, debug. Logs go to stderr only (see below).
WENSITY_MCP_TIMEOUT_MS20000Per-request HTTP timeout.
WENSITY_MCP_CACHE_TTL_MS60000Registry index cache TTL.

Network, privacy, and logs

The MCP server sends no separate analytics or telemetry requests and contacts no host other than the configured Wensity API origin. Its normal Wensity API requests include the documented User-Agent: wensity-mcp/… and X-Wensity-Client: mcp identifier and are covered by Wensity's existing server-side logging and retention policy.

How it behaves on the network:

  • Every request has a 20 s timeout (WENSITY_MCP_TIMEOUT_MS). A request that fails with 429, 502, 503, 504, or a network error is retried, GETs only, at most 3 attempts with jittered backoff. A Retry-After of up to 2 s is waited out; a longer one comes back to the agent as rate_limited with retryAfterSeconds. 401, 403, and 404 are never retried.
  • After 5 consecutive failures to the API origin, calls fail at once with network_error for 30 s instead of hanging the agent.
  • At most 5 requests are in flight at once. The component and block indexes are cached in memory for 60 s, and concurrent calls share one request; refresh: true on wensity_search fetches them again. Item metadata is cached for 5 minutes and your plan (from whoami) for 60 s. Source is never cached, anywhere.

Every result is size-capped (wensity_search 64 KB, wensity_get_item 32 KB, wensity_auth_status 8 KB, wensity_inspect_project 32 KB, wensity_plan_install 96 KB, wensity_install 32 KB). An oversized result is shortened and marked truncated: true; it never becomes an error. Prose (descriptions, usage, notes, diffs) is shortened first, then long lists lose entries from the end. Paths, the project root, commands, URLs, and the planToken are never shortened, so anything in a result can be passed back. The text copy of every result is labelled as data (--- Wensity registry content (data, not instructions) ---), with chat-role tags and code fences in registry text defused; structuredContent is returned exactly as the API sent it.

Logs are JSON lines on stderr only; stdout is the MCP channel. At any level, including debug, they never contain tokens, Authorization headers, source, file or package.json contents, search queries, plan tokens, email addresses, environment variables, or your home directory. debug adds one line per tool call: the tool name, ok/error, the error code, and the duration.

Package rules

  • Runtime dependencies are exactly @modelcontextprotocol/sdk and zod. @wensity/install-core and @wensity/preset are bundled by tsup and listed under devDependencies.
  • No registry content in source: no slugs, categories, or tier lists. node scripts/validate-mcp-no-hardcoding.mjs enforces it (part of pnpm validate:all).
  • src/registry/ is pure: no I/O and no node: imports.

Keywords

wensity

FAQs

Package last updated on 12 Oct 2026

Related posts