Skip to content

Commit b42b85b

Browse files
committed
refactor: change main function to an immediately invoked async function
1 parent fb71c41 commit b42b85b

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

examples/with-composio-mcp/src/index.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@ import { VoltAgent, Agent, MCPConfiguration } from "@voltagent/core";
22
import { VercelAIProvider } from "@voltagent/vercel-ai";
33
import { openai } from "@ai-sdk/openai";
44

5-
async function main() {
5+
(async () => {
66
try {
77
const mcpConfig = new MCPConfiguration({
88
servers: {
99
composio: {
1010
type: "http",
1111
url: "https://mcp.composio.dev/composio/server/YOUR-SERVER-ID",
12-
}
12+
},
1313
},
1414
});
15-
15+
1616
const agent = new Agent({
1717
name: "Composio MCP Agent",
1818
description: "A helpful assistant using a lightweight provider",
1919
tools: await mcpConfig.getTools(),
2020
llm: new VercelAIProvider(),
2121
model: openai("gpt-4o-mini"),
2222
});
23-
23+
2424
new VoltAgent({
2525
agents: {
2626
agent,
@@ -29,6 +29,4 @@ async function main() {
2929
} catch (error) {
3030
console.error("Failed to initialize VoltAgent:", error);
3131
}
32-
}
33-
34-
main();
32+
})();

0 commit comments

Comments
 (0)