Logo vun hanabi-cli

hanabi-cli

Communautéit
cashsun

A local cli to start a conversation with LLM instantly, with MCP support.

Editeurcashsun
Repositoryhanabi
SproochTypeScript
Forks
2
Stären
7
Disponibel Tools
0
Transporttypstdio
Kategorien
LizenzMIT
Linken
  • Tools mat KI-Workflows verbannen

    hanabi-cli stellt MCP-Funktioune bereit, déi vu kompatibele KI-Clienten a KI-Agente kënne benotzt ginn.

  • 0 disponibel Tools

    Kuckt Iech déi opruffbar Aktiounen hei drënner un, mat Nimm a Beschreiwungen, wa se vum Server geliwwert ginn.

  • Konfiguratioun fir ze kopéieren

    Benotzt d'Installatiounsbeispiller, fir dëse Server an Ärem bevorzugte MCP-Client ze konfiguréieren.

  • Indicateure fir Open Source

    7 Stären an 2 Forks aus dem verlinkte Repository.

hanabi-cli

⟡ A terminal AI chat interface for any LLM model, with file context, MCP and deployment support.

  • Local multi skilled agent with files, clipboard & MCP support
  • Project folder scoped - different agent per project
  • Host your agent web chat UI (Next.js) from command line in seconds and ready for deployment
  • Create a multi-agent cluster with predefind strategies.
  • Checkout Hanabi Config File for full list of features.

Command line interface

Chat demo

Web Chat UI

Web Chat UI

Table of Contents

Install

bash
$ npm install -g hanabi-cli

CLI

Get Help

$ hanabi --help

Start hanabi chat session

$ hanabi

Reset config file

$ hanabi reset

Ask single question and print result. (Yes Hanabi auto injects today's date and timezone for you as context)

$ hanabi ask "how's the weather tomorrow?"
$ hanabi ask "generate a react todo app" > ./todo-app-instructions.md

Default Model

The default model is the active model to be used by hanabi-cli. This should be set up for you via CLi interface. Please note the default temperature is 0.5. Some models like GPT-5 requires temperature to be set to 1. Temperature config is added in hanabi-cli in version 1.4.6.

You can also modify the model directly. In your <user home folder>/.hanabi.json, add or modify the defaultModel object:

json
{
	"llms": [
		{
      "id": "fdd1abc5-6791-4c29-b754-4f1174692c22",
      "provider": "OpenAI",
      "apiKey": "your-api-key",
      "apiVersion": "2025-01-01-preview"
    },
	],
	"defaultModel": {
		"provider": "openai",
		"model": "gpt-4",
		"temperature": 0.7
	}
}

MCP Servers

In your <user home folder>/.hanabi.json, add mcpServers config.

{
	"llms": [
		// ...
	],
	"defaultModel": {
		// ...
	},
	"mcpServers": {
		"home-ai": {
			"name": "Home AI",
			"transport": "stdio",
			"command": "node",
			"args": ["c:/folder/home-mcp.js"]
		},
		"context7": {
			"name": "context7",
			"transport": "stdio",
			"command": "npx",
			"args": ["-y", "@upstash/context7-mcp@latest"]
		},
		"browser-use": {
			"name": "Browser-use automation",
			"transport": "sse",
			"url": "http://172.17.0.1:3003/sse",
			"headers": {
				"authentication": "Bearer api-token"
			}
		},
		// npx stdio approach is flaky & slow. highly recommend
		// to npm install -g <mcp-server> and use the following.
		// see https://github.com/modelcontextprotocol/servers/issues/64
        // "file-system": {
        // 	"name": "file system",
        // 	"transport": "stdio",
        // 	"command": "path/to/your/node.exe",
        // 	"args": [
		// "path/to/global/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js", "."]
        // },
		"tavily": {
			"name": "Tavily Search",
			"transport": "stdio",
			"command": "npx",
			"env": {
				"TAVILY_API_KEY": "your-api-key"
			},
			"args": ["-y", "tavily-mcp@0.1.4"]
		},
		// npx is slow! use above recommendation
		"file-system": {
			"name": "file system",
			"transport": "stdio",
			"command": "npx",
			"args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
		},
		"my-calendar": {
			"name": "My Calendar",
			"transport": "streamable_http",
			"url": "http://172.17.0.1:3001/mcp",
			"headers": {
				"authentication": "Bearer my-auth-token"
			}
		}
	}
}

Exclude files

To prevent files from being accessed, add globby patterns in the config

All files included in the .gitignore will also be auto excluded.

// <user home folder>/.hanabi.json
{
	"exclude": ["certificates", "screenshots/**/*", "passwords/*", "*.pid"],
	"llms": [
		// ...
	],
	"defaultModel": {
		// ...
	}
}

Local Envs

Hanabi supports local dot env files (.env). You can also add envs field to .hanabi.json. use file:// prefix URL to inject file content as env variable Supports only plain text files e.g. *.json,*.txt, *.html etc. To inject PDF file content into process.env, convert them to text files by using something like pdf2json.

add ALLOWED_ORIGIN env to add cors protection for the API server.

// .hanabi.json
{
	"envs": {
		"FOO": "bar",
		"MY_DOC: "file://./README.md",
		"ALLOWED_ORIGIN": "http://localhost:3042"
	},
	"llms": [
		// ...
	],
	"defaultModel": {
		// ...
	}
}

If you do not want to store provider api key or any other tokens in .hanabi.json, delete the apiKey fields and save them inside working directly .env instead. Key names are as below. see Providers or .env.example for api key env names.

OPENAI_API_KEY=xxx
GOOGLE_GENERATIVE_AI_API_KEY=xxx
DEEPSEEK_API_KEY=xxx
ANTHROPIC_API_KEY=xxx
GROQ_API_KEY=xxx
XAI_API_KEY=xxx

# MCP keys
TAVILY_API_KEY=xxx

Custom System Prompt

Hanabi comes with predefined simple system prompt to show docs on terminal commands and provide date & timezone context. You can provide extra system prompt in hanabi.system.prompt.md at working directory. Use /gen handle or hanabi gen to generate one for you.

Variables are supported via ${VAR_NAME} syntax, they are read from process.env. see Local envs.

example hanabi.system.prompt.md

markdown
# act as a polite chat bot collecting user feedback via conversational loop.

## context

Product name is ${PRODUCT_NAME}

## ask user the follwing questions one by one and prints a well formatted report

- What is your name
- How do you feel about our product? (classify answer as "Bad" | "OK" | "great")
- What is your company

Local config file override

You can copy <user home folder>/.hanabi.json to your working directly (e.g. project level) to override user level config. LLMs are merged by provider name. Use /gen or hanabi gen handle to generate one for you.

Streaming mode

Toggle "streaming":true at <user home folder>/.hanabi.json or the one at working directory.

Answer Schema

It's quite important for workflow agent to output answer in a deterministic schema, e.g when asking agent to generate API call payload. To achieve that, define answerSchema that's Zod schema compliant in the config file.

// .hanabi.json
{
	"answerSchema": {
		"type": "object",
		"required": ["answer"],
		"properties": {
			"reason": {
				"type": "string",
				"description": "detailed reasoning for the final output."
			},
			"answer": {
				"type": "string",
				"description": "the final output without reasoning details. For math related question, this is the final output number."
			}
		}
	},
	"serve": {
 		...
	},
	"llms": [
		// ...
	],
	"defaultModel": {
		// ...
	}
}

Web Chat UI Server

It's recommended to create a local .hanabi.json for independent chat server

In Hanabi cli, use /serve to start the web server with current context (MCPs & system prompt). This will save serve config to your .hanabi.json.

Use hanabi serve to start the web UI server directly - useful for deployments. Use apiOnly to disable chat UI.

See server API details here

// .hanabi.json
{
	"serve": {
 		"mcpKeys": ["home-ai"],
    	"port": 3041,
		/** name of the agent */
		name?: string;
		/** disable chat UI and only expose API endpoints */
		apiOnly?: boolean;
	},
	"llms": [
		// ...
	],
	"defaultModel": {
		// ...
	}
}

Multi Agents System

You can orchestrade multiple (remote) agents in various strategies or patterns

Please note:

  • In the cli chat, use @agents handle to activate.
  • In web UI chat, multi agents mode is always enabled if set in .hanabi.json
    • Only the final worker agent's response will be streamed to the UI.

Currently hanabi supports the following strategy types

routing (i.e. query classification)

see Hanabi Config File for more details on this strategy.

  • Use /gen handle or hanabi gen to generate one for you.
// .hanabi.json
{
	"multiAgents": {
		"strategy": "routing",
		/** default false - question with no classification
		* will be passed through to routing agent */
		"force": false,
		"agents": [
			{
				"name": "calendars",
				"apiUrl": "http://localhost:3051/api",
				"classification": "school calendar events and UK public holiday"
			},
			{
				"name": "math",
				"apiUrl": "http://localhost:3052/api",
				"classification": "math problem"
			},
			{
				"name": "api-doc",
				"apiUrl": "http://localhost:3053/api",
				"classification": "API document"
			}
		]
	},
	"llms": [
		// ...
	],
	"defaultModel": {
		// ...
	}
}

workflow (i.e. run worker agents sequentially)

see Hanabi Config File for more details on this strategy.

  • in this mode, chat history is ignored. Each user message triggers a new, independent workflow.
  • Use /gen handle or hanabi gen to generate one for you.
// .hanabi.json
{
	"multiAgents": {
		"strategy": "workflow",
		"steps": [
			{
				"apiUrl": "http://localhost:3051/api",
				"name": "process user email into trade instruction"
			},
			{
				"apiUrl": "http://localhost:3052/api",
				"name": "trade booking with payload"
			}
		]
	},
	"llms": [
		// ...
	],
	"defaultModel": {
		// ...
	}
}

parallel (i.e. multi-tasking)

see Hanabi Config File for more details on this strategy.

  • send user query to multiple agents for different types of tasks in parallel and output aggregated summary.
  • Use /gen handle or hanabi gen to generate one for you.
// .hanabi.json
{
	"multiAgents": {
		strategy: 'parallel',
		agents: [
			{
				name: 'code quality agent',
				apiUrl: 'http://localhost:3051/api',
				prompt:
					'Review code structure, readability, and adherence to best practices.',
			},
			{
				name: 'code performance agent',
				apiUrl: 'http://localhost:3052/api',
				prompt: 'Identify performance bottlenecks & memory leaks.',
			},
			{
				name: 'code security agent',
				apiUrl: 'http://localhost:3053/api',
				prompt:
					'Identify security vulnerabilities, injection risks, and authentication issues',
			},
		],
	},
	"llms": [
		// ...
	],
	"defaultModel": {
		// ...
	}
}

Docker deployment

See docker-agent-example folder to see how to deployment your agent as a docker image.

TODOs

  • include local files in chat
  • mcp support
  • add config to exclude custom files pattern
  • support for custom system prompt (via local .md file)
  • support working dir level .hanabi.json override, smililar to how .npmrc works
  • streaming mode
  • add web server chat bot mode (ie api and web interface)
  • improve web server mode (API keys, UX improvements, Update UI mode readme)
  • Multi Agent System (WIP)
  • web ui file support

Installatioun

TypingMind
Viraussetzungen:

Node.js 18+

{
  "mcpServers": {
    "cashsun-hanabi": {
      "command": "npx",
      "args": [
        "-y",
        "hanabi-cli"
      ]
    }
  }
}

hanabi-cli MCP mat verschiddene KI-Modeller benotzen

TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Soubal hanabi-cli verbonnen ass, kënnt Dir et mat verschiddene KI-Modeller an TypingMind benotzen, amplaz et fir all Modell separat anzeriichten. Dës MCP-Integratioun leeft lokal iwwer den TypingMind-MCP-Connector op Ärem Apparat.

Ariichtungsuleedung fir de lokale Connector ze benotzen

Benotzt dës Optioun, wann den MCP-Server Zougrëff op lokal Fichieren, Appen oder privat Ressourcen op Ärem Computer brauch.

1

D'MCP-Astellungen opmaachen

Gitt an TypingMind op „Astellungen“, „Erweidert Astellungen“, dann op „Model Context Protocol“ a wielt „Connector ariichten“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Klickt op d'Astellungssymbol.
  3. Gitt op „Erweidert Astellungen“.
  4. Maacht d'Sektioun „Model Context Protocol“ op.
  5. Klickt op „Connector ariichten“ a wielt „Dësen Apparat“.
Ariichtungsbildschierm vum TypingMind-MCP-Connector mat „Dësen Apparat“ ausgewielt
2

De Connector-Befeel ausféieren

Wielt „Dësen Apparat“, kopéiert de Befeel aus TypingMind a féiert en am Terminal aus. Loosst de Prozess lafen, wärend Dir MCP benotzt.

  1. Kopéiert den Ariichtungsbefeel, deen TypingMind uweist.
  2. Maacht Terminal op macOS oder Windows Terminal op Windows op.
  3. Pescht de Befeel an a féiert en aus.
  4. Bestätegt d'Installatioun vum Package, wann den Terminal Iech freet, ob Dir weiderfuere wëllt.
  5. Loosst den Terminal an de Prozess doranner lafen, wärend Dir MCP-Tools benotzt.
3

hanabi-cli als Server derbäisetzen

Wann de Connector-Status „Prett“ ass, klickt op „Serveren änneren“ a pescht d'MCP-Serverkonfiguratioun an.

  1. Waart, bis de Connector-Status „Prett“ weist.
  2. Klickt op „Serveren änneren“.
  3. Pescht d'MCP-Serverkonfiguratioun vu hanabi-cli an.
  4. Späichert d'Serverlëscht.
  5. Aktualiséiert, wann Dir kontrolléiere wëllt, ob de Connector nach ëmmer prett ass.
MCP-Astellunge vun TypingMind mat aktivem Server an dem Knäppchen „Serveren änneren“
{
  "mcpServers": {
    "cashsun-hanabi": {
      "command": "npx",
      "args": [
        "-y",
        "hanabi-cli"
      ]
    }
  }
}
4

D'Verbindung mat verschiddene Modeller benotzen

Späichert d'Serverlëscht, maacht „Plugins“ op an aktivéiert d'MCP-Tools vu hanabi-cli. Wielt dann e belibegen ënnerstëtzte KI-Modell an TypingMind a benotzt d'Tools am Chat oder weist se engem KI-Agent zou.

  1. Maacht d'Säit „Plugins“ an TypingMind op.
  2. Aktivéiert d'MCP-Tools vu hanabi-cli.
  3. Start e Chat a wielt de KI-Modell, deen Dir benotze wëllt.
  4. Benotzt d'MCP-Tools am Chat oder weist se engem KI-Agent zou.
  5. Wiesselt bei Bedarf op en anere KI-Modell, ouni MCP nei ze verbannen.
TypingMind-Chat mat aktivéierte MCP-Tools an engem ausgewielte KI-Modell
Hëlleft Dir mir bei dëser Aufgab mat hanabi-cli?
hanabi-cli
Jo. Ech hunn et gelies.
Dat hunn ech mat hanabi-cli fonnt.

Heefeg gestallte Froen

Fir wat gëtt de MCP-Server hanabi-cli benotzt?

hanabi-cli ass e MCP-Server, deen et kompatibele KI-Clienten erlaabt, sech mat externen Tools a Kontext ze verbannen. An TypingMind kënnt Dir dëse MCP-Server eemol derbäisetzen a seng Tools an Ärem KI-Aarbechtsberäich zur Verfügung stellen.

Kann ech hanabi-cli MCP mat méi KI-Modeller an TypingMind benotzen?

Jo. TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Sou kënnt Dir hanabi-cli mat verschiddene KI-Modeller wéi Claude, ChatGPT, Gemini oder anere Modeller benotzen, déi Dir an TypingMind konfiguréiert hutt, ouni de MCP-Server fir all Modell separat anzeriichten.

Firwat hanabi-cli MCP mat TypingMind benotzen?

TypingMind ass eng vun de beschte Benotzeruewerfläche fir LLM-Chat, well et méi KI-Modeller, Prompts, Plugins, KI-Agenten, API-Schlësselen a MCP-Tools an engem Aarbechtsberäich zesummebréngt. Wann hanabi-cli verbonnen ass, kënnt Dir seng MCP-Tools mat Äre bevorzugte Modeller benotzen a gläichzäiteg Är Chataarbecht an TypingMind organiséieren.

Wéi verbannen ech hanabi-cli MCP mat TypingMind?

hanabi-cli leeft iwwer de lokale MCP-Connector vun TypingMind. Dat eegent sech am beschten, wann de MCP-Server Zougrëff op lokal Fichieren, Desktop-Apps, Kommandozeilen-Tools oder privat Ressourcen op Ärem Computer brauch.

Wéi eng Tools stellt hanabi-cli MCP an TypingMind zur Verfügung?

hanabi-cli stellt MCP-Funktiounen zur Verfügung, déi Dir op der Plugins-Säit vun TypingMind aktivéiere kënnt, fir se am Chat ze benotzen oder KI-Agenten zouzeweisen.

Muss ech meng API-Schlëssele mat TypingMind deelen, fir hanabi-cli MCP ze benotzen?

Nee. TypingMind setzt op lokal Veraarbechtung a léisst Iech d'Kontroll iwwer Är Modellubidder, API-Schlësselen, Prompts a MCP-Konfiguratioun. Wann hanabi-cli eng Authentifizéierung verlaangt, setzt déi néideg Headeren, OAuth-Astellungen oder lokal Konfiguratioun fir dee MCP-Server derbäi, wann Dir d'Verbindung erstallt.

Änlech MCP-Serveren

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇