# How to integrate Dadata ru MCP with OpenAI Agents SDK

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

## Introduction

This guide walks you through connecting Dadata ru to the OpenAI Agents SDK 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 OpenAI Agents SDK 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

- [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:
- Get and set up your OpenAI and Composio API keys
- Install the necessary dependencies
- Initialize Composio and create a Tool Router session for Dadata ru
- Configure an AI agent that can use Dadata ru as a tool
- Run a live chat session where you can ask the agent to perform Dadata ru operations

## What is OpenAI Agents SDK?

The OpenAI Agents SDK is a lightweight framework for building AI agents that can use tools and maintain conversation state. It provides a simple interface for creating agents with hosted MCP tool support.
Key features include:
- Hosted MCP Tools: Connect to external services through hosted MCP endpoints
- SQLite Sessions: Persist conversation history across interactions
- Simple API: Clean interface with Agent, Runner, and tool configuration
- Streaming Support: Real-time response streaming for interactive applications

## 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:
- Composio API Key and OpenAI API Key
- Primary know-how of OpenAI Agents SDK
- A live Dadata ru project
- Some knowledge of Python or Typescript

### 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).
- Go to Settings and copy your API key.

### 2. Install dependencies

Install the Composio SDK and the OpenAI Agents SDK.
```python
pip install composio_openai_agents openai-agents python-dotenv
```

```typescript
npm install @composio/openai-agents @openai/agents dotenv
```

### 3. Set up environment variables

Create a .env file and add your OpenAI and Composio API keys.
```bash
OPENAI_API_KEY=sk-...your-api-key
COMPOSIO_API_KEY=your-api-key
USER_ID=composio_user@gmail.com
```

### 4. Import dependencies

What's happening:
- You're importing all necessary libraries.
- The Composio and OpenAIAgentsProvider classes are imported to connect your OpenAI agent to Composio tools like Dadata ru.
```python
import asyncio
import os
from dotenv import load_dotenv

from composio import Composio
from composio_openai_agents import OpenAIAgentsProvider
from agents import Agent, Runner, HostedMCPTool, SQLiteSession
```

```typescript
import 'dotenv/config';
import { Composio } from '@composio/core';
import { OpenAIAgentsProvider } from '@composio/openai-agents';
import { Agent, hostedMcpTool, run, OpenAIConversationsSession } from '@openai/agents';
import * as readline from 'readline';
```

### 5. Set up the Composio instance

No description provided.
```python
load_dotenv()

api_key = os.getenv("COMPOSIO_API_KEY")
user_id = os.getenv("USER_ID")

if not api_key:
    raise RuntimeError("COMPOSIO_API_KEY is not set. Create a .env file with COMPOSIO_API_KEY=your_key")

# Initialize Composio
composio = Composio(api_key=api_key, provider=OpenAIAgentsProvider())
```

```typescript
dotenv.config();

const composioApiKey = process.env.COMPOSIO_API_KEY;
const userId = process.env.USER_ID;

if (!composioApiKey) {
  throw new Error('COMPOSIO_API_KEY is not set. Create a .env file with COMPOSIO_API_KEY=your_key');
}
if (!userId) {
  throw new Error('USER_ID is not set');
}

// Initialize Composio
const composio = new Composio({
  apiKey: composioApiKey,
  provider: new OpenAIAgentsProvider(),
});
```

### 6. Create a Tool Router session

What is happening:
- You give the Tool Router the user id and the toolkits you want available. Here, it is only dadata_ru.
- The router checks the user's Dadata ru connection and prepares the MCP endpoint.
- The returned session.mcp.url is the MCP URL that your agent will use to access Dadata ru.
- This approach keeps things lightweight and lets the agent request Dadata ru tools only when needed during the conversation.
```python
# Create a Dadata ru Tool Router session
session = composio.create(
    user_id=user_id,
    toolkits=["dadata_ru"]
)

mcp_url = session.mcp.url
```

```typescript
// Create Tool Router session for Dadata ru
const session = await composio.create(userId as string, {
  toolkits: ['dadata_ru'],
});
const mcpUrl = session.mcp.url;
```

### 7. Configure the agent

No description provided.
```python
# Configure agent with MCP tool
agent = Agent(
    name="Assistant",
    model="gpt-5",
    instructions=(
        "You are a helpful assistant that can access Dadata ru. "
        "Help users perform Dadata ru operations through natural language."
    ),
    tools=[
        HostedMCPTool(
            tool_config={
                "type": "mcp",
                "server_label": "tool_router",
                "server_url": mcp_url,
                "headers": {"x-api-key": api_key},
                "require_approval": "never",
            }
        )
    ],
)
```

```typescript
// Configure agent with MCP tool
const agent = new Agent({
  name: 'Assistant',
  model: 'gpt-5',
  instructions:
    'You are a helpful assistant that can access Dadata ru. Help users perform Dadata ru operations through natural language.',
  tools: [
    hostedMcpTool({
      serverLabel: 'tool_router',
      serverUrl: mcpUrl,
      headers: { 'x-api-key': composioApiKey },
      requireApproval: 'never',
    }),
  ],
});
```

### 8. Start chat loop and handle conversation

No description provided.
```python
print("\nComposio Tool Router session created.")

chat_session = SQLiteSession("conversation_openai_toolrouter")

print("\nChat started. Type your requests below.")
print("Commands: 'exit', 'quit', or 'q' to end\n")

async def main():
    try:
        result = await Runner.run(
            agent,
            "What can you help me with?",
            session=chat_session
        )
        print(f"Assistant: {result.final_output}\n")
    except Exception as e:
        print(f"Error: {e}\n")

    while True:
        user_input = input("You: ").strip()
        if user_input.lower() in {"exit", "quit", "q"}:
            print("Goodbye!")
            break

        result = await Runner.run(
            agent,
            user_input,
            session=chat_session
        )
        print(f"Assistant: {result.final_output}\n")

asyncio.run(main())
```

```typescript
// Keep conversation state across turns
const conversationSession = new OpenAIConversationsSession();

// Simple CLI
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  prompt: 'You: ',
});

console.log('\nComposio Tool Router session created.');
console.log('\nChat started. Type your requests below.');
console.log("Commands: 'exit', 'quit', or 'q' to end\n");

try {
  const first = await run(agent, 'What can you help me with?', { session: conversationSession });
  console.log(`Assistant: ${first.finalOutput}\n`);
} catch (e) {
  console.error('Error:', e instanceof Error ? e.message : e, '\n');
}

rl.prompt();

rl.on('line', async (userInput) => {
  const text = userInput.trim();

  if (['exit', 'quit', 'q'].includes(text.toLowerCase())) {
    console.log('Goodbye!');
    rl.close();
    process.exit(0);
  }

  if (!text) {
    rl.prompt();
    return;
  }

  try {
    const result = await run(agent, text, { session: conversationSession });
    console.log(`\nAssistant: ${result.finalOutput}\n`);
  } catch (e) {
    console.error('Error:', e instanceof Error ? e.message : e, '\n');
  }

  rl.prompt();
});

rl.on('close', () => {
  console.log('\n👋 Session ended.');
  process.exit(0);
});
```

## Complete Code

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

from composio import Composio
from composio_openai_agents import OpenAIAgentsProvider
from agents import Agent, Runner, HostedMCPTool, SQLiteSession

load_dotenv()

api_key = os.getenv("COMPOSIO_API_KEY")
user_id = os.getenv("USER_ID")

if not api_key:
    raise RuntimeError("COMPOSIO_API_KEY is not set. Create a .env file with COMPOSIO_API_KEY=your_key")

# Initialize Composio
composio = Composio(api_key=api_key, provider=OpenAIAgentsProvider())

# Create Tool Router session
session = composio.create(
    user_id=user_id,
    toolkits=["dadata_ru"]
)
mcp_url = session.mcp.url

# Configure agent with MCP tool
agent = Agent(
    name="Assistant",
    model="gpt-5",
    instructions=(
        "You are a helpful assistant that can access Dadata ru. "
        "Help users perform Dadata ru operations through natural language."
    ),
    tools=[
        HostedMCPTool(
            tool_config={
                "type": "mcp",
                "server_label": "tool_router",
                "server_url": mcp_url,
                "headers": {"x-api-key": api_key},
                "require_approval": "never",
            }
        )
    ],
)

print("\nComposio Tool Router session created.")

chat_session = SQLiteSession("conversation_openai_toolrouter")

print("\nChat started. Type your requests below.")
print("Commands: 'exit', 'quit', or 'q' to end\n")

async def main():
    try:
        result = await Runner.run(
            agent,
            "What can you help me with?",
            session=chat_session
        )
        print(f"Assistant: {result.final_output}\n")
    except Exception as e:
        print(f"Error: {e}\n")

    while True:
        user_input = input("You: ").strip()
        if user_input.lower() in {"exit", "quit", "q"}:
            print("Goodbye!")
            break

        result = await Runner.run(
            agent,
            user_input,
            session=chat_session
        )
        print(f"Assistant: {result.final_output}\n")

asyncio.run(main())
```

```typescript
import 'dotenv/config';
import { Composio } from '@composio/core';
import { OpenAIAgentsProvider } from '@composio/openai-agents';
import { Agent, hostedMcpTool, run, OpenAIConversationsSession } from '@openai/agents';
import * as readline from 'readline';

const composioApiKey = process.env.COMPOSIO_API_KEY;
const userId = process.env.USER_ID;

if (!composioApiKey) {
  throw new Error('COMPOSIO_API_KEY is not set. Create a .env file with COMPOSIO_API_KEY=your_key');
}
if (!userId) {
  throw new Error('USER_ID is not set');
}

// Initialize Composio
const composio = new Composio({
  apiKey: composioApiKey,
  provider: new OpenAIAgentsProvider(),
});

async function main() {
  // Create Tool Router session
  const session = await composio.create(userId as string, {
    toolkits: ['dadata_ru'],
  });
  const mcpUrl = session.mcp.url;

  // Configure agent with MCP tool
  const agent = new Agent({
    name: 'Assistant',
    model: 'gpt-5',
    instructions:
      'You are a helpful assistant that can access Dadata ru. Help users perform Dadata ru operations through natural language.',
    tools: [
      hostedMcpTool({
        serverLabel: 'tool_router',
        serverUrl: mcpUrl,
        headers: { 'x-api-key': composioApiKey },
        requireApproval: 'never',
      }),
    ],
  });

  // Keep conversation state across turns
  const conversationSession = new OpenAIConversationsSession();

  // Simple CLI
  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: 'You: ',
  });

  console.log('\nComposio Tool Router session created.');
  console.log('\nChat started. Type your requests below.');
  console.log("Commands: 'exit', 'quit', or 'q' to end\n");

  try {
    const first = await run(agent, 'What can you help me with?', { session: conversationSession });
    console.log(`Assistant: ${first.finalOutput}\n`);
  } catch (e) {
    console.error('Error:', e instanceof Error ? e.message : e, '\n');
  }

  rl.prompt();

  rl.on('line', async (userInput) => {
    const text = userInput.trim();

    if (['exit', 'quit', 'q'].includes(text.toLowerCase())) {
      console.log('Goodbye!');
      rl.close();
      process.exit(0);
    }

    if (!text) {
      rl.prompt();
      return;
    }

    try {
      const result = await run(agent, text, { session: conversationSession });
      console.log(`\nAssistant: ${result.finalOutput}\n`);
    } catch (e) {
      console.error('Error:', e instanceof Error ? e.message : e, '\n');
    }

    rl.prompt();
  });

  rl.on('close', () => {
    console.log('\nSession ended.');
    process.exit(0);
  });
}

main().catch((err) => {
  console.error('Fatal error:', err);
  process.exit(1);
});
```

## Conclusion

This was a starter code for integrating Dadata ru MCP with OpenAI Agents SDK to build a functional AI agent that can interact with Dadata ru.
Key features:
- Hosted MCP tool integration through Composio's Tool Router
- SQLite session persistence for conversation history
- Simple async chat loop for interactive testing
You can extend this by adding more toolkits, implementing custom business logic, or building a web interface around the agent.

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

- [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 OpenAI Agents SDK?

Yes, you can. OpenAI Agents SDK 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)
