Claude Code Mastra
Description
Claude Code SDK integration for Mastra Framework - TypeScript Agent implementation with comprehensive testing
Installation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open the source below and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
README
Claude Code × Mastra Agent Integration
This library integrates the Claude Code TypeScript SDK as an Agent within the Mastra framework.
Overview
This library adapts the Claude Code SDK to the Mastra Agent interface, enabling powerful coding assistance features of Claude Code within the Mastra framework.
Features
- Mastra Agent Compatible: Fully implements the Mastra Framework Agent interface
- Custom Tools: Supports Mastra Agent's tools feature
- MCP External Tools: Integrates external tools via Model Context Protocol
- Streaming Support: Real-time response processing
- Session Management: Tracks session state and manages resources
- Error Handling: Robust error handling mechanisms
- Configurable: Supports Claude Code-specific options
- Type Safe: Complete TypeScript type definitions
Installation
npm install @anthropic-ai/claude-code @mastra/core
Basic Usage
Simple Generation
import { ClaudeCodeAgent } from './claude-code-agent.js';
const agent = new ClaudeCodeAgent({
maxTurns: 3,
permissionMode: 'default'
});
const response = await agent.generate(
'Write a TypeScript function to calculate fibonacci numbers'
);
console.log(response.content);
console.log(response.metadata); // Session info, cost, etc.
Streaming
for await (const chunk of agent.stream('Create a REST API with Express.js')) {
if (chunk.type === 'content') {
console.log('Content:', chunk.data.content);
} else if (chunk.type === 'complete') {
console.log('Total cost:', chunk.data.totalCost);
}
}
Configuration Options
interface ClaudeCodeAgentOptions {
maxTurns?: number; // Max turns (default: 10)
allowedTools?: string[]; // Allowed tools
permissionMode?: 'default' | 'acceptEdits' | 'bypassPermissions';
workingDirectory?: string; // Working directory
timeout?: number; // Timeout (ms,
Related Skills
Spec Kit
💫 Toolkit to help you get started with Spec-Driven Development
Testing Webapp Testing
Test local web applications using Playwright for UI verification and debugging
Testing #29
, [#52](https://github.com/affaan-m/everything-claude-code/issues/52), [#103](https://github.com/affaan-m/ever
Testing Fix Issue
by metabase - Addresses GitHub issues by taking issue number as parameter, analyzing context, implementing sol
Testing Pypict Test Design
Design comprehensive test cases using PICT (Pairwise Independent Combinatorial Testing) for optimized test sui
Testing gstack
| 15,000+ | Garry Tan's exact Claude Code setup: 6 opinionated tools that serve as CEO, Eng Manager, Release M
Testing