Prerequisites
- A Nango integration configured for the external API.
- A connection for the user whose credentials should be used.
- One or more enabled action functions for the operations the agent may call.
Common auth and execution
Keep provider credentials out of the agent runtime. Your app should resolve the Nango connection for the current user, then pass only the connection ID and selected tool to Nango.executeNangoTool() helper.
Framework examples
These examples expose a HubSpotwhoami action function as a who_am_i tool.
- OpenAI
- Anthropic
- Vercel AI SDK
- LangChain
- Mastra
Programmatic tool discovery
The Get integration functions config API returns enabled action function definitions. Use it when an agent or orchestration layer should discover available tools at runtime.format=nango for Nango’s native configuration shape, or format=openai when you want OpenAI-compatible function definitions.
Direct tool execution
For SDKs that let you provide your own tool executor, define the tool schema in your app and call Nango from the executor.providerConfigKey/ integration ID - which integration owns the action function.connectionId- which user’s credentials the call uses.- Action function name - the enabled action function to execute.
- Input payload - validated by the action function schema when configured.
MCP server
Nango exposes enabled action functions through a hosted MCP server:
Example client setup with the MCP TypeScript SDK:
mcp-remote and pass the same headers. Keep the header spacing exactly as required by the bridge you choose.
Auth flow for agents
Agents should not receive provider credentials. Your app should:- Check whether the user already has a Nango connection.
- Create a Connect session if they need to authorize.
- Store the resulting
connectionIdin your app. - Use that
connectionIdfor future tool calls.
For agents
For agents
If you are implementing this flow programmatically, first list or create the user’s connection, then call
GET /scripts/config to discover enabled action functions, and finally execute tools with POST /action/trigger or the MCP server.Required values for every execution are the Nango secret key, integration ID, connection ID, action function name, and input payload.