Skip to main content
Nango makes it straightforward to give AI agents real-world capabilities. Your integration functions become tools that any LLM or agent framework can call, while Nango handles authentication, execution, retries, and observability.

How it works

1

Authorize

Your users connect their accounts via Nango’s auth flow. Nango stores and refreshes credentials automatically.
2

Expose tools

Each Nango Action becomes a callable tool. You can use prebuilt templates or write your own — they run in Nango’s sandboxed runtime.
3

Call tools

Your agent invokes Nango-hosted Actions via nango.triggerAction() or through Nango’s MCP server. Nango authenticates each request and returns the result.
4

Observe and optimize

Every tool call is logged in Nango’s observability dashboard. Monitor performance, inspect errors, and track usage per connection.

When to use Nango for tool calling

Use Nango whenever your AI needs to take action in the real world:
  • An AI agent creates or updates a CRM opportunity on behalf of a user.
  • A chatbot fetches live context from Notion, Linear, or HubSpot.
  • An LLM workflow runs automations: “schedule a meeting”, “create a task”, “send a message”.
For RAG-style use cases where data must be replicated and stored locally, use Data Syncing instead.

Key capabilities

Framework-agnostic

Works with OpenAI Agents SDK, Anthropic SDK, Vercel AI SDK, LangChain, LlamaIndex, Mastra, Google SDK, and any framework that supports tool calling.

Managed auth

Nango handles OAuth, API keys, and token refresh. Surface connect links directly in your chat UI for user-driven authorization.

800+ prebuilt tools

Use prebuilt action templates for common tools across 700+ APIs, or write your own custom Actions for full control.

MCP-compatible

Expose all your integrations through Nango’s built-in MCP server. Also supports connecting to existing official MCP servers (Notion, Linear, etc.) with Nango’s auth.

Framework examples

Install the dependencies:
npm i openai @nangohq/node
The following example checks whether a user has authorized HubSpot, prompts them to connect if not, then lets the OpenAI model call the who_am_i tool via Nango:
import OpenAI from "openai";
import { Nango } from "@nangohq/node";

export async function runOpenAIAgent() {
  const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY! });
  const nango = new Nango({ secretKey: process.env.NANGO_SECRET_KEY! });

  const userId = "user1";
  const integrationId = "hubspot";

  // Step 1: Ensure the user is authorized
  const connections = await nango.listConnections({
    integrationId,
    tags: { end_user_id: userId }
  });
  let connectionId = connections.connections[0]?.connection_id;

  // Step 2: If not authorized, redirect to the auth flow
  if (!connectionId) {
    const session = await nango.createConnectSession({
      allowed_integrations: [integrationId],
      tags: { end_user_id: userId }
    });
    console.log(`Authorize at: ${session.data.connect_link}`);

    const connection = await nango.waitForConnection(integrationId, userId);
    connectionId = connection!.connection_id;
  }

  // Step 3: Send a prompt with tool definitions
  const response = await client.responses.create({
    model: "gpt-5",
    input: "Using the who_am_i tool, provide the current user info.",
    tools: [
      {
        type: "function",
        name: "who_am_i",
        description: "Get the current user info.",
        parameters: { type: "object", properties: {}, additionalProperties: false },
        strict: true
      }
    ]
  });

  const functionCall = response.output.find(
    (item) => item.type === "function_call"
  ) as any;

  if (functionCall?.name === "who_am_i") {
    // Step 4: Execute the tool via Nango
    const userInfo = await nango.triggerAction(integrationId, connectionId, "whoami");
    console.log("HubSpot user info:", userInfo);
  }
}
Let agents introspect available tools and their schemas automatically by calling the scripts config endpoint. Your model can then decide which tool to call without manual configuration.

MCP server

Nango has a built-in MCP (Model Context Protocol) server that exposes all your integrations as MCP tools. Any MCP-compatible client — Claude Desktop, Cursor, or a custom agent — can connect to it. With the Nango MCP server you can:
  • Expose any Nango Action as an MCP tool automatically.
  • Connect to existing official MCP servers (Notion, Linear, etc.) using Nango’s managed auth.
  • Let users authorize APIs directly through your MCP-connected interface.
See the MCP server implementation guide for setup instructions, including how to generate a server URL scoped to a specific connection.

Auth for tool calling

Nango manages all credential storage and refresh. For user-facing agents, you can embed an auth flow directly in your chat UI:
import { Nango } from "@nangohq/node";

const nango = new Nango({ secretKey: process.env.NANGO_SECRET_KEY! });

// Create a short-lived connect link for a specific user
const session = await nango.createConnectSession({
  allowed_integrations: ["hubspot", "salesforce"],
  tags: { end_user_id: "user-123" }
});

// Send session.data.connect_link to your frontend
// The user completes auth in the Connect UI
// Then resume agent execution once connection is established
const connection = await nango.waitForConnection("hubspot", "user-123");
Once a connection exists, every triggerAction call uses that connection’s credentials automatically — no token management in your agent code.

Build docs developers (and LLMs) love