Skip to main content

Overview

TrueFoundry AI Gateway enables you to expose integrated MCP Servers to developers in a secure manner.
Diagram showing TrueFoundry AI Gateway architecture with MCP Servers integration
This allows you to:
  • Manage who can use the registered MCP Servers.
  • Avoid exposing MCP Server credentials directly to the developers.
  • Monitor usage metrics (latency, execution per second) of the tools across all registered MCP Servers. (Coming soon.)
  • Rate-limit tool calls. (Coming soon.)
    • This is useful for expensive tools like search, code-execution, etc.

Quickstart

1

Copy the code snippet

TrueFoundry Dashboard showing where to find the MCP server code snippet in AI Gateway UI

Get your code snippet from the AI Gateway UI

TrueFoundry Dashboard showing code snippet interface for MCP server integration

Copy the code snippet from the UI for quick integration

2

Copy PAT or VAT

See API Keys for more details on creating PATs and VATs.
3

Call the MCP Server from your code

At this point, we can use the code snippet we copied at Step 1.Below is an example showing how to connect, list tools, and call tools on an MCP Server. Update the placeholders with your actual credentials and tool names.
Install the library:
Code:

Configuration

Required Parameters

Replace the placeholders in the example:
  • {GATEWAY_BASE_URL} with your TrueFoundry AI Gateway base URL
  • <integrationId> with your MCP server ID
  • <tfy-api-token> with your TrueFoundry API token
  • <tool-name> with the name of the tool you want to use

Supported Transports

  • Only MCP servers that use streamable-http transport (stateful/stateless) are supported for connection via Gateway proxy
  • Older SSE-based MCP servers will work on /agent/responses endpoint but are not compatible with the proxy connection method described here