templates/template-docs-chatbot/README.md
This template contains two main components:
The documentation agent uses the MCP client to connect to the MCP server and access the documentation tools. You can run both components together to have a complete documentation chatbot solution.
This template demonstrates how you can use Mastra to build an MCP server and connect it to a Mastra agent. This template is highly relevant for all documentation use cases.
<video controls width="640" height="360" src="https://res.cloudinary.com/mastra-assets/video/upload/v1772538182/template-docs-chatbot_ubfh1a.mp4"></video>
This demo runs in Mastra Studio, but you can connect this workflow to your React, Next.js, or Vue app using the Mastra Client SDK or agentic UI libraries like AI SDK UI, CopilotKit, or Assistant UI.
npx create-mastra@latest --template docs-chatbot to scaffold the project locally..env.example to .env and fill in your keys.npm run dev and open localhost:4111 to try it out.Open the Kepler Docs Agent and ask it a question like: "Tell me about the getPlanetaryData function". The agent will use the tools from the MCP server to fetch documentation about the function and provide a helpful response.
Replace src/mcp-server/data/functions.json with your own documentation data to create a custom documentation assistant for your project. Or change src/mcp-server/tools/docs-tool.ts completely to fetch data from another source. You can also modify the agent instructions in src/mastra/agents/docs-agent.ts to change how the agent responds.
Mastra templates are ready-to-use projects that show off what you can build — clone one, poke around, and make it yours. They live in the Mastra monorepo and are automatically synced to standalone repositories for easier cloning.
Want to contribute? See CONTRIBUTING.md.