# How to integrate Render MCP with Vercel AI SDK v6

```json
{
  "title": "How to integrate Render MCP with Vercel AI SDK v6",
  "toolkit": "Render",
  "toolkit_slug": "render",
  "framework": "Vercel AI SDK",
  "framework_slug": "ai-sdk",
  "url": "https://composio.dev/toolkits/render/framework/ai-sdk",
  "markdown_url": "https://composio.dev/toolkits/render/framework/ai-sdk.md",
  "updated_at": "2026-05-12T10:23:45.398Z"
}
```

## Introduction

This guide walks you through connecting Render to Vercel AI SDK v6 using the Composio tool router. By the end, you'll have a working Render agent that can deploy latest code to staging service, restart production web service now, get current status of all services through natural language commands.
This guide will help you understand how to give your Vercel AI SDK agent real control over a Render account through Composio's Render MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate Render with

- [ChatGPT](https://composio.dev/toolkits/render/framework/chatgpt)
- [OpenAI Agents SDK](https://composio.dev/toolkits/render/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/render/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/render/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/render/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/render/framework/codex)
- [Cursor](https://composio.dev/toolkits/render/framework/cursor)
- [VS Code](https://composio.dev/toolkits/render/framework/vscode)
- [OpenCode](https://composio.dev/toolkits/render/framework/opencode)
- [OpenClaw](https://composio.dev/toolkits/render/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/render/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/render/framework/cli)
- [Google ADK](https://composio.dev/toolkits/render/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/render/framework/langchain)
- [Mastra AI](https://composio.dev/toolkits/render/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/render/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/render/framework/crew-ai)

## TL;DR

Here's what you'll learn:
- How to set up and configure a Vercel AI SDK agent with Render integration
- Using Composio's Tool Router to dynamically load and access Render tools
- Creating an MCP client connection using HTTP transport
- Building an interactive CLI chat interface with conversation history management
- Handling tool calls and results within the Vercel AI SDK framework

## What is Vercel AI SDK?

The Vercel AI SDK is a TypeScript library for building AI-powered applications. It provides tools for creating agents that can use external services and maintain conversation state.
Key features include:
- streamText: Core function for streaming responses with real-time tool support
- MCP Client: Built-in support for Model Context Protocol via @ai-sdk/mcp
- Step Counting: Control multi-step tool execution with stopWhen: stepCountIs()
- OpenAI Provider: Native integration with OpenAI models

## What is the Render MCP server, and what's possible with it?

The Render MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Render account. It provides structured and secure access to your cloud infrastructure, so your agent can perform actions like deploying applications, managing services, monitoring site health, restarting instances, and scaling resources on your behalf.
- Automated application deployment: Instantly deploy new web apps or services without manual steps, letting your agent handle setup and rollouts.
- Service monitoring and status checks: Ask your agent to check the health and uptime of your apps or services, so you’re always up to speed on what’s running smoothly—and what’s not.
- Instance management and restarts: Enable your agent to restart, stop, or scale up/down your running services to quickly respond to changes or issues.
- Resource scaling and configuration: Let your agent adjust resource allocations, increasing or decreasing capacity based on current needs or traffic spikes.
- Error diagnostics and log retrieval: Have your agent fetch logs or error reports to help troubleshoot issues before they become major problems.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `RENDER_ADD_HEADERS` | Add Header Rule | Tool to add a custom HTTP header rule to a Render service. Use when you need to configure headers like Cache-Control, security headers, or CORS headers for specific request paths. |
| `RENDER_ADD_OR_UPDATE_SECRET_FILE` | Add or Update Secret File | Tool to add or update a secret file for a Render service. Use when you need to create a new secret file or update the content of an existing secret file. |
| `RENDER_ADD_RESOURCES_TO_ENVIRONMENT` | Add Resources to Environment | Tool to add resources to a Render environment. Use when you need to associate services, databases, Redis instances, or environment groups with an existing environment. |
| `RENDER_ADD_ROUTE` | Add Route | Tool to add redirect or rewrite rules to a Render service. Use when you need to configure URL routing, redirects, or rewrites for a service. Redirect rules send HTTP redirects to clients, while rewrite rules modify the request path internally. |
| `RENDER_CREATE_CUSTOM_DOMAIN` | Create Custom Domain | Tool to add a custom domain to a Render service. Use when you need to configure a custom domain for a service. |
| `RENDER_CREATE_ENV_GROUP` | Create Environment Group | Tool to create a new environment group. Use when you need to create a shared collection of environment variables and secret files that can be used across multiple services. |
| `RENDER_CREATE_ENVIRONMENT` | Create Environment | Tool to create a new environment within a Render project. Use when you need to set up a new environment for organizing services, databases, and other resources. |
| `RENDER_CREATE_POSTGRES` | Create Postgres Instance | Tool to create a new Postgres instance on Render. Use when you need to provision a new PostgreSQL database with configurable plan, version, and region. |
| `RENDER_CREATE_REGISTRY_CREDENTIAL` | Create Registry Credential | Tool to create a registry credential. Use when you need to add a new container registry credential to your Render account for authenticating with Docker Hub, GitHub, GitLab, Google Artifact Registry, or AWS ECR. |
| `RENDER_DELETE_ENV_GROUP_ENV_VAR` | Delete Environment Group Variable | Tool to remove an environment variable from an environment group. Use when you need to delete a specific environment variable by its key from a given environment group. |
| `RENDER_DELETE_ENV_GROUP_SECRET_FILE` | Delete Environment Group Secret File | Tool to remove a secret file from an environment group. Use when you need to delete a specific secret file by its name from a given environment group. |
| `RENDER_DELETE_ENVIRONMENT` | Delete Environment | Tool to delete a specified environment. Use when you need to remove an environment from Render. Returns success confirmation. |
| `RENDER_DELETE_KEY_VALUE` | Delete Key Value | Tool to delete a Key Value instance. Use when you need to remove a specific Key Value store from your Render account. |
| `RENDER_DELETE_OWNER_LOG_STREAM` | Delete Owner Log Stream | Tool to delete a log stream for an owner. Use when you need to remove log stream configuration for a specific workspace. |
| `RENDER_DELETE_OWNER_METRICS_STREAM` | Delete Owner Metrics Stream | Tool to delete a metrics stream for a workspace. Use when removing metrics integration for a specific owner. |
| `RENDER_DELETE_REGISTRY_CREDENTIAL` | Delete Registry Credential | Tool to delete a registry credential. Use when you need to remove a Docker registry credential from your Render account. |
| `RENDER_DELETE_SECRET_FILE` | Delete Secret File | Tool to delete a secret file from a Render service. Use when you need to remove a secret file that is no longer needed. |
| `RENDER_DELETE_SERVICE` | Delete Service | Tool to delete a service. Use when you need to permanently remove a service from your Render account. |
| `RENDER_DISCONNECT_BLUEPRINT` | Disconnect Blueprint | Tool to disconnect a blueprint from your Render account. Use when you need to remove a blueprint connection. |
| `RENDER_GET_ACTIVE_CONNECTIONS` | Get Active Connections | Tool to get active connection count metrics for Render resources. Use when you need to retrieve time-series data of active connections for Postgres or Redis instances over a specified time range. |
| `RENDER_GET_BANDWIDTH_SOURCES` | Get Bandwidth Sources | Tool to get bandwidth usage breakdown by traffic source. Use when you need to retrieve bandwidth usage statistics segmented by different traffic sources for a Render service. |
| `RENDER_GET_CPU` | Get CPU Usage | Tool to retrieve CPU usage metrics for Render resources. Use when you need to monitor CPU utilization for services, Postgres databases, or Redis instances. At least one filter (resource, service, or instance) must be provided. |
| `RENDER_GET_CPU_LIMIT` | Get CPU Limit | Tool to retrieve CPU limit metrics for Render resources. Use when you need to get the CPU limit time series data for services, Postgres databases, or Redis instances. Returns metrics over a specified time range with configurable resolution. |
| `RENDER_GET_DISK_CAPACITY` | Get Disk Capacity | Tool to get disk capacity metrics for Render resources. Use when you need to retrieve disk capacity time series data for services, Postgres databases, or Redis instances. At least one filter parameter (resource or service) must be specified. |
| `RENDER_GET_DISK_USAGE` | Get Disk Usage | Tool to retrieve disk usage metrics for Render resources. Use when you need to monitor persistent disk utilization for services, Postgres databases, or Redis instances. It is recommended to specify at least one resource filter. |
| `RENDER_GET_INSTANCE_COUNT` | Get Instance Count | Tool to get instance count metrics for Render resources. Use when you need to retrieve instance count time series data for services, Postgres databases, or Redis instances. The resource parameter is required. |
| `RENDER_GET_MEMORY` | Get Memory Usage | Tool to get memory usage metrics for one or more resources. Use when you need to retrieve memory usage data for services, Postgres databases, or Redis instances over a specified time range. |
| `RENDER_GET_MEMORY_LIMIT` | Get Memory Limit | Tool to get memory limit metrics for Render resources over a specified time range. Use when you need to retrieve memory limit data for services, Postgres databases, or Redis instances. At least one filter (resource, service, or instance) must be provided. |
| `RENDER_GET_MEMORY_TARGET` | Get Memory Target | Tool to get memory target metrics for Render resources. Use when you need to retrieve memory target data for services, Postgres databases, or Redis instances over a specified time range. At least one resource identifier (resource, service, or instance) is required. |
| `RENDER_GET_USER` | Get User | Tool to get the authenticated user. Use when you need to retrieve information about the currently authenticated account owner. |
| `RENDER_LINK_SERVICE_TO_ENV_GROUP` | Link Service to Environment Group | Tool to link a service to an environment group. Use when you need to associate a service with an environment group so that the service can access the environment variables and secret files defined in that group. |
| `RENDER_LIST_APPLICATION_FILTER_VALUES` | List Application Filter Values | Tool to list queryable instance values for application metrics. Use when you need to discover available filter values for metrics queries. |
| `RENDER_LIST_BLUEPRINTS` | List Blueprints | Tool to list all blueprints. Use when you need to retrieve the definitions of all blueprints in your account. |
| `RENDER_LIST_DEPLOYS` | List Deploys | Tool to list recent deploys for a Render service with pagination and filtering. Use when you need to fetch deploy history, inspect deploy statuses, or find a specific deployId to pass to other deploy operations. |
| `RENDER_LIST_DISKS` | List Disks | Tool to list all disks. Use when you need to retrieve all disks associated with your account. |
| `RENDER_LIST_ENV_GROUPS` | List Environment Groups | Tool to list environment groups. Use when you need to retrieve environment groups to view shared environment variables across services. |
| `RENDER_LIST_ENVIRONMENTS` | List Environments | Tool to list environments for a project. Use when you need to retrieve environments within a specific project. Requires at least one project ID. |
| `RENDER_LIST_ENV_VARS_FOR_SERVICE` | List Environment Variables for Service | Tool to list all environment variables configured directly on a Render service (with pagination). Use when you need to enumerate env vars without knowing individual keys. |
| `RENDER_LIST_INSTANCES` | List Instances | Tool to list instances of a service. Use when you need to retrieve all instances for a specific Render service. |
| `RENDER_LIST_KEY_VALUE` | List Key Value Instances | Tool to list all Key Value instances. Use when you need to retrieve Key Value instances associated with your account, optionally filtering by name, region, owner, environment, or timestamps. |
| `RENDER_LIST_LOGS` | List Logs | Tool to list logs for a specific workspace and resource. Use when you need to retrieve logs for services, databases, or other resources, with support for filtering by time range, log type, severity level, and text content. Wildcards and regex patterns are supported for most text filters. |
| `RENDER_LIST_LOGS_VALUES` | List Log Label Values | Tool to list log label values for a workspace. Use when you need to discover possible values for a specific log label (instance, host, statusCode, method, level, or type) within a time range. |
| `RENDER_LIST_MAINTENANCE` | List Maintenance Runs | Tool to list maintenance runs. Use when you need to retrieve scheduled or past maintenance activities for services and database instances. |
| `RENDER_LIST_NOTIFICATION_OVERRIDES` | List Notification Overrides | Tool to list notification overrides for services. Use when you need to retrieve notification settings that override default notification behavior for specific services. |
| `RENDER_LIST_OWNER_MEMBERS` | List Workspace Members | Tool to list workspace members. Use when you need to retrieve all members of a specific workspace or team. |
| `RENDER_LIST_OWNERS` | List Owners | Tool to list owners (users and teams). Use after authenticating to fetch available owner IDs for resource creation. |
| `RENDER_LIST_POSTGRES` | List Postgres Instances | Tool to list Postgres instances. Use when you need to retrieve all Postgres databases associated with your account, optionally filtering by name, region, or other criteria. |
| `RENDER_LIST_POSTGRES_EXPORT` | List Postgres Exports | Tool to list all exports for a Postgres instance. Use when you need to retrieve the history of exports for a specific Postgres database. |
| `RENDER_LIST_POSTGRES_USERS` | List PostgreSQL Users | Tool to list PostgreSQL user credentials for a Render PostgreSQL database instance. Use when you need to view all users with access to a specific PostgreSQL database. |
| `RENDER_LIST_PROJECTS` | List Projects | List Projects |
| `RENDER_LIST_REGISTRY_CREDENTIALS` | List Registry Credentials | Tool to list registry credentials. Use when you need to retrieve container registry credentials associated with your account, optionally filtering by name, username, or registry type. |
| `RENDER_LIST_RESOURCE_LOG_STREAMS` | List Resource Log Streams | Tool to list resource log stream overrides. Use when you need to retrieve log stream configurations for resources in your account. |
| `RENDER_LIST_ROUTES` | List Routes | Tool to list redirect/rewrite rules for a service. Use when you need to retrieve routing configuration for a Render service. |
| `RENDER_LIST_SECRET_FILES` | List Secret Files | Tool to list secret files for a Render service. Use when you need to retrieve all secret files associated with a specific service. |
| `RENDER_LIST_SERVICES` | List Services | Tool to list all services. Use when you need to retrieve services accessible by your account, optionally filtering by name or type. Use after authentication. |
| `RENDER_LIST_TASK_RUNS` | List Task Runs | Tool to list task runs. Use when you need to retrieve task execution history for workflows, optionally filtering by task ID, workflow, owner, or root task run. |
| `RENDER_LIST_TASKS` | List Tasks | Tool to list tasks. Use when you need to retrieve tasks from workflows, optionally filtering by owner, task ID, workflow ID, or workflow version ID. |
| `RENDER_LIST_WEBHOOKS` | List Webhooks | Tool to list all webhooks. Use when you need to retrieve configured webhooks for your account. |
| `RENDER_LIST_WORKFLOWS` | List Workflows | Tool to list workflows. Use when you need to retrieve workflows accessible by your account, optionally filtering by name, owner, environment, or workflow ID. |
| `RENDER_LIST_WORKFLOW_VERSIONS` | List Workflow Versions | Tool to list workflow versions. Use when you need to retrieve workflow versions, optionally filtering by owner, workflow, or version ID. |
| `RENDER_RESTART_SERVICE` | Restart Service | Tool to restart a service. Use when you need to restart a running service, such as after configuration changes or to resolve issues. |
| `RENDER_RESUME_SERVICE` | Resume Service | Tool to resume a suspended service. Use when you need to restart a service that was previously suspended. |
| `RENDER_RETRIEVE_CUSTOM_DOMAIN` | Retrieve Custom Domain | Tool to retrieve a specific custom domain for a service. Use when you need to get details about a custom domain associated with a Render service. |
| `RENDER_RETRIEVE_DEPLOY` | Retrieve deploy | Retrieve deploy |
| `RENDER_RETRIEVE_ENV_GROUP` | Retrieve Environment Group | Tool to retrieve a specific environment group by ID. Use when you need to fetch detailed information about a specific environment group including its environment variables, secret files, and linked services. |
| `RENDER_RETRIEVE_ENV_GROUP_ENV_VAR` | Retrieve Environment Variable | Tool to retrieve a specific environment variable from a Render environment group. Use when you need to fetch the value of a particular environment variable by its key. |
| `RENDER_RETRIEVE_ENV_GROUP_SECRET_FILE` | Retrieve Environment Group Secret File | Tool to retrieve secret file from an environment group. Use when you need to get the content of a specific secret file within an environment group. |
| `RENDER_RETRIEVE_ENV_VAR` | Retrieve Environment Variable | Tool to retrieve a specific environment variable from a Render service. Use when you need to fetch the value of a particular environment variable by its key. |
| `RENDER_RETRIEVE_OWNER` | Retrieve Owner | Tool to retrieve a specific owner (workspace) by ID. Use when you need details about a user or team workspace. |
| `RENDER_RETRIEVE_OWNER_NOTIFICATION_SETTINGS` | Retrieve Owner Notification Settings | Tool to retrieve notification settings for a specific owner (workspace). Use when you need to check current notification configuration for Slack, email, and preview notifications. |
| `RENDER_RETRIEVE_POSTGRES` | Retrieve Postgres Instance | Tool to retrieve a specific Postgres instance. Use when you need to get details about a Postgres database in your Render account. |
| `RENDER_RETRIEVE_PROJECT` | Retrieve Project | Tool to retrieve a specific project by ID. Use when you need to fetch detailed information about a Render project including its name, owner, and associated environments. |
| `RENDER_RETRIEVE_REGISTRY_CREDENTIAL` | Retrieve Registry Credential | Tool to retrieve a registry credential by ID. Use when you need to get details about a Docker registry credential in your Render account. |
| `RENDER_RETRIEVE_SECRET_FILE` | Retrieve Secret File | Tool to retrieve a secret file from a Render service. Use when you need to get the content of a specific secret file within a service. |
| `RENDER_RETRIEVE_SERVICE` | Retrieve Service | Tool to retrieve a specific service by ID. Use when you need detailed information about a service including its configuration, status, and deployment settings. |
| `RENDER_STREAM_TASK_RUNS_EVENTS` | Stream Task Runs Events | Tool to stream real-time task run events via Server-Sent Events (SSE). Use when you need to monitor task execution status and receive live updates as tasks progress. Requires maintaining an open HTTP connection to receive the event stream. |
| `RENDER_SUBSCRIBE_LOGS` | Subscribe to Logs | Tool to subscribe to real-time logs via WebSocket connection. Use when you need to stream logs as they are generated for services, databases, or other resources. Note: This endpoint requires HTTP/1.1 WebSocket upgrade (HTTP 101 Switching Protocols). For retrieving historical logs without streaming, use the List Logs action instead. |
| `RENDER_SUSPEND_SERVICE` | Suspend Service | Tool to suspend a service. Use when you need to temporarily stop a service without deleting it. |
| `RENDER_TRIGGER_DEPLOY` | Trigger Deploy | Tool to trigger a new deploy for a specified service. Requires the service to already exist on Render and be linked to a Git repo — initial setup and repo linking must be done in the Render UI. Use when you need to manually start a new build and deployment process, such as after updating service configuration or pushing code changes that Render does not auto-apply. |
| `RENDER_UPDATE_ENV_GROUP` | Update Environment Group | Tool to update an environment group's name. Use when you need to rename an existing environment group. |
| `RENDER_UPDATE_ENV_GROUP_ENV_VAR` | Update Environment Group Variable | Tool to add or update an environment variable in an environment group. Use when you need to set a new value for an environment variable or create a new one if it doesn't exist. You can either provide a specific value or request a randomly generated value. |
| `RENDER_UPDATE_ENV_GROUP_SECRET_FILE` | Update Environment Group Secret File | Tool to add or update a secret file in an environment group. Use when you need to create a new secret file or modify the content of an existing secret file within an environment group. |
| `RENDER_UPDATE_ENV_VAR` | Update Environment Variable | Tool to add or update an environment variable for a Render service. Use when you need to set a new environment variable or modify an existing one's value. You can either provide a specific value or have Render auto-generate a secure random value. |
| `RENDER_UPDATE_ENV_VARS_FOR_SERVICE` | Update Environment Variables for Service | Tool to update environment variables for a Render service. Use when you need to add, modify, or set environment variables for a service. This replaces all environment variables with the provided list. |
| `RENDER_UPDATE_HEADERS` | Update Header Rules | Tool to replace all header rules for a Render service. Use when you need to completely replace the existing set of custom HTTP headers with a new set. This operation removes all existing header rules and replaces them with the provided ones. |
| `RENDER_UPDATE_OWNER_LOG_STREAM` | Update Owner Log Stream | Tool to update log stream configuration for an owner. Use when you need to modify log stream settings for a specific workspace. |
| `RENDER_UPDATE_OWNER_NOTIFICATION_SETTINGS` | Update Owner Notification Settings | Tool to update notification settings for a specific owner (workspace). Use when you need to modify email, preview, or notification type settings. |
| `RENDER_UPDATE_POSTGRES` | Update Postgres Instance | Tool to update a Postgres instance configuration. Use when you need to modify settings like name, plan, disk size, high availability, or IP allowlist for an existing Render Postgres database. |
| `RENDER_UPDATE_PROJECT` | Update Project | Tool to update a project's name. Use when you need to rename an existing Render project. |
| `RENDER_UPDATE_REGISTRY_CREDENTIAL` | Update Registry Credential | Tool to update a registry credential. Use when you need to modify the name, username, authentication token, or registry type for an existing Docker registry credential in your Render account. |
| `RENDER_UPDATE_RESOURCE_LOG_STREAM` | Update Resource Log Stream | Tool to update log stream override for a resource. Use when you need to configure whether logs should be sent to a custom endpoint or dropped for a specific resource (server, cron job, postgres, or redis). |
| `RENDER_UPDATE_ROUTES` | Update Routes | Tool to update redirect/rewrite rules for a service. Use when you need to set or replace the routing configuration for a Render service. This operation replaces all existing routes with the provided list. |
| `RENDER_UPDATE_SECRET_FILES_FOR_SERVICE` | Update Secret Files for Service | Tool to update secret files for a Render service. Use when you need to create or update multiple secret files at once for a specific service. |
| `RENDER_UPDATE_SERVICE` | Update Service | Tool to update a service configuration. Use when you need to modify service settings such as auto-deploy, branch, build filters, Docker image, name, repository, or service-specific details. |
| `RENDER_VERIFY_CUSTOM_DOMAIN` | Verify Custom Domain | Tool to verify DNS configuration for a custom domain. Use when you need to trigger DNS verification for a custom domain associated with a Render service. |

## Supported Triggers

None listed.

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

The Render MCP server is an implementation of the Model Context Protocol that connects your AI agent to Render. It provides structured and secure access so your agent can perform Render 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 you begin, make sure you have:
- Node.js and npm installed
- A Composio account with API key
- An OpenAI API key

### 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 required dependencies

First, install the necessary packages for your project.
What you're installing:
- @ai-sdk/openai: Vercel AI SDK's OpenAI provider
- @ai-sdk/mcp: MCP client for Vercel AI SDK
- @composio/core: Composio SDK for tool integration
- ai: Core Vercel AI SDK
- dotenv: Environment variable management
```bash
npm install @ai-sdk/openai @ai-sdk/mcp @composio/core ai dotenv
```

### 3. Set up environment variables

Create a .env file in your project root.
What's needed:
- OPENAI_API_KEY: Your OpenAI API key for GPT model access
- COMPOSIO_API_KEY: Your Composio API key for tool access
- COMPOSIO_USER_ID: A unique identifier for the user session
```bash
OPENAI_API_KEY=your_openai_api_key_here
COMPOSIO_API_KEY=your_composio_api_key_here
COMPOSIO_USER_ID=your_user_id_here
```

### 4. Import required modules and validate environment

What's happening:
- We're importing all necessary libraries including Vercel AI SDK's OpenAI provider and Composio
- The dotenv/config import automatically loads environment variables
- The MCP client import enables connection to Composio's tool server
```typescript
import "dotenv/config";
import { openai } from "@ai-sdk/openai";
import { Composio } from "@composio/core";
import * as readline from "readline";
import { streamText, type ModelMessage, stepCountIs } from "ai";
import { createMCPClient } from "@ai-sdk/mcp";

const composioAPIKey = process.env.COMPOSIO_API_KEY;
const composioUserID = process.env.COMPOSIO_USER_ID;

if (!process.env.OPENAI_API_KEY) throw new Error("OPENAI_API_KEY is not set");
if (!composioAPIKey) throw new Error("COMPOSIO_API_KEY is not set");
if (!composioUserID) throw new Error("COMPOSIO_USER_ID is not set");

const composio = new Composio({
  apiKey: composioAPIKey,
});
```

### 5. Create Tool Router session and initialize MCP client

What's happening:
- We're creating a Tool Router session that gives your agent access to Render tools
- The create method takes the user ID and specifies which toolkits should be available
- The returned mcp object contains the URL and authentication headers needed to connect to the MCP server
- This session provides access to all Render-related tools through the MCP protocol
```typescript
async function main() {
  // Create a tool router session for the user
  const session = await composio.create(composioUserID!, {
    toolkits: ["render"],
  });

  const mcpUrl = session.mcp.url;
```

### 6. Connect to MCP server and retrieve tools

What's happening:
- We're creating an MCP client that connects to our Composio Tool Router session via HTTP
- The mcp.url provides the endpoint, and mcp.headers contains authentication credentials
- The type: "http" is important - Composio requires HTTP transport
- tools() retrieves all available Render tools that the agent can use
```typescript
const mcpClient = await createMCPClient({
  transport: {
    type: "http",
    url: mcpUrl,
    headers: session.mcp.headers, // Authentication headers for the Composio MCP server
  },
});

const tools = await mcpClient.tools();
```

### 7. Initialize conversation and CLI interface

What's happening:
- We initialize an empty messages array to maintain conversation history
- A readline interface is created to accept user input from the command line
- Instructions are displayed to guide the user on how to interact with the agent
```typescript
let messages: ModelMessage[] = [];

console.log("Chat started! Type 'exit' or 'quit' to end the conversation.\n");
console.log(
  "Ask any questions related to render, like summarize my last 5 emails, send an email, etc... :)))\n",
);

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  prompt: "> ",
});

rl.prompt();
```

### 8. Handle user input and stream responses with real-time tool feedback

What's happening:
- We use streamText instead of generateText to stream responses in real-time
- toolChoice: "auto" allows the model to decide when to use Render tools
- stopWhen: stepCountIs(10) allows up to 10 steps for complex multi-tool operations
- onStepFinish callback displays which tools are being used in real-time
- We iterate through the text stream to create a typewriter effect as the agent responds
- The complete response is added to conversation history to maintain context
- Errors are caught and displayed with helpful retry suggestions
```typescript
rl.on("line", async (userInput: string) => {
  const trimmedInput = userInput.trim();

  if (["exit", "quit", "bye"].includes(trimmedInput.toLowerCase())) {
    console.log("\nGoodbye!");
    rl.close();
    process.exit(0);
  }

  if (!trimmedInput) {
    rl.prompt();
    return;
  }

  messages.push({ role: "user", content: trimmedInput });
  console.log("\nAgent is thinking...\n");

  try {
    const stream = streamText({
      model: openai("gpt-5"),
      messages,
      tools,
      toolChoice: "auto",
      stopWhen: stepCountIs(10),
      onStepFinish: (step) => {
        for (const toolCall of step.toolCalls) {
          console.log(`[Using tool: ${toolCall.toolName}]`);
          }
          if (step.toolCalls.length > 0) {
            console.log(""); // Add space after tool calls
          }
        },
      });

      for await (const chunk of stream.textStream) {
        process.stdout.write(chunk);
      }

      console.log("\n\n---\n");

      // Get final result for message history
      const response = await stream.response;
      if (response?.messages?.length) {
        messages.push(...response.messages);
      }
    } catch (error) {
      console.error("\nAn error occurred while talking to the agent:");
      console.error(error);
      console.log(
        "\nYou can try again or restart the app if it keeps happening.\n",
      );
    } finally {
      rl.prompt();
    }
  });

  rl.on("close", async () => {
    await mcpClient.close();
    console.log("\n👋 Session ended.");
    process.exit(0);
  });
}

main().catch((err) => {
  console.error("Fatal error:", err);
  process.exit(1);
});
```

## Complete Code

```typescript
import "dotenv/config";
import { openai } from "@ai-sdk/openai";
import { Composio } from "@composio/core";
import * as readline from "readline";
import { streamText, type ModelMessage, stepCountIs } from "ai";
import { createMCPClient } from "@ai-sdk/mcp";

const composioAPIKey = process.env.COMPOSIO_API_KEY;
const composioUserID = process.env.COMPOSIO_USER_ID;

if (!process.env.OPENAI_API_KEY) throw new Error("OPENAI_API_KEY is not set");
if (!composioAPIKey) throw new Error("COMPOSIO_API_KEY is not set");
if (!composioUserID) throw new Error("COMPOSIO_USER_ID is not set");

const composio = new Composio({
  apiKey: composioAPIKey,
});

async function main() {
  // Create a tool router session for the user
  const session = await composio.create(composioUserID!, {
    toolkits: ["render"],
  });

  const mcpUrl = session.mcp.url;

  const mcpClient = await createMCPClient({
    transport: {
      type: "http",
      url: mcpUrl,
      headers: session.mcp.headers, // Authentication headers for the Composio MCP server
    },
  });

  const tools = await mcpClient.tools();

  let messages: ModelMessage[] = [];

  console.log("Chat started! Type 'exit' or 'quit' to end the conversation.\n");
  console.log(
    "Ask any questions related to render, like summarize my last 5 emails, send an email, etc... :)))\n",
  );

  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: "> ",
  });

  rl.prompt();

  rl.on("line", async (userInput: string) => {
    const trimmedInput = userInput.trim();

    if (["exit", "quit", "bye"].includes(trimmedInput.toLowerCase())) {
      console.log("\nGoodbye!");
      rl.close();
      process.exit(0);
    }

    if (!trimmedInput) {
      rl.prompt();
      return;
    }

    messages.push({ role: "user", content: trimmedInput });
    console.log("\nAgent is thinking...\n");

    try {
      const stream = streamText({
        model: openai("gpt-5"),
        messages,
        tools,
        toolChoice: "auto",
        stopWhen: stepCountIs(10),
        onStepFinish: (step) => {
          for (const toolCall of step.toolCalls) {
            console.log(`[Using tool: ${toolCall.toolName}]`);
          }
          if (step.toolCalls.length > 0) {
            console.log(""); // Add space after tool calls
          }
        },
      });

      for await (const chunk of stream.textStream) {
        process.stdout.write(chunk);
      }

      console.log("\n\n---\n");

      // Get final result for message history
      const response = await stream.response;
      if (response?.messages?.length) {
        messages.push(...response.messages);
      }
    } catch (error) {
      console.error("\nAn error occurred while talking to the agent:");
      console.error(error);
      console.log(
        "\nYou can try again or restart the app if it keeps happening.\n",
      );
    } finally {
      rl.prompt();
    }
  });

  rl.on("close", async () => {
    await mcpClient.close();
    console.log("\n👋 Session ended.");
    process.exit(0);
  });
}

main().catch((err) => {
  console.error("Fatal error:", err);
  process.exit(1);
});
```

## Conclusion

You've successfully built a Render agent using the Vercel AI SDK with streaming capabilities! This implementation provides a powerful foundation for building AI applications with natural language interfaces and real-time feedback.
Key features of this implementation:
- Real-time streaming responses for a better user experience with typewriter effect
- Live tool execution feedback showing which tools are being used as the agent works
- Dynamic tool loading through Composio's Tool Router with secure authentication
- Multi-step tool execution with configurable step limits (up to 10 steps)
- Comprehensive error handling for robust agent execution
- Conversation history maintenance for context-aware responses
You can extend this further by adding custom error handling, implementing specific business logic, or integrating additional Composio toolkits to create multi-app workflows.

## How to build Render MCP Agent with another framework

- [ChatGPT](https://composio.dev/toolkits/render/framework/chatgpt)
- [OpenAI Agents SDK](https://composio.dev/toolkits/render/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/render/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/render/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/render/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/render/framework/codex)
- [Cursor](https://composio.dev/toolkits/render/framework/cursor)
- [VS Code](https://composio.dev/toolkits/render/framework/vscode)
- [OpenCode](https://composio.dev/toolkits/render/framework/opencode)
- [OpenClaw](https://composio.dev/toolkits/render/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/render/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/render/framework/cli)
- [Google ADK](https://composio.dev/toolkits/render/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/render/framework/langchain)
- [Mastra AI](https://composio.dev/toolkits/render/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/render/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/render/framework/crew-ai)

## Related Toolkits

- [Supabase](https://composio.dev/toolkits/supabase) - Supabase is an open-source backend platform offering scalable Postgres databases, authentication, storage, and real-time APIs. It lets developers build modern apps without managing infrastructure.
- [Codeinterpreter](https://composio.dev/toolkits/codeinterpreter) - Codeinterpreter is a Python-based coding environment with built-in data analysis and visualization. It lets you instantly run scripts, plot results, and prototype solutions inside supported platforms.
- [GitHub](https://composio.dev/toolkits/github) - GitHub is a code hosting platform for version control and collaborative software development. It streamlines project management, code review, and team workflows in one place.
- [Ably](https://composio.dev/toolkits/ably) - Ably is a real-time messaging platform for live chat and data sync in modern apps. It offers global scale and rock-solid reliability for seamless, instant experiences.
- [Abuselpdb](https://composio.dev/toolkits/abuselpdb) - Abuselpdb is a central database for reporting and checking IPs linked to malicious online activity. Use it to quickly identify and report suspicious or abusive IP addresses.
- [Alchemy](https://composio.dev/toolkits/alchemy) - Alchemy is a blockchain development platform offering APIs and tools for Ethereum apps. It simplifies building and scaling Web3 projects with robust infrastructure.
- [Algolia](https://composio.dev/toolkits/algolia) - Algolia is a hosted search API that powers lightning-fast, relevant search experiences for web and mobile apps. It helps developers deliver instant, typo-tolerant, and scalable search without complex infrastructure.
- [Anchor browser](https://composio.dev/toolkits/anchor_browser) - Anchor browser is a developer platform for AI-powered web automation. It transforms complex browser actions into easy API endpoints for streamlined web interaction.
- [Apiflash](https://composio.dev/toolkits/apiflash) - Apiflash is a website screenshot API for programmatically capturing web pages. It delivers high-quality screenshots on demand for automation, monitoring, or reporting.
- [Apiverve](https://composio.dev/toolkits/apiverve) - Apiverve delivers a suite of powerful APIs that simplify integration for developers. It's designed for reliability and scalability so you can build faster, smarter applications without the integration headache.
- [Appcircle](https://composio.dev/toolkits/appcircle) - Appcircle is an enterprise-grade mobile CI/CD platform for building, testing, and publishing mobile apps. It streamlines mobile DevOps so teams ship faster and with more confidence.
- [Appdrag](https://composio.dev/toolkits/appdrag) - Appdrag is a cloud platform for building websites, APIs, and databases with drag-and-drop tools and code editing. It accelerates development and iteration by combining hosting, database management, and low-code features in one place.
- [Appveyor](https://composio.dev/toolkits/appveyor) - AppVeyor is a cloud-based continuous integration service for building, testing, and deploying applications. It helps developers automate and streamline their software delivery pipelines.
- [Backendless](https://composio.dev/toolkits/backendless) - Backendless is a backend-as-a-service platform for mobile and web apps, offering database, file storage, user authentication, and APIs. It helps developers ship scalable applications faster without managing server infrastructure.
- [Baserow](https://composio.dev/toolkits/baserow) - Baserow is an open-source no-code database platform for building collaborative data apps. It makes it easy for teams to organize data and automate workflows without writing code.
- [Bench](https://composio.dev/toolkits/bench) - Bench is a benchmarking tool for automated performance measurement and analysis. It helps you quickly evaluate, compare, and track your systems or workflows.
- [Better stack](https://composio.dev/toolkits/better_stack) - Better Stack is a monitoring, logging, and incident management solution for apps and services. It helps teams ensure application reliability and performance with real-time insights.
- [Bitbucket](https://composio.dev/toolkits/bitbucket) - Bitbucket is a Git-based code hosting and collaboration platform for teams. It enables secure repository management and streamlined code reviews.
- [Blazemeter](https://composio.dev/toolkits/blazemeter) - Blazemeter is a continuous testing platform for web and mobile app performance. It empowers teams to automate and analyze large-scale tests with ease.
- [Blocknative](https://composio.dev/toolkits/blocknative) - Blocknative delivers real-time mempool monitoring and transaction management for public blockchains. Instantly track pending transactions and optimize blockchain interactions with live data.

## Frequently Asked Questions

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

With a standalone Render MCP server, the agents and LLMs can only access a fixed set of Render tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Render and many other apps based on the task at hand, all through a single MCP endpoint.

### Can I use Tool Router MCP with Vercel AI SDK v6?

Yes, you can. Vercel AI SDK v6 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 Render tools.

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

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

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