How to integrate Centralstationcrm MCP with Pydantic AI

Connect Pydantic AI to Centralstationcrm MCP. Add new company to crm contacts, log a sales opportunity for a client, and more using natural language, with authentication handled for you.

Centralstationcrm logoCentralstationcrm
Api Key

CentralStationCRM is an easy-to-use CRM software focused on collaboration and long-term customer relationships. It helps teams manage contacts, deals, and communications all in one place.

186 Tools

Introduction

This guide walks you through connecting Centralstationcrm to Pydantic AI using the Composio tool router. By the end, you'll have a working Centralstationcrm agent that can manage people and companies, track deals and projects, create tasks and calendar events, add comments, and search your records through natural language commands.

This guide will help you understand how to give your Pydantic AI agent real control over a Centralstationcrm account through Composio's Centralstationcrm MCP server.

Before we dive in, let's take a quick look at the key ideas and tools involved.

Also integrate Centralstationcrm with

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

The Centralstationcrm MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Centralstationcrm account. It provides structured and secure access to your customer relationship data, so your agent can perform actions like managing contacts, creating deals, updating company records, and tracking key interactions on your behalf.

  • Automated contact management: Quickly add new people to your CRM, update their details, and ensure your contact database stays current without manual entry.
  • Company and organization creation: Effortlessly create new company records so you can keep your account-based selling and organization tracking up-to-date.
  • Deal tracking and creation: Instantly log new sales opportunities by creating deals linked to your contacts or companies, helping your team stay on top of the pipeline.
  • Detailed relationship enrichment: Add addresses, assistants, avatars, and contact details to people in your CRM, making every customer profile richer and more actionable.
  • Milestone and history recording: Record important life events or milestones (like birthdays or anniversaries) for each person to boost relationship management and personalized outreach.

What is the Composio tool router, and how does it fit here?

What is Composio SDK?

Composio's Composio SDK helps agents find the right tools for a task at runtime. You can plug in multiple toolkits (like Gmail, HubSpot, and GitHub), and the agent will identify the relevant app and action to complete multi-step workflows. This can reduce token usage and improve the reliability of tool calls. Read more here: Getting started with Composio SDK

The tool router generates a secure MCP URL that your agents can access to perform actions.

How the Composio SDK works

The Composio SDK follows a three-phase workflow:

  1. Discovery: Searches for tools matching your task and returns relevant toolkits with their details.
  2. Authentication: Checks for active connections. If missing, creates an auth config and returns a connection URL via Auth Link.
  3. Execution: Executes the action using the authenticated connection.

Step-by-step Guide

Step by step09 STEPS
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
2

Getting API Keys for OpenAI and Composio

OpenAI API Key
  • Go to the OpenAI dashboard 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.
  • Navigate to your API settings and generate a new API key.
  • Store this key securely as you'll need it for authentication.
3

Install dependencies

bash
pip install composio pydantic-ai python-dotenv

Install the required libraries.

What's happening:

  • composio connects your agent to external SaaS tools like Centralstationcrm
  • pydantic-ai lets you create structured AI agents with tool support
  • python-dotenv loads your environment variables securely from a .env file
4

Set up environment variables

bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here
OPENAI_API_KEY=your_openai_api_key

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
5

Import dependencies

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()
What's happening:
  • We load environment variables and import required modules
  • Composio manages connections to Centralstationcrm
  • MCPServerStreamableHTTP connects to the Centralstationcrm MCP server endpoint
  • Agent from Pydantic AI lets you define and run the AI assistant
6

Create a Tool Router Session

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 Centralstationcrm
    composio = Composio(api_key=api_key)
    session = composio.create(
        user_id=user_id,
        toolkits=["centralstationcrm"],
    )
    url = session.mcp.url
    if not url:
        raise ValueError("Composio session did not return an MCP URL")
What's happening:
  • We're creating a Tool Router session that gives your agent access to Centralstationcrm 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
7

Initialize the Pydantic AI Agent

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

Build the chat interface

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 Centralstationcrm.\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()
What's happening:
  • The agent reads input from the terminal and streams its response
  • Centralstationcrm API calls happen automatically under the hood
  • The model keeps conversation history to maintain context across turns
9

Run the application

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

Complete Code

Here's the complete code to get you started with Centralstationcrm and Pydantic AI:

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 Centralstationcrm
    composio = Composio(api_key=api_key)
    session = composio.create(
        user_id=user_id,
        toolkits=["centralstationcrm"],
    )
    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
    centralstationcrm_mcp = MCPServerStreamableHTTP(url, headers={"x-api-key": COMPOSIO_API_KEY})
    agent = Agent(
        "openai:gpt-5",
        toolsets=[centralstationcrm_mcp],
        instructions=(
            "You are a Centralstationcrm assistant. Use Centralstationcrm 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 Centralstationcrm.\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 Centralstationcrm through Composio's Tool Router. With this setup, your agent can perform real Centralstationcrm 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 + Centralstationcrm for workflow automation)
This architecture makes your AI agent "agent-native", able to securely use APIs in a unified, composable way without custom integrations.
TOOLS

Supported Tools

Every Centralstationcrm action and event your agent gets out of the box.

Check Connection

Tool to verify the connection status of the CentralStationCRM API key.

Count Activities

Retrieve an activities count, optionally filtered by person, company, deal, project, or account.

Count Attachments

Tool to retrieve the total count and total file size of attachments.

Count Avatars

Tool to retrieve the total count and total file size of avatars in the system.

Count Companies External Emails

Tool to retrieve the total amount of external emails for a specific company.

Count Deals External Emails

Tool to retrieve the total amount of external emails for a specific deal.

Count External Emails

Tool to retrieve the total amount of external emails.

Count People with Filters

Tool to retrieve the total count of people with optional filtering capabilities.

Count People External Emails

Tool to retrieve the total amount of external emails for a specific person.

Count Projects External Emails

Tool to retrieve the total amount of external emails for a specific project.

Count Protocols

Tool to retrieve the total number of protocols in the account.

Create Attachments

Tool to create a new attachment in CentralStationCRM.

Create Calendar Event

Tool to create a new calendar event in CentralStationCRM.

Create Calendar Event Attendee

Tool to create a calendar event attendee.

Create Comment

Tool to create a new comment on an entity (task, event, protocol, etc.

Create Company with Nested Attributes

Tool to create a company with nested attributes.

Create Company Avatar

Tool to create an avatar for a company.

Create Company Protocol Attachment

Tool to create an attachment for a company protocol in CentralStationCRM.

Create Company Address

Tool to create a new address for a specific company.

Create Company Contact Detail

Tool to create a new contact detail for a specific company.

Create Custom Field Type

Tool to create a new custom field type in CentralStationCRM.

Create Deal Protocol Attachment

Tool to create an attachment for a deal protocol.

Create Deal

Tool to create a new deal in CentralStationCRM.

Create Group Calendar

Tool to create a new group calendar in CentralStationCRM.

Create Hook

Tool to create a webhook hook in CentralStationCRM.

Create People

Tool to create a person with nested attributes.

Create People Custom Field

Tool to create a custom field for a person record.

Create People Positions

Tool to create a new position for a specific person.

Create Person Protocol Attachment

Tool to create an attachment for a person protocol in CentralStationCRM.

Create People Tags

Tool to create a new tag for a specific person.

Create Person Address

Create a new postal address for a specific person.

Create Person Assistant

Tool to create a new assistant (assi) entry for a specific person.

Create Person Avatar

Tool to create a new avatar for a specific person.

Create Person Contact Detail

Tool to create a new contact detail for a specific person.

Create Person Historic Event

Tool to create a new historic event for a specific person.

Create Project

Tool to create a new project record.

Create Project Protocol Attachment

Tool to create an attachment for a project protocol in CentralStationCRM.

Create Protocol

Tool to create a new protocol entry.

Create Protocol Attachment

Tool to create an attachment for a protocol in CentralStationCRM.

Create Tag

Tool to create a new tag for a person, company, or deal.

Create Task

Tool to create a new task record.

Delete Attachments

Tool to delete an attachment by ID.

Delete Avatar

Tool to delete an avatar by its ID.

Delete Calendar Event

Tool to delete a calendar event by ID.

Delete Calendar Event Attendee

Tool to delete a calendar event attendee by ID.

Delete Comment

Tool to delete a comment by its ID.

Delete Company Avatar

Tool to delete a company's avatar by its ID.

Delete Company Contact Detail

Tool to delete a contact detail of a company.

Delete Company Protocol Attachment

Tool to delete a specific attachment from a company protocol.

Delete Company

Tool to delete a company record by ID.

Delete Company Address

Tool to delete a company's address by its ID.

Delete Custom Field Type

Tool to delete a custom field type by ID.

Delete Deal

Tool to delete a deal record by ID.

Delete Deal Protocol Attachment

Tool to delete a specific attachment from a deal protocol.

Delete Group Calendar

Tool to delete a group calendar by ID.

Delete Hook

Tool to delete a webhook by ID.

Delete People Custom Fields

Tool to delete a person's custom field by its ID.

Delete People Positions

Tool to delete a position of a person by its ID.

Delete Person Protocol Attachment

Tool to delete a specific attachment from a person protocol.

Delete person

Tool to delete a person record by ID.

Delete Person Address

Tool to delete a person's address by its ID.

Delete Person Assi

Tool to delete an assi entry of a person.

Delete Person Avatar

Tool to delete a person's avatar by its ID.

Delete Person Contact Detail

Tool to delete a contact detail of a person.

Delete Person Historic Event

Tool to delete a historic event of a person by its ID.

Delete Person Tag

Tool to destroy a tag from a person by its ID.

Delete Project

Tool to delete a project record by ID.

Delete Project Protocol Attachment

Tool to delete a specific attachment from a project protocol.

Delete Protocol

Tool to delete a protocol by ID.

Delete Protocol Attachment

Tool to delete an attachment from a protocol.

Delete Task

Tool to delete a task by its ID.

Get Activity

Tool to retrieve details of a specific activity by its ID.

Get API User Maildrop

Tool to retrieve the current API user's maildrop for people and companies.

Get Attachment

Tool to retrieve details of a specific attachment by its ID.

Get Avatar

Tool to retrieve a specific avatar by its ID from CentralStationCRM.

Get Calendar Event

Tool to retrieve details of a specific calendar event by ID.

Get Calendar Event Attendee

Tool to retrieve details of a specific calendar event attendee by ID.

Get Comment

Tool to retrieve details of a specific comment by its ID.

Get Company Avatar

Tool to retrieve a specific avatar of a company by avatar ID.

Get Company Protocol Attachment

Tool to retrieve a specific attachment from a company protocol by its ID.

Get Company

Tool to retrieve details of a specific company by ID from CentralStationCRM.

Get Company Address

Tool to retrieve a specific address of a company by address ID.

Get Company Contact Detail

Tool to retrieve a specific contact detail by ID for a company.

Get Custom Fields Type

Tool to retrieve a custom field type by its ID.

Get Deal

Tool to retrieve details of a specific deal by its ID.

Get Deal Maildrop

Tool to retrieve the maildrop email address for a specific deal.

Get Deal Protocol Attachment

Tool to retrieve a specific attachment from a deal protocol.

Get Group Calendar

Tool to retrieve details of a specific group calendar by ID.

Get Hook

Tool to retrieve details of a specific webhook/hook by ID.

Get People Positions

Tool to retrieve a specific position for a person by ID.

Get Person Protocol Attachment

Tool to retrieve a specific attachment from a person protocol.

Get People Tags

Tool to retrieve a specific tag for a person by tag ID.

Get Person

Tool to retrieve details of a specific person by ID.

Get Person Address

Tool to retrieve a specific address of a person by address ID.

Get Person Addresses

Retrieve a page of addresses for a specific person.

Get Person Assi

Tool to retrieve a specific assistant (assi) entry for a person by their IDs.

Get Person Avatar

Tool to retrieve a specific avatar of a person by avatar ID.

Get Person Contact Detail

Tool to retrieve a specific contact detail by ID for a person.

Get Person Custom Field

Tool to retrieve a specific custom field for a person by custom field ID.

Get Person Historic Event

Tool to retrieve a specific historic event of a person by ID.

Get Project

Tool to retrieve details of a specific project by ID from CentralStationCRM.

Get Project Maildrop

Tool to retrieve the maildrop email address for a specific project.

Get Project Protocol Attachment

Tool to retrieve a specific attachment from a project protocol by its ID.

Get Protocol Attachment

Tool to retrieve a specific attachment from a protocol by its ID.

Get Stats Companies

Retrieve statistics about companies in your CRM.

Get Stats Deals

Retrieve deal statistics, including the total count and, when available, currency and sum.

Get Stats Projects

Retrieve project statistics, including the total count and, when available, total size.

Get Task

Tool to retrieve details of a specific task by its ID.

Get User

Tool to retrieve the current API user's details.

Get User By ID

Tool to retrieve details of a specific user by ID.

List Activities

Retrieve a paginated list of activities in CentralStationCRM, with optional filtering by person, company, deal, project, user, or account.

List Attachments

Retrieve a paginated list of attachments from CentralStationCRM for browsing.

List Avatars

Tool to retrieve all avatars from CentralStationCRM.

List Calendar Events

List a page of calendar events from the account, with optional filtering by date, state, or attributes.

List Calendar Event Attendees

List a page of attendees for a specific calendar event, with pagination and optional ordering and related-data includes.

List Comments

List a page of comments from the account, with pagination and ordering support.

List Companies

Tool to retrieve a paginated list of all companies from CentralStationCRM.

List Company Addresses

List a page of addresses for a specific company by its ID, with pagination and ordering support.

List Company Avatars

List avatars for a specific company.

List Company Contact Details

List contact details for a specific company.

List Companies External Emails

List external emails associated with a specific company in CentralStationCRM.

List Company Protocol Attachments

List attachments for a specific protocol within a company.

List Custom Fields Types

List an account's custom field types, with pagination and optional ID ordering.

List Deals

List deals with pagination, sorting, and filters such as tags, date ranges, and deal attributes.

List Deals External Emails

List external emails associated with a specific deal, with pagination and optional ordering.

List Deal Protocol Attachments

List attachments for a specific protocol within a deal, with optional pagination.

List External Emails

List external emails from CentralStationCRM with optional pagination, ordering, and inclusion of comments.

List Filter Groups

List CentralStationCRM filter groups with pagination, ordering, and filtering support.

List Group Calendars

List group calendars from the account with optional pagination and includes for related calendar events.

List Historic Events

List historic events from the CentralStationCRM account with optional filtering and pagination.

List Hooks

List and inspect the account's webhook configurations with optional pagination.

List People

Tool to retrieve a paginated list of all people from CentralStationCRM.

List People Assis

List assistant contacts associated with a specific person by ID, with pagination and ordering support.

List People Avatars

Tool to retrieve all avatars for a specific person.

List People Contact Details

List contact details for a specific person by ID, with pagination and ordering support.

List People Custom Fields

List custom fields for a specific person by ID from the dedicated custom fields endpoint, with pagination support.

List People External Emails

List external email communications associated with a specific person in CentralStationCRM, with pagination support.

List People Historic Events

List historic events for a specific person, including recorded milestone dates such as birthdays and anniversaries, with pagination support.

List People Positions

List job positions or company affiliations for a specific person.

List People Protocol Attachments

List attachments for a specific protocol within a person.

List People Tags

List tags for a specific person.

List Projects

Tool to retrieve a paginated list of all projects from CentralStationCRM.

List Projects External Emails

Retrieve a page of external emails associated with a specific CentralStationCRM project, with pagination and ordering support.

List Project Protocol Attachments

Retrieve a page of attachments associated with a specific protocol within a project, with pagination and ordering support.

List Protocols

List a page of protocols from CentralStationCRM, optionally filtering by person, company, deal, or project.

List Protocol Attachments

List a page of attachments associated with a specific protocol.

List Tags

List a page of tags from CentralStationCRM, optionally filtering by person, company, deal, or project.

List Tags 2

Tool to retrieve all tag names from CentralStationCRM.

List Tasks

Tool to retrieve a paginated list of all tasks from CentralStationCRM.

List Users

Tool to retrieve all users of the account from CentralStationCRM.

Merge Companies

Tool to merge multiple companies into an existing company by ID.

Merge Person

Tool to merge another person into an existing person by ID.

Search Attachments

Search for attachments in CentralStationCRM by filename.

Search Companies

Search for companies in CentralStationCRM by name, with pagination support.

Search Company Protocol Attachments

Tool to search for attachments within a specific protocol of a company.

Search Contact Details

Search for contact details in CentralStationCRM by name, email, phone, or other contact information, optionally selecting people or companies.

Search Deals

Search CentralStationCRM deals by name, including partial matches, and retrieve paginated results.

Search Deal Protocol Attachments

Search attachments within a specific deal protocol by filename, with optional pagination and related data.

Search People

Request a page of people from CentralStationCRM, optionally submitting a text query and page parameters.

Search Person Protocol Attachments

Tool to search for attachments within a specific person protocol in CentralStationCRM.

Search People V2

Search for people in CentralStationCRM by last name, first name, email address, or phone number.

Search Projects

Tool to search for projects in CentralStationCRM by name.

Search Project Protocol Attachments

Tool to search for attachments within a specific protocol of a project.

Search Records

Tool to retrieve search results from CentralStationCRM.

Search Users

Tool to search for users in CentralStationCRM by first name or last name.

Stats People

Retrieve statistics about people (contacts) in your CRM.

Update Calendar Event

Update an existing calendar event by ID, including its name, time, status, and other event details.

Update Calendar Event Attendee

Update a calendar event attendee by event and attendee ID.

Update Comment

Update an existing comment by ID.

Update Company

Update a company by ID, supplying its name and optionally its group, responsible user, or background.

Update Company Address

Tool to update a specific address of a company.

Update Company Contact Detail

Tool to update a contact detail for a company by ID.

Update Custom Field Type

Update a custom field type by ID.

Update Deal

Tool to update an existing deal record.

Update Group Calendar

Update an existing group calendar by ID, supplying its name, color, and read-only status.

Update People Custom Fields

Tool to update a person's custom field by its ID.

Update People Position

Tool to update a position for a specific person.

Update Person

Update an existing person by ID, including their name, title, gender, background, or responsible user.

Update Person Address

Tool to update a specific address of a person.

Update Person Assi

Tool to update an assi entry of a person.

Update Person Contact Detail

Tool to update a specific contact detail of a person by ID.

Update Person Historic Event

Tool to update a historic event of a person by ID.

Update Person Tag

Tool to update a tag on a person.

Update Project

Tool to update an existing project record.

Update Protocol

Update an existing protocol by ID, supplying its content and optionally modifying metadata or associations.

Update Task

Update an existing task by ID, supplying its name and responsible user ID.

FAQ

Frequently asked questions

Start with Centralstationcrm.It takes 30 seconds.

Managed auth, hosted MCP servers, and every Centralstationcrm tool your agent needs.Free to start.

Start building