# How to integrate Altoviz MCP with Autogen

```json
{
  "title": "How to integrate Altoviz MCP with Autogen",
  "toolkit": "Altoviz",
  "toolkit_slug": "altoviz",
  "framework": "AutoGen",
  "framework_slug": "autogen",
  "url": "https://composio.dev/toolkits/altoviz/framework/autogen",
  "markdown_url": "https://composio.dev/toolkits/altoviz/framework/autogen.md",
  "updated_at": "2026-10-05T05:34:39.360Z"
}
```

## Introduction

This guide walks you through connecting Altoviz to AutoGen using the Composio tool router. By the end, you'll have a working Altoviz agent that can find customer details by email address, update a client's company information, retrieve current vat rates for invoices through natural language commands.
This guide will help you understand how to give your AutoGen agent real control over a Altoviz account through Composio's Altoviz MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate Altoviz with

- [Claude Code](https://composio.dev/toolkits/altoviz/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/altoviz/framework/claude-cowork)
- [OpenAI Agents SDK](https://composio.dev/toolkits/altoviz/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/altoviz/framework/claude-agents-sdk)
- [Codex](https://composio.dev/toolkits/altoviz/framework/codex)
- [OpenClaw](https://composio.dev/toolkits/altoviz/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/altoviz/framework/hermes-agent)
- [Atomic Agent](https://composio.dev/toolkits/altoviz/framework/atomic-agent)
- [Google ADK](https://composio.dev/toolkits/altoviz/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/altoviz/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/altoviz/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/altoviz/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/altoviz/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/altoviz/framework/crew-ai)
- [Pydantic AI](https://composio.dev/toolkits/altoviz/framework/pydantic-ai)

## TL;DR

Here's what you'll learn:
- Get and set up your OpenAI and Composio API keys
- Install the required dependencies for Autogen and Composio
- Initialize Composio and create a Tool Router session for Altoviz
- Wire that MCP URL into Autogen using McpWorkbench and StreamableHttpServerParams
- Configure an Autogen AssistantAgent that can call Altoviz tools
- Run a live chat loop where you ask the agent to perform Altoviz operations

## What is AutoGen?

Autogen is a framework for building multi-agent conversational AI systems from Microsoft. It enables you to create agents that can collaborate, use tools, and maintain complex workflows.
Key features include:
- Multi-Agent Systems: Build collaborative agent workflows
- MCP Workbench: Native support for Model Context Protocol tools
- Streaming HTTP: Connect to external services through streamable HTTP
- AssistantAgent: Pre-built agent class for tool-using assistants

## What is the Altoviz MCP server, and what's possible with it?

The Altoviz MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Altoviz account. It provides structured and secure access to your customers, contacts, products, invoices, credit notes, receipts, and quotes, so your agent can create invoices, find customer records, organize products, record payments, and download billing documents on your behalf.
- Customer and contact management: Have your agent create and find customers or contacts, retrieve customer contacts, organize customers into families, and remove customer records.
- Invoice and credit note handling: Let the agent create draft sales invoices and credit notes, find existing records, download PDF copies, or delete drafts you no longer need.
- Product catalog organization: Direct your agent to create, find, retrieve, or delete products and organize them into product families.
- Payment receipt tracking: Instruct your agent to create receipts for customer payments, find existing receipts, retrieve their details, or delete them.
- Quote and document retrieval: Have your agent find sales quotes, remove quotes when needed, and download available purchase invoices as PDF files.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `ALTOVIZ_CREATE_CONTACT` | Create Contact | Creates a new contact in the Altoviz system. Use when you need to add a new contact with details like name, email, phone, and company information. |
| `ALTOVIZ_CREATE_CUSTOMER` | Create Customer | Creates a new customer in Altoviz. Use type='Company' for business customers (requires companyName) or type='Individual' for personal customers (typically uses firstName/lastName). |
| `ALTOVIZ_CREATE_CUSTOMER_FAMILY` | Create Customer Family | Creates a new customer family in Altoviz for categorizing and organizing customers into groups. Use when you need to create customer segments or categories for better organization. |
| `ALTOVIZ_CREATE_PRODUCT` | Create Product | Creates a new product in the Altoviz system. This tool allows for the independent creation of a product with all necessary details. |
| `ALTOVIZ_CREATE_PRODUCT_FAMILY` | Create Product Family | Tool to create a new product family in Altoviz. Use when you need to organize products into categories or families for better inventory management. |
| `ALTOVIZ_CREATE_RECEIPT` | Create Receipt | Creates a new receipt in the Altoviz system to record customer payments. Use when you need to document received payments and optionally link them to invoices or other documents. |
| `ALTOVIZ_CREATE_SALE_CREDIT` | Create Sale Credit | Creates a new draft credit note (avoir) in Altoviz. Credit notes are used to cancel or refund invoices. The credit note is created in draft status and can be modified before being finalized. |
| `ALTOVIZ_CREATE_SALE_INVOICE` | Create Sale Invoice | Creates a new draft sale invoice in Altoviz. The invoice is created in draft status and can be modified before being finalized. Use when you need to generate an invoice for a customer with line items. |
| `ALTOVIZ_DELETE_COLLEAGUE` | Delete Colleague | Tool to delete a colleague from Altoviz. Use when you need to permanently remove a colleague from the system. |
| `ALTOVIZ_DELETE_CUSTOMER` | Delete Customer | Tool to delete a customer from Altoviz. Use when you need to permanently remove a customer record from the system. Use ALTOVIZ_FIND_CUSTOMER first to look up customer IDs by email address if needed. |
| `ALTOVIZ_DELETE_CUSTOMER_FAMILY` | Delete Customer Family | Tool to delete a customer family from Altoviz. Use when you need to permanently remove a customer family from the system. |
| `ALTOVIZ_DELETE_PRODUCT` | Delete Product | This tool allows you to delete an existing product from Altoviz. The action permanently removes the product from the system. |
| `ALTOVIZ_DELETE_PRODUCT_FAMILY` | Delete Product Family | Tool to delete a product family from Altoviz. Use when you need to permanently remove a product family from the system. |
| `ALTOVIZ_DELETE_RECEIPT` | Delete Receipt | Tool to delete a receipt from Altoviz. Use when you need to permanently remove a receipt from the system. |
| `ALTOVIZ_DELETE_SALE_CREDIT` | Delete Draft Sale Credit | Tool to delete a draft credit from Altoviz. Use when you need to permanently remove a draft credit. Only draft credits can be deleted; finalized credits cannot be removed. |
| `ALTOVIZ_DELETE_SALE_INVOICE` | Delete Sale Invoice | Tool to delete a draft sale invoice from Altoviz. Use when you need to permanently remove a draft invoice from the system. Only draft invoices can be deleted; finalized invoices cannot be deleted. |
| `ALTOVIZ_DELETE_SALE_QUOTE` | Delete Sale Quote | Tool to delete a sale quote from Altoviz. Use when you need to permanently remove a quote from the system. |
| `ALTOVIZ_DELETE_SUPPLIER` | Delete Supplier | Tool to delete a supplier from Altoviz. Use when you need to permanently remove a supplier record from the system. |
| `ALTOVIZ_DOWNLOAD_PURCHASE_INVOICE` | Download Purchase Invoice | Tool to download a purchase invoice as a PDF file from Altoviz. Use when you need to retrieve the PDF document of a specific purchase invoice. |
| `ALTOVIZ_DOWNLOAD_SALE_CREDIT` | Download Sale Credit PDF | Tool to download a sale credit as a PDF file from Altoviz. Use when you need to retrieve the PDF version of a specific sale credit document. |
| `ALTOVIZ_DOWNLOAD_SALE_INVOICE` | Download Sale Invoice PDF | Tool to download a sale invoice as a PDF file from Altoviz. Use when you need to retrieve the PDF document of a specific sale invoice. |
| `ALTOVIZ_FIND_CONTACT` | Find Contact by Email | This tool allows searching for contacts in Altoviz using an email address. The action is independently executable and returns contact details if found. |
| `ALTOVIZ_FIND_CUSTOMER` | Find Customer by Email | This tool allows you to find a customer in Altoviz by their email address. This is a standalone action that doesn't require any resource IDs or dependencies on other tools. |
| `ALTOVIZ_FIND_PRODUCT` | Find Product by Number | Search for a product in Altoviz by its product number/SKU. Returns the first matching product with complete details including name, description, pricing, VAT, unit of measurement, and more. Returns null if no product matches. Use cases: - Look up a specific product by its SKU before creating an invoice - Verify a product exists before referencing it in orders - Retrieve product pricing and tax information |
| `ALTOVIZ_FIND_PRODUCT_BY_NUMBER_OR_ID` | Find Product by Number or Internal ID | Tool to find a product in Altoviz by exact product number or internal ID. Use when you need to look up a product by either its product number/SKU or your internal system ID. At least one of the parameters must be provided. |
| `ALTOVIZ_FIND_RECEIPT` | Find Receipt by Internal ID | Tool to find receipts in Altoviz by customer internal ID. Returns a list of receipts associated with the specified internal ID. If no internal ID is provided, may return all receipts. Use when you need to search for receipts by customer identifier. |
| `ALTOVIZ_FIND_SALE_CREDIT` | Find Sale Credits | Tool to find sale credits in Altoviz. Use when you need to search for or retrieve credit notes. Can filter by internal ID or return all credits if no filter is provided. |
| `ALTOVIZ_FIND_SALE_INVOICE` | Find Sale Invoices | Tool to find sale invoices in Altoviz. Use when you need to search for or retrieve invoices. Can filter by internal ID or return all invoices if no filter is provided. |
| `ALTOVIZ_FIND_SALE_QUOTE` | Find Sale Quotes | Tool to find sale quotes in Altoviz. Use when you need to search for or retrieve quotations. Can filter by internal ID or return all quotes if no filter is provided. |
| `ALTOVIZ_GET_CLASSIFICATIONS` | Get Classifications List | This tool retrieves a list of classifications from the Altoviz platform. Classifications are essential for producing accounting registers from user-created invoices. It can fetch all classifications or filter them by type. |
| `ALTOVIZ_GET_COLLEAGUE` | Get Colleague by ID | Tool to retrieve a colleague's details from Altoviz by their ID. Use this when you need to fetch information about a specific colleague including their contact information, partner status, and metadata. |
| `ALTOVIZ_GET_CONTACT` | Get Contact by ID | Tool to retrieve a contact by its unique ID from Altoviz. Use when you need to fetch detailed information about a specific contact. |
| `ALTOVIZ_GET_CURRENT_USER` | Get Current User | Tool to retrieve the current authenticated user's information from Altoviz. Use when you need to get details about the currently authenticated user. |
| `ALTOVIZ_GET_CUSTOMER` | Get Customer by ID | Tool to retrieve a customer by their ID from Altoviz. Use when you need detailed information about a specific customer. |
| `ALTOVIZ_GET_CUSTOMER_BY_INTERNAL_ID` | Get Customer by Internal ID | Tool to retrieve a single customer from Altoviz by their internal ID. Use when you need to fetch detailed information about a specific customer using their internal identifier. |
| `ALTOVIZ_GET_CUSTOMER_CONTACTS` | Get Customer Contacts | Tool to retrieve all contacts associated with a specific customer in Altoviz. Use when you need to get contact information for a customer using their customer ID. |
| `ALTOVIZ_GET_CUSTOMER_FAMILY` | Get Customer Family | Tool to retrieve a customer family by ID from Altoviz. Use when you need to fetch details of a specific customer family. |
| `ALTOVIZ_GET_PRODUCT` | Get Product by ID | Tool to retrieve a product by its unique ID in Altoviz. Use when you need complete details about a specific product including pricing, VAT, units, and inventory information. |
| `ALTOVIZ_GET_PRODUCT_FAMILY` | Get Product Family by ID | Tool to retrieve a specific product family by its ID from Altoviz. Use when you need to fetch details about a product category or family grouping. |
| `ALTOVIZ_GET_RECEIPT` | Get Receipt by ID | Tool to retrieve a receipt by its ID from Altoviz. Use when you need to fetch details of a specific receipt including amount, payment method, status, and customer information. |
| `ALTOVIZ_GET_SALE_CREDIT` | Get Sale Credit by ID | Tool to retrieve a sale credit by its ID from Altoviz. Use when you need to get detailed information about a specific credit. |
| `ALTOVIZ_GET_SALE_INVOICE` | Get Sale Invoice by ID | Tool to retrieve a sale invoice by its ID from Altoviz. Use when you need to get detailed information about a specific invoice. |
| `ALTOVIZ_GET_SETTINGS` | Get Settings | Tool to retrieve application settings from Altoviz. Use when you need to access configuration for accounting, company information, emailing, sales, social media, or VAT settings. |
| `ALTOVIZ_GET_SUPPLIER` | Get Supplier by ID | Tool to retrieve a supplier by their ID from Altoviz. Use when you need detailed information about a specific supplier. |
| `ALTOVIZ_GET_SUPPLIER_CONTACTS` | Get Supplier Contacts | Tool to retrieve all contacts associated with a specific supplier in Altoviz. Use when you need to get contact information for a supplier using their supplier ID. |
| `ALTOVIZ_GET_UNITS` | Get Units List | This tool retrieves a list of all available units in the Altoviz system. Units are used for product measurements and quantity specifications in various transactions. |
| `ALTOVIZ_GET_VATS` | Get VAT Rates | This tool retrieves a list of all available VAT rates from Altoviz. It's essential for creating and managing invoices and quotes where VAT calculations are required. It supports retrieving VAT rates, validating them for different regions, and ensuring correct tax calculations in financial documents. |
| `ALTOVIZ_LIST_COLLEAGUES` | List Colleagues | Retrieves a list of colleagues from Altoviz. Supports pagination, sorting, and full-text search. Use this to discover available colleagues, search for specific team members, or list all colleagues in the system. |
| `ALTOVIZ_LIST_CONTACTS` | List Contacts | Tool to retrieve a list of contacts from Altoviz with optional filtering and pagination. Use when you need to browse or search through available contacts. |
| `ALTOVIZ_LIST_CUSTOMER_FAMILIES` | List Customer Families | Tool to list customer families from Altoviz. Use when you need to retrieve or search through customer family groups. Supports pagination and full-text search to filter results. |
| `ALTOVIZ_LIST_CUSTOMERS` | List Customers | Tool to retrieve a paginated list of customers from Altoviz. Use when you need to browse all customers, search for customers by name/email/company, or fetch multiple customers at once. Supports pagination, sorting, and full-text search across customer fields. |
| `ALTOVIZ_LIST_PRODUCT_FAMILIES` | List Product Families | Tool to retrieve a list of product families from Altoviz. Use when you need to browse available product families, search for specific families, or get family information for product categorization. |
| `ALTOVIZ_LIST_RECEIPTS` | List Receipts | Tool to retrieve a list of receipts from Altoviz. Use this when you need to view, search, or filter receipts by pagination, ordering, or full-text search. |
| `ALTOVIZ_LIST_SALE_CREDITS` | List Sale Credits | Tool to retrieve a list of sale credits from Altoviz. Use when you need to view credit notes issued to customers, filter by date range, or find credits for a specific customer. Supports pagination and sorting for efficient data retrieval. |
| `ALTOVIZ_LIST_SALE_INVOICES` | List Sale Invoices | Tool to retrieve a list of sale invoices from Altoviz. Use when you need to view invoices issued to customers, filter by date range, status, or find invoices for a specific customer. Supports pagination, sorting, and status filtering for efficient data retrieval. |
| `ALTOVIZ_LIST_SALE_QUOTES` | List Sale Quotes | Tool to retrieve a list of sale quotes from Altoviz. Use when you need to view quotes issued to customers, filter by date range, or find quotes for a specific customer. Supports pagination and sorting for efficient data retrieval. |
| `ALTOVIZ_LIST_SUPPLIERS` | List Suppliers | Tool to retrieve a paginated list of suppliers from Altoviz. Use when you need to browse all suppliers, search for suppliers by name/email/company, or fetch multiple suppliers at once. Supports pagination, sorting, and full-text search across supplier fields. |
| `ALTOVIZ_LIST_WEBHOOKS` | List Webhooks | Tool to retrieve all configured webhooks from Altoviz. Use when you need to view all webhook configurations, including their URLs, event types, and authentication details. |
| `ALTOVIZ_REGISTER_WEBHOOK` | Register Webhook | Tool to register a new webhook in Altoviz. Use when you need to receive real-time notifications for events like customer creation, invoice updates, or product changes. |
| `ALTOVIZ_TEST_API_KEY` | Test API Key | Tool to test API key validity and retrieve basic account information. Use this action to verify that the API key is working correctly and to get basic information about the authenticated account. |
| `ALTOVIZ_UNREGISTER_WEBHOOK` | Unregister Webhook | Tool to unregister a webhook from Altoviz. Use when you need to remove a webhook configuration. Either webhook ID or URL must be provided to identify which webhook to unregister. |
| `ALTOVIZ_UPDATE_COLLEAGUE` | Update Colleague Information | Updates an existing colleague's information in Altoviz. Only fields that are provided will be updated; omitted fields retain their current values. Use this action to modify colleague details such as contact information, partner status, and associated metadata. |
| `ALTOVIZ_UPDATE_CUSTOMER` | Update Customer Information | Updates an existing customer's information in Altoviz. Only fields that are provided will be updated; omitted fields retain their current values. Important: For Individual customers, you must provide either last_name or company_name. Setting company_name will change the customer type to Company. Use ALTOVIZ_FIND_CUSTOMER first to look up customer IDs by email address. |
| `ALTOVIZ_UPDATE_RECEIPT` | Update Receipt | Updates an existing receipt in Altoviz. Only fields that are provided will be updated; omitted fields retain their current values. Use this to modify receipt details such as amount, date, payment method, status, or notes. |
| `ALTOVIZ_UPDATE_SALE_CREDIT` | Update Sale Credit | Tool to update a draft credit note in Altoviz. Use when you need to modify an existing draft credit. Only draft credits can be updated; finalized credits cannot be modified. |
| `ALTOVIZ_UPDATE_SUPPLIER` | Update Supplier Information | Updates an existing supplier's information in Altoviz. Only fields that are provided will be updated; omitted fields retain their current values. Use this when you need to modify supplier details such as contact information, address, payment terms, or internal notes. |
| `ALTOVIZ_UPLOAD_PURCHASE_INVOICE` | Upload Purchase Invoice | Tool to upload and create a new purchase invoice from a file (PDF or image format). Use when you need to create a purchase invoice by uploading a document. |

## Supported Triggers

None listed.

## Creating MCP Server - Stand-alone vs Composio SDK

The Altoviz MCP server is an implementation of the Model Context Protocol that connects your AI agents and assistants directly to Altoviz. Instead of manually wiring Altoviz APIs, OAuth, and scopes yourself, you get a structured, tool-based interface that an LLM can call safely.
With Composio's managed implementation, you don't have to create your own developer app. For production, if you're building an end product, we recommend using your own credentials. The managed server helps you prototype fast and go from 0-1 faster.

## Step-by-step Guide

### 1. Prerequisites

You will need:
- A Composio API key
- An OpenAI API key (used by Autogen's OpenAIChatCompletionClient)
- A Altoviz account you can connect to Composio
- Some basic familiarity with Autogen and Python async

### 1. Getting API Keys for OpenAI and Composio

OpenAI API Key
- Go to the [OpenAI dashboard](https://platform.openai.com/settings/organization/api-keys) and create an API key. You'll need credits to use the models, or you can connect to another model provider.
- Keep the API key safe.
Composio API Key
- Log in to the [Composio dashboard](https://dashboard.composio.dev?utm_source=toolkits&utm_medium=framework_docs).
- Navigate to your API settings and generate a new API key.
- Store this key securely as you'll need it for authentication.

### 2. Install dependencies

Install Composio, Autogen extensions, and dotenv.
What's happening:
- composio connects your agent to Altoviz via MCP
- autogen-agentchat provides the AssistantAgent class
- autogen-ext-openai provides the OpenAI model client
- autogen-ext-tools provides MCP workbench support
```bash
pip install composio python-dotenv
pip install autogen-agentchat autogen-ext-openai autogen-ext-tools
```

### 3. Set up environment variables

Create a .env file in your project folder.
What's happening:
- COMPOSIO_API_KEY is required to talk to Composio
- OPENAI_API_KEY is used by Autogen's OpenAI client
- USER_ID is how Composio identifies which user's Altoviz connections to use
```bash
COMPOSIO_API_KEY=your-composio-api-key
OPENAI_API_KEY=your-openai-api-key
USER_ID=your-user-identifier@example.com
```

### 4. Import dependencies and create Tool Router session

What's happening:
- load_dotenv() reads your .env file
- Composio(api_key=...) initializes the SDK
- create(...) creates a Tool Router session that exposes Altoviz tools
- session.mcp.url is the MCP endpoint that Autogen will connect to
```python
import asyncio
import os
from dotenv import load_dotenv
from composio import Composio

from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.tools.mcp import McpWorkbench, StreamableHttpServerParams

load_dotenv()

async def main():
    # Initialize Composio and create a Altoviz session
    composio = Composio(api_key=os.getenv("COMPOSIO_API_KEY"))
    session = composio.create(
        user_id=os.getenv("USER_ID"),
        toolkits=["altoviz"]
    )
    url = session.mcp.url
```

### 5. Configure MCP parameters for Autogen

Autogen expects parameters describing how to talk to the MCP server. That is what StreamableHttpServerParams is for.
What's happening:
- url points to the Tool Router MCP endpoint from Composio
- timeout is the HTTP timeout for requests
- sse_read_timeout controls how long to wait when streaming responses
- terminate_on_close=True cleans up the MCP server process when the workbench is closed
```python
# Configure MCP server parameters for Streamable HTTP
server_params = StreamableHttpServerParams(
    url=url,
    timeout=30.0,
    sse_read_timeout=300.0,
    terminate_on_close=True,
    headers={"x-api-key": os.getenv("COMPOSIO_API_KEY")}
)
```

### 6. Create the model client and agent

What's happening:
- OpenAIChatCompletionClient wraps the OpenAI model for Autogen
- McpWorkbench connects the agent to the MCP tools
- AssistantAgent is configured with the Altoviz tools from the workbench
```python
# Create model client
model_client = OpenAIChatCompletionClient(
    model="gpt-5",
    api_key=os.getenv("OPENAI_API_KEY")
)

# Use McpWorkbench as context manager
async with McpWorkbench(server_params) as workbench:
    # Create Altoviz assistant agent with MCP tools
    agent = AssistantAgent(
        name="altoviz_assistant",
        description="An AI assistant that helps with Altoviz operations.",
        model_client=model_client,
        workbench=workbench,
        model_client_stream=True,
        max_tool_iterations=10
    )
```

### 7. Run the interactive chat loop

What's happening:
- The script prompts you in a loop with You:
- Autogen passes your input to the model, which decides which Altoviz tools to call via MCP
- agent.run_stream(...) yields streaming messages as the agent thinks and calls tools
- Typing exit, quit, or bye ends the loop
```python
print("Chat started! Type 'exit' or 'quit' to end the conversation.\n")
print("Ask any Altoviz related question or task to the agent.\n")

# Conversation loop
while True:
    user_input = input("You: ").strip()

    if user_input.lower() in ["exit", "quit", "bye"]:
        print("\nGoodbye!")
        break

    if not user_input:
        continue

    print("\nAgent is thinking...\n")

    # Run the agent with streaming
    try:
        response_text = ""
        async for message in agent.run_stream(task=user_input):
            if hasattr(message, "content") and message.content:
                response_text = message.content

        # Print the final response
        if response_text:
            print(f"Agent: {response_text}\n")
        else:
            print("Agent: I encountered an issue processing your request.\n")

    except Exception as e:
        print(f"Agent: Sorry, I encountered an error: {str(e)}\n")
```

## Complete Code

```python
import asyncio
import os
from dotenv import load_dotenv
from composio import Composio

from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.tools.mcp import McpWorkbench, StreamableHttpServerParams

load_dotenv()

async def main():
    # Initialize Composio and create a Altoviz session
    composio = Composio(api_key=os.getenv("COMPOSIO_API_KEY"))
    session = composio.create(
        user_id=os.getenv("USER_ID"),
        toolkits=["altoviz"]
    )
    url = session.mcp.url

    # Configure MCP server parameters for Streamable HTTP
    server_params = StreamableHttpServerParams(
        url=url,
        timeout=30.0,
        sse_read_timeout=300.0,
        terminate_on_close=True,
        headers={"x-api-key": os.getenv("COMPOSIO_API_KEY")}
    )

    # Create model client
    model_client = OpenAIChatCompletionClient(
        model="gpt-5",
        api_key=os.getenv("OPENAI_API_KEY")
    )

    # Use McpWorkbench as context manager
    async with McpWorkbench(server_params) as workbench:
        # Create Altoviz assistant agent with MCP tools
        agent = AssistantAgent(
            name="altoviz_assistant",
            description="An AI assistant that helps with Altoviz operations.",
            model_client=model_client,
            workbench=workbench,
            model_client_stream=True,
            max_tool_iterations=10
        )

        print("Chat started! Type 'exit' or 'quit' to end the conversation.\n")
        print("Ask any Altoviz related question or task to the agent.\n")

        # Conversation loop
        while True:
            user_input = input("You: ").strip()

            if user_input.lower() in ['exit', 'quit', 'bye']:
                print("\nGoodbye!")
                break

            if not user_input:
                continue

            print("\nAgent is thinking...\n")

            # Run the agent with streaming
            try:
                response_text = ""
                async for message in agent.run_stream(task=user_input):
                    if hasattr(message, 'content') and message.content:
                        response_text = message.content

                # Print the final response
                if response_text:
                    print(f"Agent: {response_text}\n")
                else:
                    print("Agent: I encountered an issue processing your request.\n")

            except Exception as e:
                print(f"Agent: Sorry, I encountered an error: {str(e)}\n")

if __name__ == "__main__":
    asyncio.run(main())
```

## Conclusion

You now have an Autogen assistant wired into Altoviz through Composio's Tool Router and MCP. From here you can:
- Add more toolkits to the toolkits list, for example notion or hubspot
- Refine the agent description to point it at specific workflows
- Wrap this script behind a UI, Slack bot, or internal tool
Once the pattern is clear for Altoviz, you can reuse the same structure for other MCP-enabled apps with minimal code changes.

## How to build Altoviz MCP Agent with another framework

- [Claude Code](https://composio.dev/toolkits/altoviz/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/altoviz/framework/claude-cowork)
- [OpenAI Agents SDK](https://composio.dev/toolkits/altoviz/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/altoviz/framework/claude-agents-sdk)
- [Codex](https://composio.dev/toolkits/altoviz/framework/codex)
- [OpenClaw](https://composio.dev/toolkits/altoviz/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/altoviz/framework/hermes-agent)
- [Atomic Agent](https://composio.dev/toolkits/altoviz/framework/atomic-agent)
- [Google ADK](https://composio.dev/toolkits/altoviz/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/altoviz/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/altoviz/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/altoviz/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/altoviz/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/altoviz/framework/crew-ai)
- [Pydantic AI](https://composio.dev/toolkits/altoviz/framework/pydantic-ai)

## Related Toolkits

- [Stripe](https://composio.dev/toolkits/stripe) - Stripe is a global online payments platform offering APIs for managing payments, customers, and subscriptions. Trusted by businesses for secure, efficient, and scalable payment processing worldwide.
- [44API](https://composio.dev/toolkits/44api) - 44API is an API service for validating VAT and tax identifiers and returning company details. Use it to verify business tax data and manage account IP whitelists quickly.
- [Airwallex](https://composio.dev/toolkits/airwallex) - Airwallex is a global financial platform providing business accounts, payments, payouts, FX, and cards. Built to simplify cross-border payments and streamline financial operations for businesses.
- [Aiwyn Tax MCP](https://composio.dev/toolkits/aiwyn_tax_mcp) - Aiwyn Tax MCP is a tax estimation service powered by Aiwyn's federal and state tax engine. It helps teams estimate tax outcomes without building tax calculation logic from scratch.
- [Alpaca](https://composio.dev/toolkits/alpaca) - Alpaca is a stock and crypto trading platform for commission-free trading, real-time market data, and algorithmic strategies. Use it to build brokerage apps, trading bots, and portfolio workflows with market connectivity.
- [Alpha vantage](https://composio.dev/toolkits/alpha_vantage) - Alpha Vantage is a financial data platform offering real-time and historical stock market APIs. Get instant, reliable access to equities, forex, and technical analysis data for smarter trading decisions.
- [Benzinga](https://composio.dev/toolkits/benzinga) - Benzinga provides real-time financial news and data APIs for market coverage. It helps you track breaking news and actionable market insights instantly.
- [Bigdata.com MCP](https://composio.dev/toolkits/bigdata_com_mcp) - Bigdata.com MCP provides grounded access to financial news, transcripts, filings, and entity intelligence. Ideal for building research workflows and generating timely market insights.
- [Billsby](https://composio.dev/toolkits/billsby) - Billsby is a subscription billing platform for managing customers, subscriptions, invoices, products, plans, usage counters, add-ons, and allowances. It helps SaaS and subscription teams automate billing operations without building complex billing logic from scratch.
- [Brex](https://composio.dev/toolkits/brex) - Brex provides corporate credit cards and spend management tailored for startups and tech businesses. It helps optimize company cash flow, streamline accounting, and accelerate business growth.
- [Cashfree Payments MCP](https://composio.dev/toolkits/cashfree_payments_mcp) - Cashfree Payments MCP is a merchant payments platform that handles collection, payouts, subscriptions, settlements, refunds, and identity verification. Simplifies merchant money lifecycle management with unified, API-driven workflows.
- [Chaser](https://composio.dev/toolkits/chaser) - Chaser is accounts receivable automation software that sends invoice reminders and helps businesses get paid faster. It streamlines the collections process to save time and improve cash flow.
- [Clarity AI MCP](https://composio.dev/toolkits/clarity_ai_mcp) - Clarity AI MCP is an MCP toolkit for simulating SFDR 2.0 fund classifications from a fund name, ISIN, or CUSIP. Use it to tap Clarity AI disclosure data and modeling without building custom sustainability-data workflows.
- [Clientary](https://composio.dev/toolkits/clientary) - Clientary is a platform for managing clients, invoices, projects, proposals, and more. It streamlines client work and saves you serious admin time.
- [Coinbase](https://composio.dev/toolkits/coinbase) - Coinbase is a platform for buying, selling, and storing cryptocurrency. It makes exchanging and managing crypto simple and secure for everyone.
- [Coinbase Agents MCP](https://composio.dev/toolkits/coinbase_agents_mcp) - Coinbase Agents MCP is Coinbase's managed toolkit exposing accounts, portfolios, orders, fills, and market data. Use it to let authorized agents inspect holdings, execute trades, perform transfers, and handle payments.
- [Coinbase Wallet MCP](https://composio.dev/toolkits/coinbase_wallet_mcp) - Coinbase Wallet MCP is Coinbase's wallet service for interacting with onchain accounts. Use it to give agents secure, structured access to inspect wallets and request onchain actions.
- [Coinranking](https://composio.dev/toolkits/coinranking) - Coinranking is a comprehensive cryptocurrency market data platform offering access to real-time coin prices, market caps, and historical data. Get accurate, up-to-date stats for thousands of digital assets in one place.
- [Coupa](https://composio.dev/toolkits/coupa) - Coupa is a business spend management platform for procurement, invoicing, and expenses. It helps organizations streamline purchasing, control costs, and gain complete visibility over financial operations.
- [CurrencyScoop](https://composio.dev/toolkits/currencyscoop) - CurrencyScoop is a developer-friendly API for real-time and historical currency exchange rates. Easily access fiat and crypto data for smart, up-to-date financial applications.

## Frequently Asked Questions

### What are the differences in Tool Router MCP and Altoviz MCP?

With a standalone Altoviz MCP server, the agents and LLMs can only access a fixed set of Altoviz tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Altoviz and many other apps based on the task at hand, all through a single MCP endpoint.

### Can I use Tool Router MCP with Autogen?

Yes, you can. Autogen fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right Altoviz tools.

### Can I manage the permissions and scopes for Altoviz while using Tool Router?

Yes, absolutely. You can configure which Altoviz scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

### How safe is my data with Composio Tool Router?

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your Altoviz data and credentials are handled as safely as possible.

---
[See all toolkits](https://composio.dev/toolkits) · [Composio docs](https://docs.composio.dev/llms.txt)
