How to Connect LLMs to Real-Time SaaS Data with Unified.to MCP Server
August 25, 2025
Unified's MCP server allows your application to give an LLM API real-time access to your customers' SaaS data and perform actions on that data, without you having to write custom business-logic code for every integration, which can often make things messy.
For example, imagine you're building a candidate assessment workflow, we'd usually call the API to fetch the data, and feed it into the LLM for it to analyze that data. With the Unified MCP server, we can enable OpenAI (or another LLM API) to directly access the data and perform actions making the workflow much simpler and cleaner.
The Flow
Here's how an LLM API connects to Unified's MCP server:
- Your app connects to the MCP server using the HTTP endpoint.
- You authenticate with a token in the
Authorization: Bearerheader: your workspace API key plus a customer'sconnectionID from your own server, or a connection-scoped signed token when an LLM provider or agent calls the server. - The LLM can then discover and call tools (like 'fetch candidate', 'score candidate', 'update job status') in real time.
Authentication
Send the token in the Authorization header (Authorization: Bearer {token}) or the x-api-key header. Don't put it in the URL; the ?token= parameter still works but is deprecated. Use the Streamable HTTP host for your workspace's region (US https://mcp-api.unified.to/mcp, EU https://mcp-api-eu.unified.to/mcp, AU https://mcp-api-au.unified.to/mcp); a credential works only on its own region's host.
LLM providers, agents and third-party clients:
Use a connection-scoped signed token, generated with get_unified_connection_mcp_url (mode=user). It works for one connection only, so your workspace API key stays on your server.
Private (Direct LLM API):
From your own server, use your Unified.to workspace API key as the token, and include a connection parameter for the customer's connection ID.
Example:
https://mcp-api.unified.to/mcp?connection=<CONNECTION_ID>
Authorization: Bearer <YOUR_API_KEY>
```
_Note: Keep the workspace API key on your server. Never put it in a URL or a client config._
## Building the application with an LLM API and MCP
If your application is using an LLM API that supports MCP (like OpenAI), you can use the [`mcp-use`](https://github.com/mcp-use/mcp-use) Python package to connect to Unified MCP and access your customer's data and actions.
### Dependencies
The full list of dependencies and setup you need to do to get things running.
```bash
mkdir unified-mcp-client
cd unified-mcp-client
python -m venv .venv
source .venv/bin/activate
pip install mcp-use python-dotenv requests openai
touch client.py
Setting up your secrets
Add your Unified API key, your customer's connection ID, and your workspace secret to a .env file:
echo "UNIFIED_API_KEY=<your Unified API key here>" >> .env
echo "CONNECTION_ID=<your Unified connection ID here>" >> .env
echo "UNIFIED_MCP_TOKEN=<connection-scoped signed token here>" >> .env
echo ".env" >> .gitignore
The MCP Client Class
Here's an example using the mcp-use package:
# client.py
import os
import asyncio
from dotenv import load_dotenv
from mcp_use import MCPClient
load_dotenv()
CONNECTION_ID = os.getenv("CONNECTION_ID")
UNIFIED_API_KEY = os.getenv("UNIFIED_API_KEY") # stays on your server
# Use your region's host: US mcp-api.unified.to, EU mcp-api-eu.unified.to, AU mcp-api-au.unified.to
MCP_URL = f"https://mcp-api.unified.to/mcp?connection={CONNECTION_ID}"
client = MCPClient.from_dict({
"mcpServers": {
"unified": {
"url": MCP_URL,
"headers": {"Authorization": f"Bearer {UNIFIED_API_KEY}"},
}
}
})
async def main():
await client.create_all_sessions()
session = client.get_session("unified")
# List available tools
tools = await session.list_tools()
print("Available tools:", [tool.name for tool in tools])
asyncio.run(main())
Integrating with OpenAI (LLM API)
Once your MCP client is set up, you can connect it to OpenAI's API, which natively supports remote MCP servers.
Configure OpenAI to Use Unified MCP
When you send a Responses API request, specify the MCP server as a tool source and pass a connection-scoped token in the authorization field.
Here's a candidate assessment example:
from openai import OpenAI
openai_client = OpenAI() # reads OPENAI_API_KEY
response = openai_client.responses.create(
model="gpt-4o",
tools=[{
"type": "mcp",
"server_label": "unified",
"server_url": MCP_URL, # no token in the URL
# Connection-scoped signed token: works for one connection only
"authorization": os.getenv("UNIFIED_MCP_TOKEN"),
"require_approval": "never",
}],
input="Score this candidate for the Software Engineer job.",
)
print(response.output_text)
No backend glue code required: OpenAI orchestrates the tool calls via Unified MCP.
Integrating with Anthropic API
Manual Tool Orchestration:
- Call Unified's
/tools?type=openaiendpoint, rename each tool'sparameterstoinput_schema, and pass the tool list to Claude:resp = client.messages.create( model="claude-3-5-sonnet-20241022", tools=tools, input="list the candidates and then analyse the resumes from their applications", ) - Claude will return a
tool_useblock:[ { "type": "tool_use", "id": "toolu_...", "name": "list_candidates", "input": { "limit": "100" } } ] - Call Unified's
/tools/{id}/callendpoint with the arguments. - Return the result to Claude as a
tool_resultblock in your next message:[ { "type": "tool_result", "tool_use_id": "toolu_...", "content": "..." } ]
Integrating with Google Gemini API
Manual Tool Orchestration:
- Call Unified's
/tools?type=geminiendpoint and pass the tool list asfunction_declarationsto Gemini. - Gemini will return a function call request:
function_call { name: "list_candidates" args { fields { key: "limit" value { string_value: "100" } } } } - Call Unified's
/tools/{id}/callendpoint. - Respond to Gemini with the tool result as a
functionResponsein your next message:{ "role": "user", "parts": [ { "functionResponse": { "name": "list_candidates", "response": { ... } } } ] }
Integrating with Cohere
Manual Tool Orchestration:
- Call Unified's
/tools?type=cohereendpoint and pass the tool list to Cohere:response = co.chat( model="command-a-03-2025", messages=messages, tools=tools ) - When Cohere requests a tool call, call Unified's
/tools/{id}/callendpoint. - Pass the tool result back to Cohere in your next message
Example Prompt and Response
Prompt:
"Score this candidate for the Software Engineer job."
What happens:
- Your chosen LLM discovers the available tools from Unified MCP (e.g.,
fetch-candidate,fetch-job,score-candidate). - The LLM calls
fetch-candidateandfetch-jobtools to get the data. - The LLM calls
score-candidatewith the data. - The LLM returns a response like:
Response:
Candidate Jane Doe scored 92/100 for the Software Engineer job. Strengths: Python, distributed systems. Recommended for interview.