Blex for Blazor

Reference

MCP server

This site hosts a Model Context Protocol server, so an AI agent can work against Blex's real API, docs and generator instead of guessing at them.

Point an MCP client at https://blex.bitplatform.dev/mcp - or at http://localhost:5280/mcp when you run the documentation site locally. It speaks the streamable HTTP transport, needs no authentication, and every tool on it is read-only.

Claude Code
claude mcp add --transport http bit-blex https://blex.bitplatform.dev/mcp
JSON
.vscode/mcp.json
{
  "servers": {
    "bit-blex": {
      "type": "http",
      "url": "https://blex.bitplatform.dev/mcp"
    }
  }
}

Tools

One rule holds across the reference tools: pass the key of the thing you want and you get that thing; leave it out and you get the index of what there is. Every tool is also a plain HTTP GET under /api/mcp/... - /api/mcp/GetBlexApi is the type list - so you can look at any answer in a browser.

Tool Description
SearchBlex Searches the guide, the docs pages, every public member, the generator's diagnostics and the demo's sources at once; every hit names the follow-up call that returns its full text.
GetBlexSetupGuide The wiring for one hosting model - server, wasm, auto, standalone-wasm, maui-hybrid or maui - as the real files of a working project.
GetBlexGuideSection One section of the reference guide (the README) as Markdown.
GetBlexDocsPage One page of this site as Markdown, rendered by the same component you are reading.
GetBlexApi One public type in full - every member with its type, its real default value and its documentation - read out of the shipped assemblies.
GetBlexDiagnostics One BLEX diagnostic with its cause, a rejected store and the fix.
InspectBlexStore Runs the real generator over store source and returns its diagnostics and the members it generates.
GetBlexSourceFile One source file of this site or of the standalone sample, verbatim.

InspectBlexStore

The one question documentation cannot answer is "what does the generator do with this class?". InspectBlexStore answers it by running the real Bit.Blex.Generators over the source it is given. It returns every BLEX diagnostic a build would report, the compiler errors in the result, and the exact public members the generator adds - so an agent calls Increment() because the generator said so, not because it guessed the naming convention.

Try it from a terminal
curl -G "https://blex.bitplatform.dev/api/mcp/InspectBlexStore" \
  --data-urlencode "source=[BlexStore] public partial class CounterStore { [BlexState] private int _count; [BlexAction] private void OnIncrement() => Count++; }"

Resources and prompts

Resource Description
blex://guide, blex://guide/{heading} The reference guide, whole or by section.
blex://docs/{slug} A documentation page. Every page is also listed as a concrete resource.
blex://api, blex://api/{typeName} The type index, or one type in full.
blex://diagnostics, blex://diagnostics/{code} The diagnostics table, or one diagnostic in full.
blex://source/{path} A source file of the demo or the sample.
Prompt Description
add-blex-to-app Adds Blex to an existing app, in the right order for its hosting model.
implement-blex-feature Builds a state feature with the real API, checking every store with the generator.
migrate-to-blex Moves an app off Fluxor (or hand-rolled state services) one feature at a time.
debug-blex-state Diagnoses a component that does not re-render, lost persisted state, BLEX build errors and the like.

The server also hands the model a short set of working rules at initialize, before any tool is called, and completes every argument that is a key into a closed set - the docs slugs, the guide headings, the type names, the diagnostic ids and the source paths.

An unhandled error has occurred. Reload ๐Ÿ—™