Skip to main content
The Mastra provider wraps Composio tools for use with the Mastra.ai framework.

Installation

npm install @composio/mastra @mastra/core

Quick Start

import { Composio } from '@composio/core';
import { MastraProvider } from '@composio/mastra';
import { Mastra } from '@mastra/core';

const composio = new Composio({
  apiKey: 'your-composio-key',
  provider: new MastraProvider()
});

const tools = await composio.tools.get('default', {
  toolkits: ['github']
});

const mastra = new Mastra({ tools });

const result = await mastra.run({
  prompt: 'Create a GitHub issue'
});

Strict Mode

Enable strict mode to remove non-required properties:
const composio = new Composio({
  apiKey: 'your-key',
  provider: new MastraProvider({ strict: true })
});

Tool Format

Tools are wrapped in Mastra’s tool format:
import { createTool } from '@mastra/core/tools';

// Each tool is wrapped as:
const tool = createTool({
  id: 'GITHUB_CREATE_ISSUE',
  description: 'Create a new GitHub issue',
  inputSchema: zodSchema,
  outputSchema: zodSchema,
  execute: async (input, context) => {
    return result;
  }
});

Tool Collection

Tools are organized in a dictionary:
interface MastraToolCollection {
  [key: string]: MastraTool;
}

Next Steps

Vercel AI SDK

Alternative framework

Tools API

Learn about tools

Build docs developers (and LLMs) love