MCP server
Connect an AI coding client to Blockend and let it inspect, preview, and install blocks.
Blockend includes a Model Context Protocol server. It exposes CLI operations as tools over the stdio transport, so a supported AI client can list blocks, inspect a project, preview files, and install blocks without you typing each command.
The tools run the Blockend CLI in your project. They can write files and install packages, so review the proposed changes.
Quick start
Generate a project-local MCP config:
pnpm dlx blockend-cli mcp init --client cursorReplace cursor with claude, codex, vscode, or windsurf. Restart the client, open the project, and ask it to list blocks or inspect the project.
Preview the config without writing files:
pnpm dlx blockend-cli mcp init --client cursor --dry-runSupported clients
| Client | Config file | Format |
|---|---|---|
| Claude Code | .mcp.json | JSON |
| Cursor | .cursor/mcp.json | JSON |
| VS Code | .vscode/settings.json | JSON with mcp.mcpServers |
| Codex CLI | .codex/config.toml | TOML |
| Windsurf | .windsurf/mcp.json | JSON |
The generated server command is:
npx -y blockend-cli mcpExample JSON for Claude, Cursor, or Windsurf:
{
"mcpServers": {
"blockend": {
"command": "npx",
"args": ["-y", "blockend-cli", "mcp"]
}
}
}VS Code uses the same server under mcp.mcpServers:
{
"mcp.mcpServers": {
"blockend": {
"command": "npx",
"args": ["-y", "blockend-cli", "mcp"]
}
}
}Codex uses TOML:
[mcp_servers.blockend]
command = "npx"
args = ["-y", "blockend-cli", "mcp"]Commands
mcp init
pnpm dlx blockend-cli mcp initWithout --client, the CLI asks which client to configure. It merges the Blockend server into an existing JSON config. For Codex, it writes the TOML file directly.
| Option | Default | Description |
|---|---|---|
--client | Prompt | claude, codex, cursor, vscode, or windsurf. |
--dry-run | false | Print the target path and config without writing. |
--force | false | Skip the overwrite confirmation for an existing config. |
--yes | false | Skip prompts and default to Claude Code. |
Both --force and --yes skip the overwrite confirmation. JSON configs are merged, not replaced.
mcp
pnpm dlx blockend-cli mcpStarts the stdio server. Your AI client normally runs this command for you.
Tools
| Tool | What it does |
|---|---|
list_blocks | Lists block names, descriptions, and variants. Takes an optional projectPath. |
list_recipes | Lists published recipes: curated, ordered stacks of blocks. |
detect_project | Returns framework, language, package manager, and project structure. |
add_block | Installs one block into a project. Requires blockName and an absolute projectPath. |
add_blocks | Installs several blocks. Requires blockNames and an absolute projectPath. |
add_recipe | Installs every block in a recipe, in integration order. Requires recipe and projectPath. |
diff_block | Previews new, modified, and unchanged files without writing. |
doctor | Checks blockend.json, framework detection, and project layout. |
update_check | Compares installed blocks with registry versions. |
update_apply | Applies available updates and rewrites imports. |
add_block runs the equivalent of:
blockend add <block> --yes --jsonThat means it installs missing dependencies and overwrites conflicting files without asking. Use diff_block first. projectPath must be an absolute path; in a monorepo, use the workspace package path (see Monorepos). add_blocks runs the same command once per name, in order, and returns one result per block.
list_recipes lists the published recipes. add_recipe runs the equivalent of:
blockend add --recipe <recipe> --yes --jsonIt installs every block in the recipe in integration order. Optional blocks are skipped in this non-interactive mode.
Example prompts:
- "List the blocks available for this project."
- "What recipes are available?"
- "Set up the authenticated-api recipe."
- "Preview the logger block."
- "Add the rate-limiter block with its memory store."
- "Check whether installed blocks have updates."
Use registry keys in tool arguments: rate-limiter, logger, error-handler, and so on. rate-limit and pino-logger are not valid keys.
Monorepos
In a monorepo, each workspace package has its own blockend.json, and a block installs into the package its config belongs to. Point projectPath at the specific package, not the repo root.
detect_projecton the workspace root returns aworkspaceobject with themanager,root, and apackages[]list (each entry has adir).- Pass
projectPathas<root>/<dir>(for example<root>/apps/api) toadd_block,add_blocks,add_recipe,diff_block,doctor,update_check, andupdate_apply. list_blocksalso takes an optionalprojectPathfor this.add_block,add_blocks,add_recipe,diff_block,update_check,update_apply, andlist_blocksaimed at a workspace root return a message listing the packages and the--cwdcommand to run instead of guessing.- Two tools behave differently by design:
detect_projectreturns the workspace discovery itself (as above), anddoctorsearches upward forblockend.jsonand reports it missing at a root, so point it at a package path.
Safety
- Block tools write into your repository. Review the diff before accepting an install.
add_blockandadd_blocksuse--yes, so they can overwrite existing block files.- Dependency installation can change
package.jsonand your lockfile. - MCP does not add authentication or sandboxing. Run the client in a project where file writes are acceptable.
- Keep
blockend.jsonunder version control so configuration changes are visible.
Troubleshooting
If the client cannot start the server, run the generated command directly:
npx -y blockend-cli mcpIf it exits immediately, check Node.js 20 or newer and network access to npm and GitHub. Tools that accept projectPath need an absolute path; in a monorepo, pass the workspace package. list_blocks falls back to the directory where the MCP server started when projectPath is omitted.
Use --dry-run to confirm which file the CLI would write. Use --force only after backing up an existing MCP config.