# klavis

> MCP Server

**Option 1 (Focus on integration):**

Open Source MCP integration library for AI apps. (Klavis AI)

**Option 2 (Focus on context):**

Klavis AI's Open Source MCP: Context management for AI application

## Overview

- **Category:** AI
- **Language:** Python
- **Stars:** 5801
- **Forks:** 284
- **Owner:** Klavis-AI
- **GitHub:** https://github.com/Klavis-AI/klavis
- **Homepage:** https://www.klavis.ai/
- **Created:** 2025-04-14T07:53:36+00:00
- **Updated:** 2025-07-07T15:51:23+00:00
- **Source:** https://model-context-protocol.com/servers/klavis

## Setup

## Setup

### Prerequisites

*   **Python:** Ensure you have Python 3.7 or higher installed.
*   **Node.js and npm:** Required for TypeScript/JavaScript development.  Install Node.js from [https://nodejs.org/](https://nodejs.org/).

### Installation

**Python**

```bash
pip install klavis
```

**TypeScript/JavaScript**

```bash
npm install klavis
```

### Configuration

1.  **Get Your API Key:** Sign up at [klavis.ai](https://www.klavis.ai) and create your [API key](https://www.klavis.ai/home/api-keys). This API key is essential for authenticating your requests to the Klavis AI platform.

2.  **Environment Variables (Optional but Recommended):** While you can directly embed your API key in your code (as shown in the examples), it's best practice to store it as an environment variable. This prevents accidental exposure of your key.

    *   **Example (Python):**

        ```python
        import os
        from klavis import Klavis

        klavis_client = Klavis(api_key=os.environ.get("KLAVIS_API_KEY"))
        ```

    *   **Example (TypeScript/JavaScript):**

        ```typescript
        const klavisClient = new KlavisClient({ apiKey: process.env.KLAVIS_API_KEY });
        ```

    *   **Setting Environment Variables:**  The method for setting environment variables depends on your operating system and environment.  Here are a few common ways:

        *   **Linux/macOS:**  Add the following line to your `.bashrc`, `.zshrc`, or equivalent shell configuration file:

            ```bash
            export KLAVIS_API_KEY="your-klavis-api-key"
            ```

            Then, source the file (e.g., `source ~/.bashrc`) or restart your terminal.

        *   **Windows:**  Use the `setx` command in the command prompt (run as administrator):

            ```
            setx KLAVIS_API_KEY "your-klavis-api-key" /M
            ```

            The `/M` flag sets the variable at the system level, requiring administrator privileges.  You'll need to restart your command prompt for the changes to take effect.  Alternatively, you can set user-level environment variables through the System Properties dialog (search for "environment variables" in the Windows search bar).

        *   **`.env` files (for development):**  For local development, you can use a `.env` file along with a library like `python-dotenv` (Python) or `dotenv` (Node.js) to load environment variables from a file.

            *   **Python:**

                ```bash
                pip install python-dotenv
                ```

                Create a `.env` file in your project directory:

                ```
                KLAVIS_API_KEY="your-klavis-api-key"
                ```

                Then, in your Python code:

                ```python
                from dotenv import load_dotenv
                import os
                from klavis import Klavis

                load_dotenv()  # Load environment variables from .env
                klavis_client = Klavis(api_key=os.environ.get("KLAVIS_API_KEY"))
                ```

            *   **Node.js:**

                ```bash
                npm install dotenv
                ```

                Create a `.env` file in your project directory:

                ```
                KLAVIS_API_KEY="your-klavis-api-key"
                ```

                Then, in your Node.js code:

                ```javascript
                require('dotenv').config(); // Load environment variables from .env
                const klavisClient = new KlavisClient({ apiKey: process.env.KLAVIS_API_KEY });
                ```

### Environment Variables

*   `KLAVIS_API_KEY`: (Required) Your Klavis AI API key.  This is the primary environment variable you'll need to set.

## Tools

## Available Tools

Klavis AI offers a wide range of tools through its MCP (Managed Connector Protocol) servers, enabling AI applications to interact with various services. Here's a breakdown of the available tools and features:

**Key Features:**

*   **Instant Integration:** Python and TypeScript SDKs, or REST API for quick setup.
*   **Built-in Authentication:** Secure OAuth flows and API key management.
*   **Production-Ready:** Hosted infrastructure for scalability.
*   **Multi-Platform:** Compatible with any LLM provider (OpenAI, Anthropic, Gemini, etc.) and AI agent framework (LangChain, Llamaindex, CrewAI, AutoGen, etc.).
*   **Self-Hostable:** Open-source MCP servers for custom deployments.

**MCP Servers & Integrations:**

Klavis AI provides access to over 100 tools across various categories, including:

*   **CRM:** Customer Relationship Management tools.
*   **GSuite:** Google Workspace applications (Gmail, Google Drive, etc.).
*   **Github:** Version control and collaboration platform.
*   **Slack:** Team communication and collaboration platform.
*   **Databases:** Access to various database systems.

**Specific MCP Servers (Examples):**

*   **YouTube:** Enables AI to summarize videos, search for content, and more.
    *   **Usage Example (Python):**
        ```python
        from klavis import Klavis
        from klavis.types import McpServerName, ToolFormat

        klavis_client = Klavis(api_key="your-klavis-key")

        youtube_server = klavis_client.mcp_server.create_server_instance(
            server_name=McpServerName.YOUTUBE,
            user_id="user123",
            platform_name="MyApp"
        )

        tools = klavis_client.mcp_server.list_tools(
            server_url=youtube_server.server_url,
            format=ToolFormat.OPENAI,
        )
        ```
*   **Gmail:** Allows AI to send emails, read emails, and manage inboxes.
    *   **Usage Example (TypeScript):**
        ```typescript
        import { KlavisClient, Klavis } from 'klavis';

        const klavisClient = new KlavisClient({ apiKey: 'your-klavis-key' });

        const gmailServer = await klavisClient.mcpServer.createServerInstance({
            serverName: Klavis.McpServerName.Gmail,
            userId: "user123",
            platformName: "MyApp"
        });
        ```

**Upcoming Integrations (Roadmap):**

*   **CRM & Sales:**
    *   Greenhouse (Applicant tracking system)
    *   Monday.com (Work management platform)
    *   Zendesk (Customer service platform)
*   **Microsoft Ecosystem:**
    *   Microsoft Teams (Team collaboration and communication)
    *   Microsoft Outlook (Email and calendar management)
    *   OneDrive (Cloud storage and file sharing)
*   **Professional Networks & Communication:**
    *   LinkedIn (Professional networking platform)
*   **File Storage & Productivity:**
    *   Dropbox (Cloud file storage and synchronization)
*   **Scheduling & Calendar:**
    *   Cal.com (Open-source scheduling platform)

**Authentication & Multi-Tool Workflows:**

*   Klavis handles authentication (OAuth, API keys) for various services.
*   Combine multiple MCP servers in a single AI conversation for complex workflows.

**Example Multi-Tool Workflow (GitHub & Slack):**

```python
# Create multiple servers
github_server = klavis_client.mcp_server.create_server_instance(...)
slack_server = klavis_client.mcp_server.create_server_instance(...)

# Use tools from both servers in a single AI conversation
all_tools = []
all_tools.extend(klavis_client.mcp_server.list_tools(github_server.server_url).tools)
all_tools.extend(klavis_client.mcp_server.list_tools(slack_server.server_url).tools)
```

**MCP Clients (for Self-Hosting):**

*   Discord Bot
*   Slack Bot
*   Web Interface
*   WhatsApp Bot

**Note:**  The specific tools available within each MCP server can be listed using the `list_tools` method, as demonstrated in the examples.  See the [documentation](https://docs.klavis.ai) for a complete list and details on each tool.
