# How to integrate Feathery MCP with Pydantic AI

```json
{
  "title": "How to integrate Feathery MCP with Pydantic AI",
  "toolkit": "Feathery",
  "toolkit_slug": "feathery",
  "framework": "Pydantic AI",
  "framework_slug": "pydantic-ai",
  "url": "https://composio.dev/toolkits/feathery/framework/pydantic-ai",
  "markdown_url": "https://composio.dev/toolkits/feathery/framework/pydantic-ai.md",
  "updated_at": "2026-11-06T09:15:09.581Z"
}
```

## Introduction

This guide walks you through connecting Feathery to Pydantic AI using the Composio tool router. By the end, you'll have a working Feathery agent that can browse forms and schemas, fill or sign document templates, create hidden fields, manage users, and review email logs through natural language commands.
This guide will help you understand how to give your Pydantic AI agent real control over a Feathery account through Composio's Feathery MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate Feathery with

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

## 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 Feathery
- 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 Feathery 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 Feathery MCP server, and what's possible with it?

The Feathery MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Feathery account. It provides structured and secure access to your forms and workflow data, so your agent can perform actions like creating hidden fields, retrieving form schemas, listing documents, and managing account settings on your behalf.
- Form discovery and management: Let your agent list all existing forms, retrieve specific form schemas, or permanently remove forms as needed.
- Document automation and signing: Automatically fill or sign document templates and track generated document envelopes for streamlined data processing.
- Hidden field configuration: Create new hidden fields or list all hidden fields within your forms for advanced workflow logic and data capture.
- Account and team management: Fetch detailed account info, update user roles and permissions, and manage your Feathery team's access seamlessly.
- Integration troubleshooting: List recent API connector errors tied to specific forms, making it easier to debug and maintain your integrations.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `FEATHERY_ACCOUNT_EDIT` | Edit Feathery Account | Tool to edit an existing account’s role and permissions. Use when modifying account settings after confirming identity. |
| `FEATHERY_ACCOUNT_GET_INFO` | Get Account Info | Tool to get your Feathery team name and list of accounts. Use when you need to fetch your team's account info. |
| `FEATHERY_DOCUMENT_FILL_TEMPLATE` | Fill or sign document template | Fill a mapped Feathery document template and optionally route it to an email address for signature. Returns a file URL, or a disabled indication with an empty URL when Feathery Documents is not enabled. |
| `FEATHERY_DOCUMENT_LIST_ENVELOPES` | List Document Envelopes | Tool to list generated document envelopes by document or user ID. Use when you need to retrieve envelope records for auditing or tracking. |
| `FEATHERY_FORM_CREATE_HIDDEN_FIELD` | Create hidden field | Create a hidden field in a Feathery account to store non-visible data such as tracking or integration metadata. DEPRECATED: This action uses Feathery's legacy hidden-field endpoint; use the newer /api/field/hidden/ endpoint instead. |
| `FEATHERY_FORM_DELETE` | Delete Form | Permanently delete a form from your Feathery account. This action is irreversible. Use the 'List Forms' action first to get valid form IDs. The form_id corresponds to the 'id' field in the form list response. |
| `FEATHERY_FORM_GET_SCHEMA` | Get form schema | Retrieve the schema of a Feathery form by its form ID, including its steps, fields, rules, integrations, and translations. Use it to understand the form's structure and configuration; the List Forms action can help find the ID. |
| `FEATHERY_FORM_LIST` | List Forms | Tool to list all forms in your Feathery account. Use when you need to view or filter available forms. |
| `FEATHERY_FORM_LIST_HIDDEN_FIELDS` | List Hidden Fields | Tool to list all hidden form fields in the account. Use when you need to retrieve hidden field configuration before processing form submissions. |
| `FEATHERY_LOG_LIST_API_CONNECTOR_ERRORS` | List API Connector Errors | List recent API connector error logs for a form, optionally filtered by time. An HTTP 404 is returned as an empty list, so an empty result does not distinguish a missing resource from no logs. |
| `FEATHERY_LOG_LIST_EMAIL_ISSUES` | List Email Issues | Tool to list email bounce and complaint events. Use when you need to diagnose delivery issues for sent emails. |
| `FEATHERY_LOG_LIST_EMAILS` | List Email Logs | List recently sent email integration logs for a form, optionally filtered by time. An HTTP 404 is returned as an empty list, so an empty result does not distinguish a missing resource from no logs. |
| `FEATHERY_LOG_LIST_QUICK_REQUESTS` | List Quik Request Logs | List recent Quik integration request logs for a form, optionally filtered by time. An HTTP 404 is returned as an empty list, so an empty result does not distinguish a missing resource from no logs. |
| `FEATHERY_USER_CREATE_OR_FETCH` | Create or Fetch User | Tool to create a new user or fetch an existing one. Use when you need to ensure a user exists and get their SDK key. |
| `FEATHERY_USER_DELETE` | Delete User | Tool to delete a specific user by ID. Use when you need to remove a user after confirming the user exists. |
| `FEATHERY_USER_GET_ALL_DATA` | Get All User Data | Retrieve all stored data fields for a user or all field definitions in your Feathery account. Use this to fetch form field values submitted by users, or to list all available field definitions. Returns field metadata including type, value, timestamps, and whether it's a hidden field. |
| `FEATHERY_USER_GET_SESSION` | Get User Session | Tool to get a user's form session and progress. Use after authenticating and when you need to retrieve session data. |
| `FEATHERY_USER_LIST` | List Users | Tool to list all users in your Feathery account. Use when you need to retrieve users with optional creation time or field-based filters. |
| `FEATHERY_WORKSPACE_GENERATE_LOGIN_TOKEN` | Generate Workspace Login Token | Generate a login JWT for a Feathery workspace. This is used for white-label integrations where users authenticate through your system and are automatically logged into Feathery. Prerequisites: - Obtain workspace_id from the list workspaces API or workspace creation - Obtain account_id from the 'Get Account Info' action The token is valid for 24 hours and can be refreshed by calling this endpoint again. Note: Returns empty token if workspaces feature is not enabled for the account. |

## Supported Triggers

None listed.

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

The Feathery MCP server is an implementation of the Model Context Protocol that connects your AI agent to Feathery. It provides structured and secure access so your agent can perform Feathery 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 Feathery
- 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 Feathery
- MCPServerStreamableHTTP connects to the Feathery 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 Feathery 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 Feathery
    composio = Composio(api_key=api_key)
    session = composio.create(
        user_id=user_id,
        toolkits=["feathery"],
    )
    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 Feathery endpoint
- The agent uses GPT-5 to interpret user commands and perform Feathery operations
- The instructions field defines the agent's role and behavior
```python
# Attach the MCP server to a Pydantic AI Agent
feathery_mcp = MCPServerStreamableHTTP(url, headers={"x-api-key": COMPOSIO_API_KEY})
agent = Agent(
    "openai:gpt-5",
    toolsets=[feathery_mcp],
    instructions=(
        "You are a Feathery assistant. Use Feathery 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
- Feathery 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 Feathery.\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 Feathery
    composio = Composio(api_key=api_key)
    session = composio.create(
        user_id=user_id,
        toolkits=["feathery"],
    )
    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
    feathery_mcp = MCPServerStreamableHTTP(url, headers={"x-api-key": COMPOSIO_API_KEY})
    agent = Agent(
        "openai:gpt-5",
        toolsets=[feathery_mcp],
        instructions=(
            "You are a Feathery assistant. Use Feathery 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 Feathery.\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 Feathery through Composio's Tool Router. With this setup, your agent can perform real Feathery 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 + Feathery 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 Feathery MCP Agent with another framework

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

## Related Toolkits

- [0CodeKit](https://composio.dev/toolkits/0codekit) - 0CodeKit is a utility API platform for AI, document, image, and data workflows. Use it to convert, validate, generate, store, and automate data without custom backend code.
- [Airtop](https://composio.dev/toolkits/airtop) - Airtop is a cloud browser platform for AI-powered web automation. Use it to navigate sites, extract data, and run reusable browser workflows.
- [Apify MCP](https://composio.dev/toolkits/apify_mcp) - Apify MCP is the official MCP server for Apify's web scraping and browser automation platform. Use it to run actors, collect structured web data, and automate crawling workflows.
- [Apilio](https://composio.dev/toolkits/apilio) - Apilio is a home automation platform that lets you connect and control smart devices from different brands. It helps you build flexible automations with complex conditions, schedules, and integrations.
- [Basin](https://composio.dev/toolkits/basin) - Basin is a no-code form backend for quickly setting up reliable contact forms. It lets you collect and manage form submissions without writing any server-side code.
- [Bika.ai](https://composio.dev/toolkits/bika) - Bika.ai is an AI automation database platform for managing spaces, teams, records, automations, and outgoing webhooks. It helps teams organize structured data and automate database-driven workflows in one place.
- [Botster](https://composio.dev/toolkits/botster) - Botster is a web automation service for running configurable data collection bots. Use it to collect structured web data without building and maintaining scrapers yourself.
- [Bouncer](https://composio.dev/toolkits/bouncer) - Bouncer is an email validation platform that verifies the authenticity of email addresses in real-time and batch. It helps boost deliverability and reduce bounce rates for your communications.
- [BrowserAct](https://composio.dev/toolkits/browseract) - BrowserAct is a hosted browser-automation service for running web workflows. Use it to execute repeatable browser tasks with templates, proxies, and APIs.
- [Celigo](https://composio.dev/toolkits/celigo) - Celigo is an integration platform as a service for connecting apps, data, and business workflows. It helps teams automate cross-system processes without building every integration from scratch.
- [CheckFlow](https://composio.dev/toolkits/checkflow) - CheckFlow is a workflow and checklist platform for repeatable processes, tasks, templates, teams, data sets, and automation. Use it to standardize operations, track process execution, and keep teams aligned.
- [Conveyor](https://composio.dev/toolkits/conveyor) - Conveyor is a platform that automates security reviews with a Trust Center and AI-driven questionnaire automation. It streamlines compliance and vendor security processes for faster, hassle-free reviews.
- [CrewAI](https://composio.dev/toolkits/crew_ai) - CrewAI is a platform for running deployed automations and managing AMP control-plane resources. Use it to automate workflows and centrally control SaaS automation resources.
- [Cronfree Time Scheduler](https://composio.dev/toolkits/cronfree_time_scheduler) - Cronfree Time Scheduler is an API-based scheduler for recurring webhook calls. Use it to create and remove timezone-aware schedules without running cron.
- [Crowdin](https://composio.dev/toolkits/crowdin) - Crowdin is a localization management platform that streamlines translation workflows and collaboration. It helps teams centralize multilingual content, boost productivity, and automate translation processes.
- [Databox](https://composio.dev/toolkits/databox) - Databox is a business analytics platform that connects your data from any tool and device. It helps you track KPIs, build dashboards, and discover actionable insights.
- [Detrack](https://composio.dev/toolkits/detrack) - Detrack is a delivery management platform for real-time tracking and proof of delivery. It helps businesses automate notifications and keep customers updated every step of the way.
- [Dify](https://composio.dev/toolkits/dify) - Dify is a platform for running and managing published workflow apps via a Service API. Use it to execute workflows and inspect configuration and run history quickly.
- [Digital Humani](https://composio.dev/toolkits/digital_humani) - Digital Humani is a reforestation API for browsing planting projects, submitting tree requests, and tracking planted trees. It helps teams connect climate action directly to products, campaigns, and customer experiences.
- [Dnsfilter](https://composio.dev/toolkits/dnsfilter) - Dnsfilter is a cloud-based DNS security and content filtering solution. It helps organizations block online threats and manage safe internet access with ease.

## Frequently Asked Questions

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

With a standalone Feathery MCP server, the agents and LLMs can only access a fixed set of Feathery tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Feathery 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 Feathery tools.

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

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

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