Skip to main content
Planned Feature β€” Coming Soon

🚧 This feature is not yet released. The documentation below describes planned behavior and may change before launch.

Custom Tools & MCP Servers

Extend your agents with custom tools β€” connect to CRMs, databases, internal APIs, or any external service through MCP (Model Context Protocol).

What is MCP?​

MCP is an open standard for AI tool integration. Instead of hard-coding API calls, you register an MCP server that exposes tools. Your agents call these tools just like built-in ones.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Agent │────▢│ FlyMy.AI │────▢│ MCP Server │────▢│ Your Serviceβ”‚
β”‚ β”‚ β”‚ Platform β”‚ β”‚ β”‚ β”‚ (CRM, DB, β”‚
β”‚ │◀────│ │◀────│ │◀────│ API, etc.) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Setting Up an MCP Server​

Step 1: Register the Server​

from flymyai import AgentClient

client = AgentClient(api_key="fly-***")

mcp_server = client.mcp_servers.create(
name="Salesforce CRM",
url="https://mcp.yourcompany.com/salesforce",
connection_type="streamable_http",
auth={
"type": "bearer",
"token": "sf-access-token"
}
)

print(f"MCP Server registered: {mcp_server.id}")

Connection Types​

TypeProtocolBest For
streamable_httpHTTP streamingMost use cases (recommended)
sseServer-Sent EventsLegacy MCP servers

Step 2: Discover Available Tools​

tools = client.mcp_servers.list_tools(mcp_server.id)

for tool in tools:
print(f" {tool.name}: {tool.description}")
for param in tool.parameters:
print(f" - {param.name} ({param.type}): {param.description}")
  search_leads: Search leads by name, email, or company
- query (string): Search term
- limit (number): Max results (default: 10)
get_lead: Get detailed lead information
- lead_id (string): Salesforce lead ID
create_opportunity: Create a new sales opportunity
- lead_id (string): Associated lead
- value (number): Deal value
- stage (string): Pipeline stage
update_lead_status: Update lead status
- lead_id (string): Lead to update
- status (string): New status

Step 3: Bind Tools to an Agent​

Selectively enable the tools you need:

agent = client.agents.create(
name="Sales Pipeline Agent",
goal="""Process the sales lead {{ lead_name }} at {{ company }}.
1. Search for existing records in the CRM
2. Research the company online
3. Score the lead
4. {{#if auto_create}}Create an opportunity if the score is above 70{{/if}}
5. Return the profile and recommended actions""",

tools=["web_search", "browse_website"],

mcp_servers=[
{
"id": mcp_server.id,
"tools": ["search_leads", "get_lead", "create_opportunity"]
}
],

input_schema={
"type": "object",
"properties": {
"lead_name": {"type": "string", "description": "Lead's full name"},
"company": {"type": "string", "description": "Company name"},
"auto_create": {
"type": "boolean",
"default": False,
"description": "Automatically create opportunity for high-scoring leads"
}
},
"required": ["lead_name", "company"]
}
)

Multiple MCP Servers​

Connect multiple services to a single agent:

# Register additional servers
slack_mcp = client.mcp_servers.create(
name="Slack",
url="https://mcp.yourcompany.com/slack",
connection_type="streamable_http",
auth={"type": "bearer", "token": "slack-token"}
)

jira_mcp = client.mcp_servers.create(
name="Jira",
url="https://mcp.yourcompany.com/jira",
connection_type="streamable_http",
auth={"type": "bearer", "token": "jira-token"}
)

# Agent uses all three
support_agent = client.agents.create(
name="Support Triage Agent",
goal="""Triage the support request from {{ customer_name }}:
1. Look up customer in CRM
2. Check for existing Jira tickets
3. Create a new ticket if needed
4. Notify the #support Slack channel""",

tools=["web_search"],
mcp_servers=[
{"id": mcp_server.id, "tools": ["search_leads", "get_lead"]},
{"id": jira_mcp.id, "tools": ["search_issues", "create_issue"]},
{"id": slack_mcp.id, "tools": ["send_message"]}
],

input_schema={
"type": "object",
"properties": {
"customer_name": {"type": "string"},
"issue_description": {"type": "string", "format": "textarea"}
},
"required": ["customer_name", "issue_description"]
}
)

Managing MCP Servers​

# List all registered servers
servers = client.mcp_servers.list()

# Update authentication
client.mcp_servers.update(
mcp_server_id=mcp_server.id,
auth={"type": "bearer", "token": "new-rotated-token"}
)

# Delete a server
client.mcp_servers.delete(mcp_server_id=mcp_server.id)

Security Considerations​

  • Token rotation β€” rotate MCP server auth tokens regularly
  • Least privilege β€” only bind the specific tools each agent needs
  • Private agents β€” agents with MCP tools connected to internal services should stay visibility: "private"
  • Audit events β€” monitor run events to see exactly which MCP tools were called and with what arguments

Next Steps​