
Research
/Security News
Compromised npm Packages in the AsyncAPI Namespace Deliver Miasma Botnet Loader
4 compromised asyncapi packages deliver miasma botnet loader on macOS, Linux and Windows.
@mastra/client-js
Advanced tools
Affected versions:
JavaScript/TypeScript client library for the Mastra AI framework. This client provides a simple interface to interact with Mastra AI's APIs for agents, vectors, memory, tools, and workflows.
npm install @mastra/client-js
import { MastraClient } from '@mastra/client-js';
// Initialize the client
const client = new MastraClient({
baseUrl: 'http://localhost:4111', // Your Mastra API endpoint
});
// Example: Working with an Agent
async function main() {
// Get an agent instance
const agent = client.getAgent('your-agent-id');
// Generate a response
const response = await agent.generate([{ role: 'user', content: "What's the weather like today?" }]);
console.log(response);
}
The client can be configured with several options:
const client = new MastraClient({
baseUrl: string; // Base URL for the Mastra API
retries?: number; // Number of retry attempts (default: 3)
backoffMs?: number; // Initial backoff time in ms (default: 300)
maxBackoffMs?: number; // Maximum backoff time in ms (default: 5000)
headers?: Record<string, string>; // Custom headers
});
listAgents(): Get all available agentsgetAgent(agentId): Get a specific agent instance
agent.details(): Get agent detailsagent.generate(params): Generate a response
agent.generateLegacy(params): Legacy API for generating a response (V1 models)agent.stream(params): Stream a responseagent.streamLegacy(params): Legacy API for streaming a response (V1 models)agent.getTool(toolId): Get agent tool detailsagent.evals(): Get agent evaluationsagent.liveEvals(): Get live evaluationslistMemoryThreads(params): Get memory threadscreateMemoryThread(params): Create a new memory threadgetMemoryThread({ threadId, agentId }): Get a memory thread instancesaveMessageToMemory(params): Save messages to memorygetMemoryStatus(): Get memory system statusgetWorkingMemory({ agentId, threadId, resourceId? }): Get working memory for a threadupdateWorkingMemory({ agentId, threadId, workingMemory, resourceId? }): Update working memory for a threadlistTools(): Get all available toolsgetTool(toolId): Get a tool instance
tool.details(): Get tool detailstool.execute(params): Execute the toollistWorkflows(): Get all workflowsgetWorkflow(workflowId): Get a workflow instance
workflow.details(): Get workflow detailsworkflow.createRun(): Create workflow runworkflow.startAsync(params): Execute the workflow and wait for execution resultsworkflow.resumeAsync(params): Resume suspended workflow step asyncworkflow.start({runId, triggerData}): Start a workflow run syncworkflow.resume(params): Resume the workflow run syncgetVector(vectorName): Get a vector instance
vector.details(indexName): Get vector index detailsvector.delete(indexName): Delete a vector indexvector.getIndexes(): Get all indexesvector.createIndex(params): Create a new indexvector.upsert(params): Upsert vectorsvector.query(params): Query vectorslistLogs(params): Get system logsgetLog(params): Get specific log entrylistLogTransports(): Get configured Log transportsgetTelemetry(params): Get telemetry dataThe client includes built-in retry logic for failed requests:
The client uses the native fetch API internally for making HTTP requests. All requests are automatically handled with:
FAQs
The official TypeScript library for the Mastra Client API
The npm package @mastra/client-js receives a total of 118,258 weekly downloads. As such, @mastra/client-js popularity was classified as popular.
We found that @mastra/client-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
4 compromised asyncapi packages deliver miasma botnet loader on macOS, Linux and Windows.

Research
/Security News
A compromised jscrambler npm release added a malicious preinstall hook that runs hidden native binaries on Linux, macOS, and Windows.

Research
/Security News
A malicious .NET package is typosquatting the Braintree SDK to steal live payment card data, merchant API keys, and host secrets from production apps.