MCP Server
Give coding agents deterministic access to NeuralNg component contracts, package exports and compact theme recipes without placing MCP runtime code in the Angular application.
DEVELOPMENT TOOLING
Separate from the browser runtime
@neural-ng/mcp-server is a Node.js development package. An MCP host starts it as a child process and exchanges JSON-RPC messages over standard input/output. Your Angular bundle never imports the server or its protocol dependencies.
MCP host
Starts the process, presents tools and decides when to call them.
NeuralNg server
Resolves a committed catalog and runs deterministic read-only operations.
Angular project
Receives generated code through the agent, never through the MCP process.
Install and connect
Node.js 24 is required by the alpha package. A project-local exact version is recommended because the catalog, tool schemas and installed component version should move together.
Generic client configuration
Place this object in the MCP configuration location expected by your editor or agent host, then restart or reload its MCP connections.
npx.cmd. This is a client process-spawning difference, not a NeuralNg configuration option. One-off evaluation
The process intentionally stays open while connected. Standard output is reserved for protocol messages; fatal startup diagnostics go to standard error.
Component discovery tools
Discovery uses a generated local catalog. Search and recommendation are deterministic text/intent matching; no second model or remote service is invoked.
| Tool | Input | Purpose |
|---|---|---|
| search_components | query: string, limit?: 1..20 | Search selectors, entry points, summaries, README and llms.txt. |
| get_component_contract | component: string | Resolve by catalog ID, class, selector or public entry point. |
| recommend_components | goal: string, limit?: 1..20 | Return deterministic matches for a described UI goal. |
Search
Contract
Recommend
Compact theme tools
Theme tools operate on a small schema-versioned recipe rather than sending the complete resolved Core and Editor token graph through model context. Neutral is the release baseline; Glass, Mist and Futuristic are experimental preview inputs.
| Tool | Input | Purpose |
|---|---|---|
| create_theme_recipe | name, options_json? | Create and validate a compact sparse recipe. |
| validate_theme_recipe | recipe_json | Validate schema, aliases and token ownership. |
| edit_theme_recipe | recipe_json, patch_json | Apply bounded dotted set/unset operations and revalidate. |
| diff_theme_recipes | left_json, right_json | Return changed recipe paths only. |
| get_component_theme_contract | component, detail? | Read supported property names or current defaults. |
| compile_theme_recipe | recipe_json | Return diagnostics, summary, sizes and integration instructions. |
Create
Edit
compile_theme_recipe returns validation, diagnostics, summary, artifact byte sizes and integration instructions. It does not write CSS. Use npx neural-theme build when the user explicitly wants artifacts generated. Resources are addressable context
Resources expose package-wide catalogs and per-component documents. Component URIs are generated for every public catalog entry, so the list grows with the library while URI structure stays predictable.
Contract
Small JSON: selector, entry point, status, models, forms and related components.
llms.txt
Compact strict rules optimized for code generation.
README
Long-form examples, behavior, accessibility and migration guidance.
Token-efficient agent workflow
Start narrow and expand context only when necessary. A contract usually answers import and model questions; loading every README before choosing a component wastes context and increases conflicting guidance.
Results and domain errors
Successful tools return pretty-printed JSON in one text content block. Invalid component references, malformed JSON and rejected theme values return isError: true with a human-readable message.
Read-only security boundary
Every tool declares readOnlyHint: true, destructiveHint: false, idempotentHint: true and openWorldHint: false. These annotations help clients describe risk; the implementation also enforces the boundary by exposing no write or external I/O operation.
No project writes
No path argument and no arbitrary file reader.
No shell execution
Tools cannot install packages or run project commands.
No network
Search and recommendations use committed local data.
Prototype-safe patches
Theme edits accept bounded known paths and reject unsafe keys.
CSS validation
External URLs, declaration injection and malformed aliases are rejected.
Private process
stdio is a single client-owned local process, not an HTTP endpoint.
MCP annotations are descriptive hints, not a sandbox. Pin trusted packages and let the client apply its own process, filesystem and network controls.
Keep package versions aligned
The generated catalog describes the version shipped inside the MCP package. Pin the same NeuralNg prerelease family in the project and restart the MCP process after upgrades so the agent does not reason from an older contract.
Troubleshooting
Process exits immediately
Confirm Node 24, the exact package version and the client working directory.
No tools appear
Reload MCP connections and inspect client logs plus server stderr.
Non-protocol stdout
Do not wrap the command with scripts that print banners to stdout.
Package not found
Install locally and use --no-install, or verify registry access for the one-off command.
Old component contract
Update the MCP package and restart its process; catalogs are generated at package build time.
Theme recipe rejected
Read neural://themes/schema, patch only known paths, then validate again.