# Claude Code (MCP)

MCP server on `flompt.dev`. Add to Claude Code. No install. No account. No API key.

***

## Setup

**Option 1 — CLI (recommandé) :**

```bash
claude mcp add --transport http --scope user flompt https://flompt.dev/mcp/
```

**Option 2 — `~/.claude.json` :**

```json
{
  "mcpServers": {
    "flompt": {
      "type": "http",
      "url": "https://flompt.dev/mcp/"
    }
  }
}
```

***

## Available Tools

### `decompose_prompt`

Decomposes a raw prompt string into structured blocks.

**Input:**

* `prompt` (string) — the raw prompt to analyze

**Output:** A formatted list of blocks + the full JSON ready to pass to `compile_prompt`.

**Example:**

```
decompose_prompt("You are a senior Python developer. Review the following code for bugs. Be concise and prioritize critical issues.")
```

Returns blocks like `role`, `objective`, `constraints`, each with content and metadata.

***

### `compile_prompt`

Compiles a list of blocks into a Claude-optimized XML prompt.

**Input:**

* `blocks_json` (string) — JSON array of blocks (output from `decompose_prompt`, or manually crafted)

**Output:** The compiled XML prompt with token estimate.

**Example:**

```json
[
  { "type": "role",        "label": "Role",        "content": "You are a senior Python developer.", "description": "...", "summary": "" },
  { "type": "objective",   "label": "Objective",   "content": "Review the code for bugs.",          "description": "...", "summary": "" },
  { "type": "constraints", "label": "Constraints", "content": "Be concise. Flag critical issues.",   "description": "...", "summary": "" }
]
```

***

### `list_block_types`

Returns all 13 block types with descriptions and the recommended canonical order.

**No input required.**

| Block type         | Description                            |
| ------------------ | -------------------------------------- |
| `role`             | Persona / who the AI is                |
| `audience`         | Who the output is written for          |
| `context`          | Background info                        |
| `objective`        | Main task (what to do)                 |
| `goal`             | End goal and success criteria          |
| `input`            | Data to process                        |
| `document`         | External content (XML grounding)       |
| `constraints`      | Rules and limits                       |
| `examples`         | Few-shot input/output pairs            |
| `chain_of_thought` | Step-by-step reasoning instructions    |
| `output_format`    | Expected response format               |
| `response_style`   | Tone, voice, and style of the response |
| `language`         | Output language                        |

***

## Typical Workflow in Claude Code

```
1. User provides a rough prompt idea
2. Claude calls decompose_prompt → gets structured blocks
3. Claude adjusts the blocks (add constraints, refine objective…)
4. Claude calls compile_prompt → gets the final XML
5. Claude uses the XML directly in its next task
```

***

## Notes

* The MCP server is **stateless** — each call is independent.
* The `decompose_prompt` tool uses the same AI backend as the web app (Claude/OpenAI if an API key is configured on the server, heuristic fallback otherwise).
* The `compile_prompt` tool runs **locally on the server** — no LLM call, instant.
* No authentication required.
* Source: [`backend/app/mcp_server.py`](https://github.com/Nyrok/flompt)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://flompt.gitbook.io/docs/integrations/claude-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
