Build advanced AI agents with Deepseek. Connect 600+ integrations, automate workflows, and deploy with ease using Metorial.
Properly configuring environment variables is crucial for security and flexibility when using Metorial with the AI SDK.
METORIAL_API_KEY=your-metorial-api-key-here
This authenticates your application with Metorial's platform.
Depending on which AI model you're using:
# For OpenAI
OPENAI_API_KEY=your-openai-key
# For Anthropic
ANTHROPIC_API_KEY=your-anthropic-key
# For Google
GOOGLE_GENERATIVE_AI_API_KEY=your-google-key
While not required as an environment variable, it's a good practice:
SERVER_DEPLOYMENT_ID=your-deployment-id
Create a .env
file in your project root:
METORIAL_API_KEY=mtl_xxxxxxxxxxxxx
OPENAI_API_KEY=sk-xxxxxxxxxxxxx
SERVER_DEPLOYMENT_ID=deployment-xxxxx
Important: Add .env
to your .gitignore
:
.env
.env.local
.env.*.local
Most frameworks load .env
automatically. For Node.js, use dotenv:
npm install dotenv
import 'dotenv/config';
// Now process.env.METORIAL_API_KEY is available
--env-file
flag or environment sections in docker-compose.ymlimport { Metorial } from 'metorial';
const metorial = new Metorial({
apiKey: process.env.METORIAL_API_KEY!
});
await metorial.withProviderSession(
metorialAiSdk,
{
serverDeployments: [process.env.SERVER_DEPLOYMENT_ID!]
},
async session => {
// Your code here
}
);
Always validate environment variables at startup:
const requiredEnvVars = [
'METORIAL_API_KEY',
'OPENAI_API_KEY',
'SERVER_DEPLOYMENT_ID'
];
for (const envVar of requiredEnvVars) {
if (!process.env[envVar]) {
throw new Error(`Missing required environment variable: ${envVar}`);
}
}
For larger applications, create a configuration module:
// config.ts
export const config = {
metorial: {
apiKey: process.env.METORIAL_API_KEY!,
deploymentId: process.env.SERVER_DEPLOYMENT_ID!
},
openai: {
apiKey: process.env.OPENAI_API_KEY!
}
};
// Validate on import
if (!config.metorial.apiKey) {
throw new Error('METORIAL_API_KEY is required');
}
Use different variables for different environments:
# .env.development
METORIAL_API_KEY=mtl_dev_xxxxx
SERVER_DEPLOYMENT_ID=dev-deployment-id
# .env.production
METORIAL_API_KEY=mtl_prod_xxxxx
SERVER_DEPLOYMENT_ID=prod-deployment-id
.env
file exists.env
is in the correct directoryPower your Deepseek AI agents with Metorial's extensive integration library featuring over 600 tools and services. Our MCP-powered platform makes it incredibly simple to connect Deepseek models to the APIs and services your applications need. With Metorial's TypeScript and Python SDKs, you can add integrations to your Deepseek-based agents in just a couple of lines of code, eliminating weeks of custom integration development. Whether you're building code assistants, data analysis tools, or intelligent automation with Deepseek's advanced models, Metorial provides instant connectivity to productivity tools, databases, communication platforms, and more. Our open-source, developer-first approach means you maintain full control while we handle the complexity of authentication, rate limiting, error handling, and API versioning. Focus your engineering resources on creating unique AI experiences rather than maintaining integration code. Join the growing community of developers who trust Metorial to handle their integration needs while they concentrate on innovation and delivering value to their 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.