Build advanced AI agents with Mistral. Connect 600+ integrations, automate workflows, and deploy with ease using Metorial.
Best practices for configuring Metorial with the AI SDK in your projects.
Create a .env
file in your project root:
# .env
METORIAL_API_KEY=your-metorial-api-key
METORIAL_DEPLOYMENT_ID=your-server-deployment-id
# AI Provider Keys
OPENAI_API_KEY=your-openai-key
ANTHROPIC_API_KEY=your-anthropic-key
import 'dotenv/config';
import { Metorial } from 'metorial';
const metorial = new Metorial({
apiKey: process.env.METORIAL_API_KEY
});
Next.js automatically loads .env.local
files:
// app/api/chat/route.ts
import { Metorial } from 'metorial';
export async function POST(req: Request) {
const metorial = new Metorial({
apiKey: process.env.METORIAL_API_KEY
});
// Your AI SDK code
}
Create a configuration module for reusable settings:
// config/metorial.ts
import { Metorial } from 'metorial';
if (!process.env.METORIAL_API_KEY) {
throw new Error('METORIAL_API_KEY is required');
}
export const metorial = new Metorial({
apiKey: process.env.METORIAL_API_KEY
});
export const defaultDeployment = process.env.METORIAL_DEPLOYMENT_ID;
Then use it throughout your application:
import { metorial, defaultDeployment } from './config/metorial';
import { metorialAiSdk } from '@metorial/ai-sdk';
await metorial.withProviderSession(
metorialAiSdk,
{ serverDeployments: [defaultDeployment] },
async session => {
// Your code
}
);
Use different deployment IDs for different environments:
# .env.development
METORIAL_DEPLOYMENT_ID=dev-deployment-id
# .env.production
METORIAL_DEPLOYMENT_ID=prod-deployment-id
Never commit .env files: Add to .gitignore
:
.env
.env.local
.env.*.local
Use different keys per environment: Separate API keys for development, staging, and production
Validate environment variables: Check for required variables at startup
Use secrets management: For production, use services like AWS Secrets Manager, HashiCorp Vault, or your platform's secrets management
// config/validate.ts
const requiredEnvVars = [
'METORIAL_API_KEY',
'METORIAL_DEPLOYMENT_ID'
];
for (const envVar of requiredEnvVars) {
if (!process.env[envVar]) {
throw new Error(`Missing required environment variable: ${envVar}`);
}
}
With proper configuration, your Metorial integration will be secure, maintainable, and easy to deploy across different environments.
Connect Mistral AI to over 600 integrations with Metorial's developer-friendly platform built on the Model Context Protocol. Our open-source SDKs for Python and TypeScript make it effortless to give your Mistral-powered agents access to productivity tools, databases, APIs, and services without writing complex integration code. Add capabilities like calendar management, email automation, CRM access, and data retrieval to your Mistral applications in just a couple of lines of code. Metorial handles all the integration complexity—authentication, API calls, error handling, and maintenance—so you can focus on creating intelligent agent behaviors and exceptional user experiences. Whether you're building conversational AI, document analysis tools, or workflow automation with Mistral's efficient and powerful language models, Metorial provides the infrastructure to connect your agents to real-world tools seamlessly. Our MCP-native approach ensures your integrations are standardized, maintainable, and easy to extend. Stop spending valuable engineering time on integration plumbing and start shipping AI features that matter to your users.
Let's take your AI-powered applications to the next level, together.
Metorial provides developers with instant access to 600+ MCP servers for building AI agents that can interact with real-world tools and services. Built on MCP, Metorial simplifies agent tool integration by offering pre-configured connections to popular platforms like Google Drive, Slack, GitHub, Notion, and hundreds of other APIs. Our platform supports all major AI agent frameworks—including LangChain, AutoGen, CrewAI, and LangGraph—enabling developers to add tool calling capabilities to their agents in just a few lines of code. By eliminating the need for custom integration code, Metorial helps AI developers move from prototype to production faster while maintaining security and reliability. Whether you're building autonomous research agents, customer service bots, or workflow automation tools, Metorial's MCP server library provides the integrations you need to connect your agents to the real world.