### Install and Configure Chibi Bot using Pip (Linux/macOS) Source: https://chibi.bot/start Installs the chibi-bot package using pip and then configures it by setting bot token and API keys. Finally, it starts the bot service. ```bash pip install chibi-bot chibi config # Set up your bot token and API keys chibi start ``` -------------------------------- ### Configure Environment Variables (Bash/dotenv) Source: https://chibi.bot/installation/manual-setup Copies the example environment file and instructs the user to edit it with their specific API keys and settings. This is crucial for the bot's operation. ```bash cp .env.example .env ``` ```dotenv TELEGRAM_BOT_TOKEN=your_token OPENAI_API_KEY=sk-... # ... other keys ``` -------------------------------- ### Run Chibi Bot with Poetry (Bash) Source: https://chibi.bot/installation/manual-setup Starts the Chibi bot application using Poetry. This command executes the main Python script after all dependencies are installed and the environment is configured. ```bash poetry run python main.py ``` -------------------------------- ### Secure Configuration Examples for Chibi Bot Source: https://chibi.bot/configuration/core-settings These examples demonstrate secure configurations for the Chibi Bot using environment variables. The first example shows a private bot with a whitelisted user and filesystem access enabled. The second example illustrates a public bot configuration where filesystem access is disabled for security. ```dotenv # Private bot with whitelisted users PUBLIC_MODE=False USERS_WHITELIST=123456789,@myusername FILESYSTEM_ACCESS=True ``` ```dotenv # Public bot (users provide their own keys) PUBLIC_MODE=True USERS_WHITELIST=123456789,@myusername FILESYSTEM_ACCESS=False ``` -------------------------------- ### Install Chibi Bot via Pip Source: https://chibi.bot/installation/pip-installation Installs the Chibi bot package using pip. This is the quickest way to get started with the bot and its command-line interface. ```bash pip install chibi-bot ``` -------------------------------- ### Install Dependencies with Poetry (Bash) Source: https://chibi.bot/installation/manual-setup Installs all project dependencies for the Chibi bot using Poetry. This command should be run after cloning the repository. ```bash poetry install ``` -------------------------------- ### Configure Chibi Bot Source: https://chibi.bot/installation/pip-installation Opens the Chibi bot configuration file in the default editor. This command is used for the first-time setup to input required API keys and other settings. ```bash chibi config ``` -------------------------------- ### Clone Chibi Repository (Bash) Source: https://chibi.bot/installation/manual-setup Clones the Chibi bot repository from GitHub and navigates into the project directory. This is the first step in manual installation. ```bash git clone https://github.com/s-nagaev/chibi.git cd chibi ``` -------------------------------- ### Run Chibi Bot using Docker (Linux/macOS) Source: https://chibi.bot/start Runs Chibi Bot as a Docker container in detached mode. It sets essential environment variables for the Telegram bot token, OpenAI API key, and user whitelist, and mounts a volume for persistent data storage. ```bash docker run -d --name chibi \ -e TELEGRAM_BOT_TOKEN="your_bot_token" \ -e OPENAI_API_KEY="sk-..." \ -e USERS_WHITELIST="@YourTelegramName" \ -v chibi_data:/app/data \ pysergio/chibi:latest ``` -------------------------------- ### Initialize Database MCP Server via SSE Source: https://chibi.bot/guides/mcp-integration Connect to a database MCP server using Server-Sent Events (SSE). This example shows how to initialize a PostgreSQL MCP server by providing a server name and the SSE endpoint URL. This allows the AI assistant to interact with the specified database. ```text Initialize MCP server "postgres" via SSE at https://my-mcp-db-server.com/mcp ``` -------------------------------- ### Deploy Docker Compose Stack Source: https://chibi.bot/guides/persistent-history This command initiates the deployment of your Docker Compose stack, creating any necessary volumes (like 'chibi_data') and starting the Chibi container with the specified volume mounts. ```bash docker-compose up -d ``` -------------------------------- ### Check Chibi Bot Logs Source: https://chibi.bot/support/troubleshooting View live logs for the Chibi Bot to identify potential errors or issues. This command is useful for diagnosing problems by observing the bot's real-time output. ```bash docker-compose logs -f ``` -------------------------------- ### Initialize Filesystem MCP Server via Stdio Source: https://chibi.bot/guides/mcp-integration Initialize an MCP server for local filesystem access using Stdio. This command specifies the server name, the execution command (e.g., 'npx'), and arguments including the server package and the path to the allowed directory. This enables the AI assistant to read and write files within the designated directory. ```text Initialize MCP server "filesystem" via stdio with command "npx" and args ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/directory"] ``` -------------------------------- ### Initialize GitHub MCP Server via Stdio Source: https://chibi.bot/guides/mcp-integration Initialize an MCP server for GitHub integration using Stdio. This command uses 'npx' to run the '@modelcontextprotocol/server-github' package. It requires the `GITHUB_PERSONAL_ACCESS_TOKEN` environment variable to be set for authentication with the GitHub API. ```text Initialize MCP server "github" via stdio with command "npx" and args ["-y", "@modelcontextprotocol/server-github"] ``` -------------------------------- ### Connect to Local Stdio MCP Server Source: https://chibi.bot/guides/mcp-integration Establish a connection to a local MCP server using Standard Input/Output (Stdio). This requires specifying the server name, the command to execute, and any necessary arguments for the command. The assistant utilizes the `initialize_stdio_mcp_server` tool to manage this process. ```text Connect to MCP server "local-fs" using command "node" with args ["/path/to/server.js"] ``` -------------------------------- ### Configure MCP SSE and Stdio Connections Source: https://chibi.bot/guides/mcp-integration Configure MCP integration by setting environment variables. ENABLE_MCP_SSE controls remote server connections via Server-Sent Events, while ENABLE_MCP_STDIO enables local process connections via Standard Input/Output. These settings can be managed in a .env file or directly in the environment. ```env ENABLE_MCP_SSE=True ENABLE_MCP_STDIO=False ``` -------------------------------- ### Connect to Remote SSE MCP Server Source: https://chibi.bot/guides/mcp-integration Initiate a connection to a remote MCP server using Server-Sent Events (SSE). This involves instructing the AI assistant to connect to a specified server name and URL. The assistant internally uses the `initialize_sse_mcp_server` tool for this operation. ```text Connect to MCP server "my-server" at https://example.com/mcp ``` -------------------------------- ### Environment Variables for Agent Mode Configuration Source: https://chibi.bot/guides/agent-mode-security These environment variables are essential for enabling Agent Mode and its command moderation features. `FILESYSTEM_ACCESS` must be set to `True` to activate the mode, and `GEMINI_API_KEY` is required for the AI moderator to function. ```env FILESYSTEM_ACCESS=True GEMINI_API_KEY=your_gemini_api_key_here WORKING_DIR=/home/user/projects ``` -------------------------------- ### Monitor Chibi Bot Logs for Command Activity Source: https://chibi.bot/guides/agent-mode-security This command filters Chibi Bot's Docker logs to display lines related to command moderation decisions (pre-moderating, declined, accepted). It helps users actively monitor the bot's actions and security verdicts. ```bash docker logs chibi | grep -E "Pre-moderating|declined|accepted" ``` -------------------------------- ### Configure User Whitelist for Chibi Bot Source: https://chibi.bot/guides/secure-your-bot Specify allowed Telegram users by their ID or username to control bot access. Using user IDs is recommended as they are permanent, unlike usernames. ```dotenv # .env USERS_WHITELIST=123456789,@myusername ``` -------------------------------- ### Set Bot Name using .env file Source: https://chibi.bot/guides/customize-personality Configure the bot's name by setting the BOT_NAME environment variable in your .env file. This name will be used by the bot when referring to itself. ```dotenv BOT_NAME=Jarvis ``` -------------------------------- ### Mount Docker Volume to Chibi Bot Container Source: https://chibi.bot/guides/persistent-history This snippet demonstrates how to mount the 'chibi_data' named volume to the '/app/data' directory within the Chibi bot service definition in your docker-compose.yml. This ensures the bot's data is stored persistently. ```yaml services: chibi: # ... other configurations ... volumes: - chibi_data:/app/data # ... other configurations ... ``` -------------------------------- ### Configure Group Whitelist for Chibi Bot Source: https://chibi.bot/guides/secure-your-bot Define authorized Telegram groups where the bot should respond. This is crucial when the bot is added to groups to prevent it from responding in unauthorized ones. ```dotenv # .env GROUPS_WHITELIST=-1001234567890 ``` -------------------------------- ### Define Docker Volume for Chibi Bot Data Source: https://chibi.bot/guides/persistent-history This snippet shows how to define a named Docker volume called 'chibi_data' in the top-level 'volumes:' section of your docker-compose.yml file. This volume will be managed by Docker to store persistent data. ```yaml volumes: chibi_data: # You can optionally specify a driver or external configuration here ``` -------------------------------- ### Moderator Verdict JSON Source: https://chibi.bot/guides/agent-mode-security The AI Security Moderator returns a JSON object indicating whether a command is accepted or declined. Accepted commands are safe for execution, while declined commands are blocked with a specified reason. ```json { "verdict": "accepted" } ``` ```json { "verdict": "declined", "reason": "Command attempts to delete critical system directory." } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.