4,500+ servers built on MCP Fusion
Vinkius
MTA logo
Vinkius
Mastra AI logo

How to Use the MTA MCP in Mastra AI

Build resilient transit workflows with Mastra AI and real-time MTA feeds.

See Vinkius in Action

Works with every AI agent you already use

…and any MCP-compatible client

MTA MCP on Cursor AI Code Editor MCP Client MTA MCP on Claude Desktop App MCP Integration MTA MCP on OpenAI Agents SDK MCP Compatible MTA MCP on Visual Studio Code MCP Extension Client MTA MCP on GitHub Copilot AI Agent MCP Integration MTA MCP on Google Gemini AI MCP Integration MTA MCP on Lovable AI Development MCP Client MTA MCP on Mistral AI Agents MCP Compatible MTA MCP on Amazon AWS Bedrock MCP Support
MCP Servers - Free for Subscribers
Mastra AI

Connect MTA MCP to Mastra AI

Create your Vinkius account to connect MTA to Mastra AI and route execution through our secure gateway. The platform manages server hosting, runtime updates, and security layers. Configuration requires no manual server provisioning.

GDPR Free for Subscribers

Automate Complex Commuter Workflows

The MTA MCP Server gives your Mastra AI agents direct access to the entire New York transit grid. You build a workflow that starts by checking `get_service_alerts` every morning at 7 AM. If the agent finds a delay on the 4 train, it branches the logic. It immediately triggers `get_bus_predictions` to find a street-level alternative. Transit APIs are notoriously flaky. Mastra handles the network failures. If `get_subway_feed` times out during rush hour, your workflow automatically retries with exponential backoff. The user gets their commute plan without seeing the underlying API struggle.

Cross-Reference Regional Rail Data

Pulling `get_lirr_feed` lets your agent cross-reference regional rail data for commuters crossing county lines. The workflow matches it against `get_subway_feed` for their connection at Penn Station. It calculates the transfer window using `get_system_time` as the baseline. Metro-North works exactly the same way. Calling `get_metro_north_feed` returns track assignments and delays for trains heading into Grand Central. The agent parses the schedule deviations and decides if the user needs to leave the house earlier.

Pinpoint Bus Locations in Mastra AI

Chaining `get_bus_routes` and `get_bus_stops` pinpoints exact bus locations. The agent verifies the line exists, then finds the exact intersection. Once it has the stop ID, it executes `get_bus_vehicle_at_stop` to see if a bus is actually approaching. System-wide tracking is also available. You can fire `get_bus_vehicles` to map every active bus in the five boroughs. If the data returns empty due to a dead zone, your Mastra workflow can fall back to `get_bus_estimated_arrival` to rely on the schedule instead of the GPS.

Setup guide

Set up MTA MCP in Mastra AI

Prerequisites

  • Node.js 18+ and a TypeScript project
  • @mastra/mcp + @mastra/core packages
  • Active Vinkius subscription with a valid endpoint token
  1. 1

    Install dependencies

    Run npm install @mastra/mcp @mastra/core plus your preferred model provider (e.g. @ai-sdk/openai).

  2. 2

    Configure the MCPClient

    Create an MCPClient with your Vinkius endpoint as a URL object. Replace [YOUR_TOKEN_HERE] with your token from cloud.vinkius.com.

  3. 3

    Discover and inject tools

    Call mcpClient.listTools() and spread the result into your agent's tools object. All MTA tools become native Mastra tools.

  4. 4

    Run with any model

    Swap openai("gpt-4o") for any AI SDK-compatible provider. Call agent.generate() and the agent routes tool calls through MCP automatically.

agent.ts
import { MCPClient } from "@mastra/mcp";
import { Agent } from "@mastra/core/agent";
import { openai } from "@ai-sdk/openai";

const mcpClient = new MCPClient({
  id: "mta-mcp-client",
  servers: {
    "mta-mcp": {
      url: new URL(
        "https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
      ),
    },
  },
});

const agent = new Agent({
  name: "MTA Agent",
  model: openai("gpt-4o"),
  instructions: "You have access to MTA tools.",
  tools: {
    ...(await mcpClient.listTools()),
  },
});

const result = await agent.generate(
  "List recent MTA transactions"
);
console.log(result.text);

Independent Platform Disclaimer: Vinkius is an independent platform and is not affiliated with, endorsed by, sponsored by, verified by, or otherwise authorized by MTA. 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 MTA MCP in Mastra AI

Install `@mastra/mcp` and instantiate a new `MCPClient` with the endpoint URL. Call `listTools()` and spread them into your agent's configuration. Mastra automatically detects if the MCP server transport is SSE or Streamable HTTP.
You build the caching into your Mastra workflow steps. Calling `get_bus_predictions` every five seconds will hit rate limits. Store the results in your workflow state and only poll again when the estimated arrival time approaches.
Mastra's built-in engine catches the error. You configure the workflow to retry the `get_subway_feed` call or branch to an alternative tool like `get_service_alerts` to see if the entire line is down.
No, transit data queries are inherently read-only. You can disable `requireToolApproval` for all 12 tools. The agent pulls the GTFS-RT data autonomously from the MCP server.
This MCP server processes route IDs, station codes, and geographic coordinates. Mastra sends the specific transit queries to the endpoint, which only retrieves public MTA schedules and positions. The server retains zero memory of who asked for the M15 bus schedule.

Start using the MTA MCP today

We host it, we monitor it, we maintain it. You just paste one token.

Built & Managed by Vinkius 30s setup 12 tools

We've already built the connector for MTA. Just plug in your AI agents and start using Vinkius.

No hosting. No infrastructure. No complex setup.
All 12 tools are live and waiting. You're up and running in seconds.

Claude Claude
ChatGPT ChatGPT
Cursor Cursor
Gemini Gemini
Windsurf Windsurf
VS Code VS Code
JetBrains JetBrains
Vercel Vercel
+ other MCP clients

Vinkius gives your AI agents access to the full catalog of app connectors, all fully managed, secure, and enterprise-ready. One subscription, every tool you need.

Zero hosting required Full MCP catalog included Enterprise-grade security Auto-updated by Vinkius

Built, hosted, and secured by Vinkius. You just connect and go.