Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
69 lines
2.2 KiB
Plaintext
69 lines
2.2 KiB
Plaintext
---
|
|
title: Mastra
|
|
sidebarTitle: Mastra
|
|
description: TypeScript framework for building AI agents
|
|
---
|
|
|
|
[Mastra](https://mastra.ai) is a TypeScript framework for building AI agents. It provides first-class MCP support through its `MCPClient` class. By connecting Context7 as an MCP server, your Mastra agents can access up-to-date library documentation, enabling them to generate accurate code and answer technical questions with current API references.
|
|
|
|
For more details on how Mastra handles MCP, see the [Mastra MCP documentation](https://mastra.ai/docs/mcp/overview).
|
|
|
|
## Setup
|
|
|
|
<Steps>
|
|
<Step title="Install the MCP Package">
|
|
Add the Mastra MCP package to your project:
|
|
|
|
```bash
|
|
npm install @mastra/mcp@latest
|
|
```
|
|
</Step>
|
|
<Step title="Create an MCP Client">
|
|
Configure an `MCPClient` that connects to Context7:
|
|
|
|
```typescript
|
|
import { MCPClient } from "@mastra/mcp";
|
|
|
|
const context7 = new MCPClient({
|
|
id: "context7",
|
|
servers: {
|
|
context7: {
|
|
url: new URL("https://mcp.context7.com/mcp"),
|
|
requestInit: {
|
|
headers: {
|
|
CONTEXT7_API_KEY: process.env.CONTEXT7_API_KEY!,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
```
|
|
|
|
Set `CONTEXT7_API_KEY` in your environment with your API key from the [Context7 dashboard](https://context7.com/dashboard).
|
|
</Step>
|
|
<Step title="Connect to Your Agent">
|
|
Pass the Context7 tools to your Mastra agent:
|
|
|
|
```typescript
|
|
import { Agent } from "@mastra/core/agent";
|
|
|
|
const agent = new Agent({
|
|
id: "coding-assistant",
|
|
name: "Coding Assistant",
|
|
instructions: "You are a helpful coding assistant with access to up-to-date library documentation via Context7.",
|
|
model: "anthropic/claude-sonnet-4-6",
|
|
tools: await context7.listTools(),
|
|
});
|
|
```
|
|
</Step>
|
|
</Steps>
|
|
|
|
## How It Works
|
|
|
|
Once connected, your Mastra agents will query Context7 for relevant library documentation. This helps agents:
|
|
|
|
- Answer technical questions with accurate, up-to-date API references
|
|
- Generate code that follows current library patterns and best practices
|
|
- Avoid hallucinating outdated or incorrect API usage
|
|
- Provide version-specific guidance for any supported library
|