# Give your AI assistant your product rules over MCP, with FACET

> Run FACET's MCP server from your project, so your assistant can look up the rule behind a file, check what it answers for one file, and register it in any assistant that starts MCP servers from a command.

Source: https://facet-framework.com/en/guides/give-any-ai-assistant-your-product-rules/  
Last updated: 2026-11-26T23:28:23+01:00

You ask your AI assistant to tidy up the discount code. It suggests, again, to compare the expiry date with local midnight “to match what customers expect”. That is the exact bug the team fixed in August: codes expired a day early for customers west of UTC. You explain it, the assistant agrees, and next session it suggests the same change, because the rule is nowhere it can look.

FACET keeps a short, checkable description of each feature and its rules, called a record, next to your code. By the end of this guide your assistant can ask the repository which rule governs a file and read that rule, through one MCP server that FACET runs from your project (MCP is the standard way AI assistants call outside tools): `facet mcp`. It works with any assistant that can start an MCP server from a command, and it serves the records your team already keeps.

The commands below use a small example shop written in TypeScript; FACET has to be set up as in [One answer instead of three](https://facet-framework.com/en/guides/write-down-what-a-feature-does/), with at least one record and its anchor. In your own project, use a file and a record you already have.

## See what the server can answer

`facet mcp` speaks the Model Context Protocol on standard input and output. An assistant starts it as a child process and calls its tools. Before you connect a client, ask the server the two questions an assistant should ask before it edits a file: which feature does this file implement, and what does the record promise?

Save these four lines as `mcp-check.jsonl` in the project root. They open a session, then call the tools `anchor_resolve` and `read_facet`:

```json
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"terminal","version":"1"}}}
{"jsonrpc":"2.0","method":"notifications/initialized"}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"anchor_resolve","arguments":{"path":"src/checkout/discount.ts"}}}
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"read_facet","arguments":{"id":"checkout/discounts/redeem-code","sections":["contract.scenarios"]}}}
```

Send them to the server and print the answers. The command needs `jq`:

```sh
(cat mcp-check.jsonl; sleep 2) | npx facet mcp | jq -r '.result.content[0].text // empty | fromjson | .features // .text'
```

![Terminal output: the server answers that src/checkout/discount.ts implements checkout/discounts/redeem-code, then prints that record's four scenarios, among them last-day-ends-in-utc: a code whose last day is today is still applied at 23:30 UTC, in any time zone.](https://facet-framework.com/guides/give-any-ai-assistant-your-product-rules/ask-server-light.png)

*The server names the feature a file implements and returns its scenarios.*

The second scenario, `last-day-ends-in-utc`, is the rule the assistant kept proposing to break. The two answers can arrive in either order. `sleep 2` keeps the input open until the server has answered; without it the server stops at the end of the input before replying.

## Register the server in your assistant

Every MCP client needs the same three facts: the server runs over stdio, the command is `npx`, and the arguments are `facet mcp`. Start it in the project root, so `npx` finds the `facet-framework` dependency and the server finds your records.

In Claude Code, run this in the project root:

```sh
claude mcp add facet -- npx facet mcp
```

For a client you configure with JSON, the entry has this shape. Claude Code writes an entry of the same shape to `.mcp.json` when you add `--scope project`:

```json
{
  "mcpServers": {
    "facet": {
      "type": "stdio",
      "command": "npx",
      "args": ["facet", "mcp"]
    }
  }
}
```

Use your client's own documentation for where that file lives. If the client starts servers outside the project directory, `npx` cannot find the dependency there. Give the full path instead: `"command": "/path/to/project/node_modules/.bin/facet"` and `"args": ["mcp", "--root", "/path/to/project"]`.

## Check that the client reaches the server

Ask the client whether the server starts. In Claude Code:

```sh
claude mcp list
```

![Terminal output: claude mcp add registers the stdio server facet with the command npx facet mcp in the local config; claude mcp list then shows facet: npx facet mcp, Connected.](https://facet-framework.com/guides/give-any-ai-assistant-your-product-rules/connect-client-light.png)

*The client starts the server from the project and connects.*

`Connected` means the client started `npx facet mcp` in your project and completed the handshake. The assistant now has 15 FACET tools. The ones it needs for this problem are `anchor_resolve` (which feature does this file implement), `feature_find` (search records by words), `feature_get` (a whole record) and `read_facet` (one section of a large record).

> **What this does not do**
>
> The server answers when the assistant asks. It does not make the assistant ask, and it does not stop an edit that
> breaks a scenario. Whether a client calls `anchor_resolve` before editing depends on the client and on your
> instructions to it. The FACET plugins for Claude Code and Codex add hooks that put the record into the session when a
> file is read; a plain MCP connection has no such hook.

## If the server says something else

- **`facet: server is closing: EOF`, and nothing else:** the input ended before the server answered. Keep `sleep 2` in the command.
- **`jq: error … (while parsing 'unknown feature id …')`:** the record id in `mcp-check.jsonl` does not exist. The message names the path where FACET looked. Copy the `id:` from the record.
- **`[]` for the file:** no `@facet:` anchor in that file names a record. Check the path, relative to the project root, or add the anchor as in [One answer instead of three](https://facet-framework.com/en/guides/write-down-what-a-feature-does/).
- **The client shows the server as failed, or npm asks to install `facet`:** the client started `npx` outside the project. Start the client from the project root, or use the full path and `--root` as in step 2.

For what changes when agents build features against written rules, read [The agent built it. Who checked it?](https://facet-framework.com/en/solutions/ai-built-products/)

### Sources

- [FACET Core](https://github.com/facet-framework/core)
- [Model Context Protocol: transports](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports)
- [Claude Code: connect to MCP servers](https://code.claude.com/docs/en/mcp)
