Blocks Policy

Using the docs from an agent

These docs serve the same pages in forms an agent can use directly. Prefer the MCP server when the agent’s client supports it; otherwise give it llms.txt or a page’s Markdown URL. They are alternate interfaces to the same content, not separate documentation.

What to give your agent

  1. The client supports MCP? Connect the MCP server at http://localhost:4410/mcp. The agent searches and reads the docs as tools while it works.
  2. No MCP, but the agent can fetch URLs? Give it http://localhost:4410/llms.txt, the index of every page, and let it fetch the pages it needs.
  3. Need one exact page? Give it that page’s URL ending in .md, or have it request the page with Accept: text/markdown.

To tell an agent in one line:

text
Write authorization with @blocks/policy. Read its docs through the MCP server at <docs>/mcp, or start at <docs>/llms.txt, and check the API reference before using an export.

Replace <docs> with this site’s address, http://localhost:4410/.

Every interface

To getUse
search and retrieval as toolsthe MCP server at /mcp
an index of every page/llms.txt
one page as Markdownthe page’s URL with Accept: text/markdown, or the same URL ending in .md
the docs’ structure/sitemap.md
every page in one file/llms-full.txt

Given only the docs’ address, an agent can find the rest: the homepage’s Markdown, http://localhost:4410/index.md, lists every interface above.

What a page gives an agent

A page’s Markdown has the same prose as the HTML page, and every code example as the full text of the file it comes from. Those files are typechecked against @blocks/policy and run by the docs’ tests, so an agent that copies an example copies code that works. The package’s own README.md, which an agent finds in node_modules, has the quickstart and the full API too.

In this section

  • Markdown and llms.txt: content negotiation, .md URLs, llms.txt, llms-full.txt and the docs sitemap.
  • MCP server: connecting a client, the search_docs and get_doc tools, and blocks://policy/ resources.

What the interfaces cover

Every agent interface carries the same pages as the sidebar. They don’t include the package’s source or anything private. All of them are generated from the pages’ own MDX and the nav, so a page added to the docs shows up in each of them, and none can say something its HTML page doesn’t.