How to Use the CTA MCP in OpenAI Agents SDK
Get live CTA bus and train data into your OpenAI Agent to build reliable, location-aware transit assistants.
Works with every AI agent you already use
…and any MCP-compatible client
Connect CTA MCP to OpenAI Agents SDK
Create your Vinkius account to connect CTA to OpenAI Agents SDK and route execution through our secure gateway. The platform manages server hosting, runtime updates, and security layers. Configuration requires no manual server provisioning.
Track Every Train and Bus in Chicago
Your agent gets a live view of the entire CTA network. Use `get_bus_vehicles` to see every active bus on a specific route or `get_train_positions` to pinpoint all trains on the Red Line. You're not guessing based on a schedule; you're getting real-time latitude and longitude coordinates, speed, and heading for every vehicle. This is the ground truth for any transit application. Your OpenAI Agent can use this data to build live maps, calculate dynamic ETAs, or monitor fleet distribution. The `get_route_status` tool gives a quick summary of system health, so your agent knows if there are widespread delays before it even starts planning a trip.
Build a Better Transit App with an OpenAI Agent
Stop scraping websites or using stale GTFS data. The `get_bus_predictions` and `get_train_arrivals` tools connect your agent directly to the CTA's real-time prediction engine. It returns arrival times in minutes, vehicle IDs, and even tells you if the prediction is based on a schedule or live tracking. Your agent can answer "When's the next bus?" with confidence. First, it can use `get_bus_stops` to find the right stop ID for a route. Then, it calls for predictions. This MCP Server handles the connection, so your agent just focuses on giving the user a straight answer.
Handle Delays and Reroutes Like a Local
Nothing's worse than a "scheduled" arrival for a train that isn't running. The `get_service_alerts` tool gives your agent access to official disruption notices, from track work to street festivals. It provides descriptions, severity, and detour info. When your OpenAI Agent plans a trip, it can first check `get_service_alerts` for the specific route. This lets it proactively find alternatives or just warn the user about a delay. It's the difference between a useful assistant and one that just reads a schedule. This is a key feature for any serious transit tool using this MCP.
Set up CTA MCP in OpenAI Agents SDK
Prerequisites
- Python 3.10+ installed
-
openai-agentspackage (pip install openai-agents) - Active Vinkius subscription with a valid endpoint token
- 1
Install the SDK
Run
pip install openai-agentsto install the OpenAI Agents SDK. The MCP integration is built-in — no extra dependencies needed. - 2
Connect via SSE transport
Use
MCPServerSsewith your Vinkius endpoint URL. Replace[YOUR_TOKEN_HERE]with your token from cloud.vinkius.com. The SDK auto-discovers all CTA tools at runtime. - 3
Create your Agent
Pass the MCP to
Agent(mcp_servers=[server]). The agent receives CTA tools as native definitions — JSON schemas resolve automatically. - 4
Run the agent
Call
Runner.run(agent, prompt)to execute. The agent invokes the appropriate CTA tools and returns structured results. Copy the full example on the right to get started.
import asyncio
from agents import Agent, Runner
from agents.mcp import MCPServerSse
async def main():
async with MCPServerSse(
url="https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
) as server:
agent = Agent(
name="CTA Agent",
instructions="You have access to CTA tools.",
mcp_servers=[server],
)
result = await Runner.run(agent, "List recent transactions")
print(result.final_output)
asyncio.run(main()) Independent Platform Disclaimer: Vinkius is an independent platform and is not affiliated with, endorsed by, sponsored by, verified by, or otherwise authorized by CTA. All third-party trademarks, logos, and brand names are the property of their respective owners. Their use on this website is strictly for informational purposes to identify service compatibility and interoperability.
Why Choose Vinkius
Vinkius connects your tools to AI with real-time monitoring and automatic cost savings — all from one dashboard.
Real-time monitoring
Live
visibility into every interaction
Connect your favorite tools to your AI and see exactly what's happening — every request, every response, in real time.
Built-in savings
60%
lower AI costs
Vinkius compresses data between your apps and your AI automatically. Lower bills every month — no configuration required.
Single dashboard
One
place for every integration
Every tool your AI connects to, managed from a single screen. One account, complete control.
Common questions about CTA MCP in OpenAI Agents SDK
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the CTA MCP today
We host it, we monitor it, we maintain it. You just paste one token.