# How to integrate Dadata ru MCP with Pydantic AI

```json
{
  "title": "How to integrate Dadata ru MCP with Pydantic AI",
  "toolkit": "Dadata ru",
  "toolkit_slug": "dadata_ru",
  "framework": "Pydantic AI",
  "framework_slug": "pydantic-ai",
  "url": "https://composio.dev/toolkits/dadata_ru/framework/pydantic-ai",
  "markdown_url": "https://composio.dev/toolkits/dadata_ru/framework/pydantic-ai.md",
  "updated_at": "2026-05-12T10:08:11.466Z"
}
```

## Introduction

This guide walks you through connecting Dadata ru to Pydantic AI using the Composio tool router. By the end, you'll have a working Dadata ru agent that can clean and standardize this russian address, validate and parse a user's full name, check if this passport number is valid through natural language commands.
This guide will help you understand how to give your Pydantic AI agent real control over a Dadata ru account through Composio's Dadata ru MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate Dadata ru with

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

## TL;DR

Here's what you'll learn:
- How to set up your Composio API key and User ID
- How to create a Composio Tool Router session for Dadata ru
- How to attach an MCP Server to a Pydantic AI agent
- How to stream responses and maintain chat history
- How to build a simple REPL-style chat interface to test your Dadata ru workflows

## What is Pydantic AI?

Pydantic AI is a Python framework for building AI agents with strong typing and validation. It leverages Pydantic's data validation capabilities to create robust, type-safe AI applications.
Key features include:
- Type Safety: Built on Pydantic for automatic data validation
- MCP Support: Native support for Model Context Protocol servers
- Streaming: Built-in support for streaming responses
- Async First: Designed for async/await patterns

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

The Dadata ru MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Dadata ru account. It provides structured and secure access to DaData’s powerful data validation and enrichment APIs, so your agent can perform actions like standardizing addresses, cleaning contact details, parsing names, and retrieving company or bank information on your behalf.
- Accurate address standardization and parsing: Instantly clean and structure messy Russian addresses or retrieve address details using identifiers like cadastral numbers or FIAS IDs.
- Email, phone, and passport validation: Let your agent validate and clean raw email addresses, phone numbers, or Russian passport numbers to ensure your data is correct and safe to use.
- Full name parsing and gender detection: Automatically break down full names (FIO), identify gender, and get grammatical declensions to power advanced personalization or document processing.
- Vehicle and car brand data enrichment: Extract structured vehicle details and fetch comprehensive car brand information by code for registration or verification workflows.
- Bank information retrieval: Quickly find complete bank details by BIC, SWIFT, INN, or registration numbers, streamlining financial processes and verifications.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `DADATA_RU_CLEAN_ADDRESS` | Clean Address | Clean and standardize a Russian postal address. Converts a free-form address string into a structured object with parsed components (region, city, street, house, etc.), geographic coordinates, postal code, and quality indicators. Useful for address validation, geocoding, and data normalization. |
| `DADATA_RU_CLEAN_BIRTHDATE` | Clean Birthdate | Standardize and validate birthdate strings. Accepts various formats (DD.MM.YYYY, M/D/YY, Russian text dates) and normalizes to DD.MM.YYYY. Returns quality code indicating parse success. |
| `DADATA_RU_CLEAN_EMAIL` | Clean Email | Standardize and validate an email address. Fixes typos in domains (e.g., 'gnail.con' → 'gmail.com'), validates format, and classifies as PERSONAL, CORPORATE, ROLE, or DISPOSABLE. Use to clean user-provided emails before storing or sending mail. |
| `DADATA_RU_CLEAN_NAME` | Clean Name (FIO) | Tool to standardize and parse full names (FIO), detect gender, and return grammatical cases. Use when you need structured name parsing and declensions from raw FIO inputs. |
| `DADATA_RU_CLEAN_PASSPORT` | Clean Passport | Tool to validate a Russian passport number against the official registry. Use after collecting passport details. |
| `DADATA_RU_CLEAN_PHONE` | Clean Phone | Tool to standardize and validate phone numbers. Use when you need to convert arbitrary phone inputs into a uniform, validated 11-digit format for further processing. |
| `DADATA_RU_CLEAN_RECORD` | Clean Composite Record | Tool to standardize composite records with multiple contact data fields in a single request. Use when you need to clean records containing combinations of name, address, phone, email, passport, birthdate, or vehicle data. More efficient than calling individual clean actions separately for multi-field records. |
| `DADATA_RU_CLEAN_VEHICLE` | Clean Vehicle | Standardize and recognize vehicle make/model from free-form text input. Returns normalized brand and model names with a quality confidence code. Use this to clean user-entered vehicle descriptions like 'ford focus' or 'land r0ver'. |
| `DADATA_RU_FIND_ADDRESS` | Find Address | Retrieve full Russian address details by FIAS ID, KLADR code, or cadastral number. Returns structured data including postal code, region, city, street, coordinates, and administrative codes (OKATO, OKTMO, tax office). Use this when you have an address identifier and need the complete address breakdown. |
| `DADATA_RU_FIND_BANK` | Find Bank | Tool to find bank by BIC, SWIFT, INN, or registration number. Use when you need full bank details for a specific identifier. Provide optional KPP for branch-level queries. |
| `DADATA_RU_FIND_CAR_BRAND` | Find Car Brand | Find car brand details by identifier. Returns brand information including English and Russian names. Use this when you have a car brand ID (like 'FORD', 'BMW', 'TOYOTA') and need its details. For autocomplete/search by partial name, use suggest_car_brand instead. |
| `DADATA_RU_FIND_COMPANY_BY_EMAIL` | Find Company By Email | Find companies by corporate email address domain. Extracts company registration details including INN, OGRN, name, location, and business activity from the email domain. |
| `DADATA_RU_FIND_COUNTRY` | Find Country | Tool to find country details by ISO or numeric code. Use when you have a valid country code and need full metadata. |
| `DADATA_RU_FIND_COURT_BY_ID` | Find Court by ID | Find court by ID or code. Returns court details including name, address, and jurisdiction. Use when you have a specific court code and need complete court information. |
| `DADATA_RU_FIND_CURRENCY` | Find Currency | Tool to find currency details by ISO 4217 code. Use when you have a currency code and need its full metadata. |
| `DADATA_RU_FIND_DELIVERY` | Find Delivery City IDs | Retrieves delivery service city identifiers (CDEK, Boxberry, DPD) for a given Russian city by KLADR code or FIAS ID. Use this tool when integrating with Russian delivery services and you need to map a city to the corresponding IDs used by CDEK, Boxberry, or DPD. Returns an empty suggestions list if the city is not found. |
| `DADATA_RU_FIND_FIAS_BY_ID` | Find Address by FIAS ID | Find address by FIAS ID from the Federal Information Address System (FIAS/GAR). Returns structured address details including postal code, region, city, street, coordinates, and administrative codes. Use when you have a FIAS GUID and need the complete address breakdown. |
| `DADATA_RU_FIND_FMS_UNIT` | Find FMS Unit | Look up Russian passport issuing authority (FMS unit) by subdivision code. Returns all departments associated with the given code (e.g., main office, passport desks). Use SUGGEST_FMS_UNIT action for text-based search by name. |
| `DADATA_RU_FIND_FNS_UNIT` | Find FNS Unit by Code | Find Russian tax inspection (FNS unit) by exact code or INN. Returns inspection details including address, contact info, payment details, and parent unit information. Use SUGGEST_FNS_UNIT action for text-based search by name. |
| `DADATA_RU_FIND_FTS_UNIT` | Find FTS Unit | Find a Russian Federal Customs Service (FTS) unit by its 8-digit code. Returns detailed information including the unit's name, address, contact details (phone, fax, email), and registration numbers (INN, OGRN, OKPO). Use this when you need to look up customs office details by a known code. |
| `DADATA_RU_FIND_MEDICAL_POSITION_BY_ID` | Find Medical Position By ID | Tool to find medical position by ID code. Use when you have a medical position ID and need its full name and details. |
| `DADATA_RU_FIND_MKTU` | Find MKTU | Look up MKTU (International Classification of Goods and Services/Nice Classification) items by their numeric code. Returns detailed information including class number, item number, and names in Russian, English, and French. Use this when you have a specific MKTU code and need its full details. For searching by keywords/descriptions, use the suggest_mktu action instead. |
| `DADATA_RU_FIND_OKPD2_BY_ID` | Find OKPD2 by ID | Look up OKPD2 (Russian Classification of Products by Economic Activity) entries by their exact code. Use this to get the official name, section, and classification details for a known OKPD2 code. Returns the section, index, code, and description of the product classification. For searching by product name/description, use the suggest_okpd2 action instead. |
| `DADATA_RU_FIND_OKPDTR_POSITION` | Find OKPDTR Position | Find job position by OKPDTR code. Returns position name and tariff grade. Use this to retrieve official position title and classification details for a known OKPDTR code. |
| `DADATA_RU_FIND_OKPDTR_PROFESSION` | Find OKPDTR Profession | Tool to find profession details by OKPDTR code. Returns profession name and tariff grade from the All-Russian Classifier of Worker Professions. Use when you have an OKPDTR code and need full profession metadata. |
| `DADATA_RU_FIND_OKTMO_BY_ID` | Find Territory by OKTMO | Find Russian municipal territory by OKTMO code. Returns municipality name and administrative hierarchy (district and settlement levels). Use when you have a specific OKTMO code and need to look up the corresponding territory details. |
| `DADATA_RU_FIND_OKVED2` | Find OKVED2 | Look up OKVED2 (Russian Classification of Economic Activities) entries by their exact code. Use this to get the official name and classification details for a known OKVED2 code. Returns the section, index, and description of the economic activity. For searching by activity name/description, use the suggest_okved2 action instead. |
| `DADATA_RU_FIND_PARTY` | Find Company or Entrepreneur | Find company or individual entrepreneur details by INN or OGRN from the Russian Federal Tax Service registry. Returns full registration data including legal name, address, status, management, and organizational form. Use KPP parameter to filter by specific branch. |
| `DADATA_RU_FIND_PARTY_BY` | Find Belarus Party by UNP | Tool to find a Belarusian company or entrepreneur by UNP. Use when you have the UNP and need the full registry record. Example: "Find party by UNP = 190657494". |
| `DADATA_RU_FIND_PARTY_KZ` | Find Kazakhstan Company by BIN | Look up Kazakhstan company or entrepreneur details by BIN (Business Identification Number). Returns registration data including name, address, director, activity codes, and classification codes. Use when you have a 12-digit BIN and need official registry information for a KZ entity. |
| `DADATA_RU_FIND_POSTAL_OFFICE` | Find Postal Office | Find Russian postal office details by postal code (index). Returns office name, address, type, and activation date. Use when you need to look up postal office information for a specific postal code. |
| `DADATA_RU_FIND_POSTAL_UNIT_BY_ID` | Find Postal Unit By ID | Find postal unit by postal code. Returns postal office details including address and schedule. Use when you have a specific postal code and need complete information about that postal office location. |
| `DADATA_RU_GEOLOCATE_ADDRESS` | Geolocate Address | Tool to find nearest addresses by geographic coordinates. Use when you need address suggestions around a specific location. |
| `DADATA_RU_GEOLOCATE_POSTAL_UNIT` | Geolocate Postal Unit | Tool to find nearest postal units by geographic coordinates. Use when you need to locate post offices near a specific location. |
| `DADATA_RU_GET_PROFILE_BALANCE` | Get Profile Balance | Tool to retrieve current DaData account balance. Use before making API calls that consume funds. |
| `DADATA_RU_GET_PROFILE_STATISTICS` | Get Profile Statistics | Tool to get daily aggregated usage statistics per DaData API service. Use when you need a breakdown of calls and remaining balances for a specific date. |
| `DADATA_RU_GET_REFERENCE_VERSIONS` | Get Reference Versions | Tool to retrieve the last update dates for DaData reference datasets (FIAS, EGRUL, banks, etc.). Use before performing operations that depend on the currency of reference data. |
| `DADATA_RU_IP_LOCATE_ADDRESS` | IP Locate Address | Geolocate a Russian IP address to determine its city/region. Returns detailed location data including postal code, city, region, federal district, timezone, and coordinates. Only works for IP addresses registered in Russia; non-Russian IPs will return null. Accuracy is 60-80%. |
| `DADATA_RU_SUGGEST_ADDRESS` | Suggest Address | Tool to autocomplete and suggest addresses. Use when user types partial address fragments to retrieve possible address completions. |
| `DADATA_RU_SUGGEST_BANK` | Suggest Bank | Tool to autocomplete and suggest banks by partial details. Use when you need to find Russian banks by name, BIC, INN, SWIFT, or registry number. |
| `DADATA_RU_SUGGEST_CAR_BRAND` | Suggest Car Brand | Tool to suggest car brands. Use when you need to autocomplete or correct partial car brand names in Russian or English. |
| `DADATA_RU_SUGGEST_COUNTRY` | Suggest Country | Tool to suggest countries based on user input. Use when you need country autocompletion or search. |
| `DADATA_RU_SUGGEST_COURT` | Suggest Court | Tool to suggest Russian courts by name or location. Use when user types partial court name or provides filters to retrieve possible court suggestions. |
| `DADATA_RU_SUGGEST_CURRENCY` | Suggest Currency | Tool to suggest currencies by ISO 4217 code or name. Use when you need currency autocompletion. |
| `DADATA_RU_SUGGEST_EMAIL` | Suggest Email | Tool to autocomplete and suggest email addresses. Use when user provides an email prefix and you need possible completions. |
| `DADATA_RU_SUGGEST_FIAS` | Suggest FIAS Address | Tool to suggest addresses from FIAS/GAR database. Use when you need official Russian addresses that strictly match the federal address system (FIAS/GAR). |
| `DADATA_RU_SUGGEST_FMS_UNIT` | Suggest FMS Unit | Tool to autocomplete and suggest passport issuing authorities. Use when you need to lookup Russian FMS units by partial code or name. |
| `DADATA_RU_SUGGEST_FNS_UNIT` | Suggest FNS Unit | Tool to suggest Russian tax inspection units by partial name or code. Use when you need to identify a tax inspection authority from incomplete user input. For example, use query='7700' to retrieve units with code 7700. |
| `DADATA_RU_SUGGEST_FTS_UNIT` | Suggest FTS Unit | Tool to autocomplete and suggest Russian customs (FTS) units. Use when user provides partial name or code to retrieve matching offices. |
| `DADATA_RU_SUGGEST_MEDICAL_POSITION` | Suggest Medical Position | Tool to autocomplete and suggest medical positions and specialties. Use when you need to find medical worker positions by partial name or code. |
| `DADATA_RU_SUGGEST_METRO` | Suggest Metro | Tool to suggest metro stations. Use when you need to autocomplete metro station names in Russian cities. |
| `DADATA_RU_SUGGEST_MKTU` | Suggest MKTU | Autocomplete and search for MKTU (Nice Classification) codes used for trademark registration. MKTU is the International Classification of Goods and Services for trademark purposes. Use this to find class codes and item numbers by searching names in Russian, English, or by class number. Returns multilingual names (Russian, English, French) and classification codes. |
| `DADATA_RU_SUGGEST_NAME` | Suggest Name | Tool to autocomplete and suggest full names (FIO). Use when user types partial name fragments to retrieve possible full name completions. |
| `DADATA_RU_SUGGEST_OKPD2` | Suggest OKPD2 | Tool to autocomplete and suggest Russian product classification codes (OKPD2). Use when you need to find or validate OKPD2 codes by partial queries. |
| `DADATA_RU_SUGGEST_OKPDTR_POSITION` | Suggest OKPDTR Position | Tool to autocomplete and suggest Russian job positions from OKPDTR classifier. Use when you need to find or validate OKPDTR position codes by partial queries. |
| `DADATA_RU_SUGGEST_OKPDTR_PROFESSION` | Suggest OKPDTR Profession | Tool to autocomplete and suggest professions from OKPDTR classifier. Use when you need to find profession codes and names by partial queries. |
| `DADATA_RU_SUGGEST_OKTMO` | Suggest OKTMO | Suggest Russian municipal territory codes (OKTMO) by code prefix or partial name. OKTMO (Общероссийский классификатор территорий муниципальных образований) is a classifier for Russian municipal territories. Use this tool to: - Autocomplete OKTMO codes when user starts typing a code prefix (e.g., '45' for Moscow) - Look up a specific OKTMO code to get territory details - Search for municipalities by partial code match Returns district (area) and settlement (subarea) information for each match. |
| `DADATA_RU_SUGGEST_OKVED2` | Suggest OKVED2 | Tool to suggest OKVED2 codes by text query. Use when you have a fragment of a Russian economic activity code or name and need structured suggestions. |
| `DADATA_RU_SUGGEST_PARTY` | Suggest Party | Tool to autocomplete and suggest Russian companies or entrepreneurs. Use when you have a partial name, INN, OGRN, or address and need structured suggestions. |
| `DADATA_RU_SUGGEST_PARTY_BY` | Suggest Belarus Party | Tool to autocomplete and suggest Belarusian companies or entrepreneurs. Use when you have a partial name, UNP, or address and need structured suggestions from Belarus EGRUL registry. |
| `DADATA_RU_SUGGEST_PARTY_KZ` | Suggest Kazakhstan Company | Tool to autocomplete and suggest Kazakhstan companies or entrepreneurs. Use when you have a partial company name, BIN, or address and need structured suggestions from Kazakhstan business registry. |
| `DADATA_RU_SUGGEST_POSTAL_OFFICE` | Suggest Postal Office | Suggests Russian Post offices by postal code or address. Returns postal code, address, and schedule. Use for autocompleting postal codes or finding post office details like working hours and location. |
| `DADATA_RU_SUGGEST_POSTAL_UNIT` | Suggest Postal Unit | Suggests Russian Post offices (Почта России) by postal code or address. Use for autocompleting postal codes, finding post offices by address fragments, or getting details like working hours and location coordinates. |

## Supported Triggers

None listed.

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

The Dadata ru MCP server is an implementation of the Model Context Protocol that connects your AI agent to Dadata ru. It provides structured and secure access so your agent can perform Dadata ru operations on your behalf through a secure, permission-based interface.
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

Before starting, make sure you have:
- Python 3.9 or higher
- A Composio account with an active API key
- Basic familiarity with Python and async programming

### 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 the required libraries.
What's happening:
- composio connects your agent to external SaaS tools like Dadata ru
- pydantic-ai lets you create structured AI agents with tool support
- python-dotenv loads your environment variables securely from a .env file
```bash
pip install composio pydantic-ai python-dotenv
```

### 3. Set up environment variables

Create a .env file in your project root.
What's happening:
- COMPOSIO_API_KEY authenticates your agent to Composio's API
- USER_ID associates your session with your account for secure tool access
- OPENAI_API_KEY to access OpenAI LLMs
```bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here
OPENAI_API_KEY=your_openai_api_key
```

### 4. Import dependencies

What's happening:
- We load environment variables and import required modules
- Composio manages connections to Dadata ru
- MCPServerStreamableHTTP connects to the Dadata ru MCP server endpoint
- Agent from Pydantic AI lets you define and run the AI assistant
```python
import asyncio
import os
from dotenv import load_dotenv
from composio import Composio
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStreamableHTTP

load_dotenv()
```

### 5. Create a Tool Router Session

What's happening:
- We're creating a Tool Router session that gives your agent access to Dadata ru tools
- The create method takes the user ID and specifies which toolkits should be available
- The returned session.mcp.url is the MCP server URL that your agent will use
```python
async def main():
    api_key = os.getenv("COMPOSIO_API_KEY")
    user_id = os.getenv("USER_ID")
    if not api_key or not user_id:
        raise RuntimeError("Set COMPOSIO_API_KEY and USER_ID in your environment")

    # Create a Composio Tool Router session for Dadata ru
    composio = Composio(api_key=api_key)
    session = composio.create(
        user_id=user_id,
        toolkits=["dadata_ru"],
    )
    url = session.mcp.url
    if not url:
        raise ValueError("Composio session did not return an MCP URL")
```

### 6. Initialize the Pydantic AI Agent

What's happening:
- The MCP client connects to the Dadata ru endpoint
- The agent uses GPT-5 to interpret user commands and perform Dadata ru operations
- The instructions field defines the agent's role and behavior
```python
# Attach the MCP server to a Pydantic AI Agent
dadata_ru_mcp = MCPServerStreamableHTTP(url, headers={"x-api-key": COMPOSIO_API_KEY})
agent = Agent(
    "openai:gpt-5",
    toolsets=[dadata_ru_mcp],
    instructions=(
        "You are a Dadata ru assistant. Use Dadata ru tools to help users "
        "with their requests. Ask clarifying questions when needed."
    ),
)
```

### 7. Build the chat interface

What's happening:
- The agent reads input from the terminal and streams its response
- Dadata ru API calls happen automatically under the hood
- The model keeps conversation history to maintain context across turns
```python
# Simple REPL with message history
history = []
print("Chat started! Type 'exit' or 'quit' to end.\n")
print("Try asking the agent to help you with Dadata ru.\n")

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", flush=True)

    async with agent.run_stream(user_input, message_history=history) as stream_result:
        collected_text = ""
        async for chunk in stream_result.stream_output():
            text_piece = None
            if isinstance(chunk, str):
                text_piece = chunk
            elif hasattr(chunk, "delta") and isinstance(chunk.delta, str):
                text_piece = chunk.delta
            elif hasattr(chunk, "text"):
                text_piece = chunk.text
            if text_piece:
                collected_text += text_piece
        result = stream_result

    print(f"Agent: {collected_text}\n")
    history = result.all_messages()
```

### 8. Run the application

What's happening:
- The asyncio loop launches the agent and keeps it running until you exit
```python
if __name__ == "__main__":
    asyncio.run(main())
```

## Complete Code

```python
import asyncio
import os
from dotenv import load_dotenv
from composio import Composio
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStreamableHTTP

load_dotenv()

async def main():
    api_key = os.getenv("COMPOSIO_API_KEY")
    user_id = os.getenv("USER_ID")
    if not api_key or not user_id:
        raise RuntimeError("Set COMPOSIO_API_KEY and USER_ID in your environment")

    # Create a Composio Tool Router session for Dadata ru
    composio = Composio(api_key=api_key)
    session = composio.create(
        user_id=user_id,
        toolkits=["dadata_ru"],
    )
    url = session.mcp.url
    if not url:
        raise ValueError("Composio session did not return an MCP URL")

    # Attach the MCP server to a Pydantic AI Agent
    dadata_ru_mcp = MCPServerStreamableHTTP(url, headers={"x-api-key": COMPOSIO_API_KEY})
    agent = Agent(
        "openai:gpt-5",
        toolsets=[dadata_ru_mcp],
        instructions=(
            "You are a Dadata ru assistant. Use Dadata ru tools to help users "
            "with their requests. Ask clarifying questions when needed."
        ),
    )

    # Simple REPL with message history
    history = []
    print("Chat started! Type 'exit' or 'quit' to end.\n")
    print("Try asking the agent to help you with Dadata ru.\n")

    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", flush=True)

        async with agent.run_stream(user_input, message_history=history) as stream_result:
            collected_text = ""
            async for chunk in stream_result.stream_output():
                text_piece = None
                if isinstance(chunk, str):
                    text_piece = chunk
                elif hasattr(chunk, "delta") and isinstance(chunk.delta, str):
                    text_piece = chunk.delta
                elif hasattr(chunk, "text"):
                    text_piece = chunk.text
                if text_piece:
                    collected_text += text_piece
            result = stream_result

        print(f"Agent: {collected_text}\n")
        history = result.all_messages()

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

## Conclusion

You've built a Pydantic AI agent that can interact with Dadata ru through Composio's Tool Router. With this setup, your agent can perform real Dadata ru actions through natural language.
You can extend this further by:
- Adding other toolkits like Gmail, HubSpot, or Salesforce
- Building a web-based chat interface around this agent
- Using multiple MCP endpoints to enable cross-app workflows (for example, Gmail + Dadata ru for workflow automation)
This architecture makes your AI agent "agent-native", able to securely use APIs in a unified, composable way without custom integrations.

## How to build Dadata ru MCP Agent with another framework

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

## Related Toolkits

- [Excel](https://composio.dev/toolkits/excel) - Microsoft Excel is a robust spreadsheet application for organizing, analyzing, and visualizing data. It's the go-to tool for calculations, reporting, and flexible data management.
- [21risk](https://composio.dev/toolkits/_21risk) - 21RISK is a web app built for easy checklist, audit, and compliance management. It streamlines risk processes so teams can focus on what matters.
- [Abstract](https://composio.dev/toolkits/abstract) - Abstract provides a suite of APIs for automating data validation and enrichment tasks. It helps developers streamline workflows and ensure data quality with minimal effort.
- [Addressfinder](https://composio.dev/toolkits/addressfinder) - Addressfinder is a data quality platform for verifying addresses, emails, and phone numbers. It helps you ensure accurate customer and contact data every time.
- [Agentql](https://composio.dev/toolkits/agentql) - Agentql is a toolkit that connects AI agents to the web using a specialized query language. It enables structured web interaction and data extraction for smarter automations.
- [Agenty](https://composio.dev/toolkits/agenty) - Agenty is a web scraping and automation platform for extracting data and automating browser tasks—no coding needed. It streamlines data collection, monitoring, and repetitive online actions.
- [Ambee](https://composio.dev/toolkits/ambee) - Ambee is an environmental data platform providing real-time, hyperlocal APIs for air quality, weather, and pollen. Get precise environmental insights to power smarter decisions in your apps and workflows.
- [Ambient weather](https://composio.dev/toolkits/ambient_weather) - Ambient Weather is a platform for personal weather stations with a robust API for accessing local, real-time, and historical weather data. Get detailed environmental insights directly from your own sensors for smarter apps and automations.
- [Anonyflow](https://composio.dev/toolkits/anonyflow) - Anonyflow is a service for encryption-based data anonymization and secure data sharing. It helps organizations meet GDPR, CCPA, and HIPAA data privacy compliance requirements.
- [Api ninjas](https://composio.dev/toolkits/api_ninjas) - Api ninjas offers 120+ public APIs spanning categories like weather, finance, sports, and more. Developers use it to supercharge apps with real-time data and actionable endpoints.
- [Api sports](https://composio.dev/toolkits/api_sports) - Api sports is a comprehensive sports data platform covering 2,000+ competitions with live scores and 15+ years of stats. Instantly access up-to-date sports information for analysis, apps, or chatbots.
- [Apify](https://composio.dev/toolkits/apify) - Apify is a cloud platform for building, deploying, and managing web scraping and automation tools called Actors. It lets you automate data extraction and workflow tasks at scale—no infrastructure headaches.
- [Autom](https://composio.dev/toolkits/autom) - Autom is a lightning-fast search engine results data platform for Google, Bing, and Brave. Developers use it to access fresh, low-latency SERP data on demand.
- [Beaconchain](https://composio.dev/toolkits/beaconchain) - Beaconchain is a real-time analytics platform for Ethereum 2.0's Beacon Chain. It provides detailed insights into validators, blocks, and overall network performance.
- [Big data cloud](https://composio.dev/toolkits/big_data_cloud) - BigDataCloud provides APIs for geolocation, reverse geocoding, and address validation. Instantly access reliable location intelligence to enhance your applications and workflows.
- [Bigpicture io](https://composio.dev/toolkits/bigpicture_io) - BigPicture.io offers APIs for accessing detailed company and profile data. Instantly enrich your applications with up-to-date insights on 20M+ businesses.
- [Bitquery](https://composio.dev/toolkits/bitquery) - Bitquery is a blockchain data platform offering indexed, real-time, and historical data from 40+ blockchains via GraphQL APIs. Get unified, reliable access to complex on-chain data for analytics, trading, and research.
- [Brightdata](https://composio.dev/toolkits/brightdata) - Brightdata is a leading web data platform offering advanced scraping, SERP APIs, and anti-bot tools. It lets you collect public web data at scale, bypassing blocks and friction.
- [Builtwith](https://composio.dev/toolkits/builtwith) - BuiltWith is a web technology profiler that uncovers the technologies powering any website. Gain actionable insights into analytics, hosting, and content management stacks for smarter research and lead generation.
- [Byteforms](https://composio.dev/toolkits/byteforms) - Byteforms is an all-in-one platform for creating forms, managing submissions, and integrating data. It streamlines workflows by centralizing form data collection and automation.

## Frequently Asked Questions

### What are the differences in Tool Router MCP and Dadata ru MCP?

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

### Can I use Tool Router MCP with Pydantic AI?

Yes, you can. Pydantic AI 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 Dadata ru tools.

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

Yes, absolutely. You can configure which Dadata ru 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 Dadata ru data and credentials are handled as safely as possible.

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