Skip to main content

Prerequisites

Before we begin, you’ll need:

Fireworks AI API Key

Get your API key from Fireworks AI

Klavis AI API Key

Get your API key from Klavis AI

Installation

First, install the required packages:

Setup Environment Variables

Basic Setup

AI Agent with MCP Integration

Now we’ll create an intelligent agent that can use MCP servers through Klavis API. This agent will:
  1. Discover Tools: Automatically find available tools from MCP servers
  2. Function Calling: Use Fireworks AI’s function calling capabilities
  3. Tool Execution: Execute tools through Klavis API
  4. Smart Responses: Generate intelligent responses based on tool results

Use Case Examples

Example 1: Summarize YouTube Video

1

Initialize Clients

Set up Fireworks AI and Klavis API clients
2

Create MCP Instance

Create a YouTube MCP server instance
3

Process Request

Use the agent to analyze and summarize a YouTube video

Example 2: Send Email via Gmail

Gmail integration requires OAuth authentication, so you’ll need to authorize the application in your browser.
1

Create Gmail Instance

Create a Gmail MCP server instance
2

OAuth Authorization

Complete OAuth flow for Gmail access
3

Send Email

Use the agent to send an email

Next Steps

Explore More MCP Servers

Try other available servers like Slack, Notion, CRM, etc.

Try Different Fireworks Models

Experiment with various models like Llama, Mixtral, or Deepseek for different use cases

Build Multi-Server Workflows

Create sophisticated agents that combine Gmail + Slack + Notion for complete business automation

Production Deployment

Scale these patterns for production applications

Useful Resources

Happy building with Fireworks AI and Klavis! 🚀