mirror of
https://github.com/mastra-ai/mastra.git
synced 2026-11-17 08:44:46 +00:00
feat: make your IDE or agent into a Mastra expert via MCP (#2966)
This turns your IDE or agent into a Mastra expert with up to date
knowledge of Mastra!
It can look up specific docs (evals, rag, storage, deployer, getting
started, etc), read the blog, check code examples, and read
`CHANGELOG.md` for any Mastra package. Works in a Mastra agent, cursor,
windsurf, claude, goose, etc - any MCP client.
Trying this PR locally in cursor:
- checkout the PR
- `pnpm build:packages`
- Add this file with the correct absolute path to your local Mastra repo
in the args. This file should be placed in
`some_project_root/.cursor/mcp.json`
MacOS/Linux
```json
{
"mcpServers": {
"mastra": {
"command": "npx",
"args": [
"-y",
"tsx",
"[FULL_PATH_TO_MASTRA_REPO]/packages/mcp-docs-server/src/stdio.ts"
]
}
}
}
```
Windows:
```json
{
"mcpServers": {
"mastra": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"tsx",
"[FULL_PATH_TO_MASTRA_REPO]/packages/mcp-docs-server/src/stdio.ts"
]
}
}
}
```
Questions:
1. ~~Naming? I called it `@mastra/docs-mcp` @calcsam @smthomas thoughts?
We need it to be different enough from our `@mastra/mcp` package~~ Sam
suggested asking claude and it came up with `@mastra/mcp-docs-server`
which seems fitting to me.
2. To make it so this package is bumped and released with any other
package change I added _every_ mastra package as a devDep. @wardpeet I
feel like this is not the right approach but I couldn't see in changeset
docs how to make it bump with every package change. Any ideas?
Follow ups:
1. Need to add this to `pnpm create mastra` as an option to install in
cursor/windsurf automatically when scaffolding a new project. Will
follow up in another PR once this is published and available on npm
2. Need to add proper docs - this PR only has a README
3. ~~[It needs to self
update](https://www.perplexity.ai/search/npm-npx-self-updater-Va1mguxQSZmltavk62iaWQ#1)
- otherwise it will eventually be out of date. It should periodically
check for new versions of itself. Maybe the server should run a
subprocess and communicate via IPC so it can kill and restart the
subprocess when it updates. This will become an issue basically as soon
as folks start using this longer than a week~~ actually I'll change the
instructions to include `@latest` so restarting the mcp server will
update
4. We should add a tool so the agent can query GH issues when the user
or code is having a problem. And another tool to fill out an issue
template and open it in their browser for them
Demo:
Here I only prompted about 4 times and it can do a lot with very little
input. There are some things it said wrong (passing the agent to an api
key in useChat) but we can use these kinds of errors to improve our
docs. In cursor/windsurf the agent will also figure it out itself. When
it reads docs and writes code that's broken I've seen it check the docs
again and fix the code.
<img width="909" alt="Screenshot 2025-03-14 at 9 50 48 AM"
src="https://github.com/user-attachments/assets/4586c6ee-b182-42ae-a323-3f0c592f7552"
/>
<img width="884" alt="Screenshot 2025-03-14 at 9 50 22 AM"
src="https://github.com/user-attachments/assets/152d9173-2b06-4377-b67c-15558cd437b4"
/>
<img width="857" alt="Screenshot 2025-03-14 at 9 50 28 AM"
src="https://github.com/user-attachments/assets/fd30af8f-017a-43b5-bee5-67e47596feb8"
/>
<img width="892" alt="Screenshot 2025-03-14 at 9 51 11 AM"
src="https://github.com/user-attachments/assets/9d6f7612-5c02-4c11-beca-bb836dc1922c"
/>
<img width="894" alt="Screenshot 2025-03-14 at 9 51 20 AM"
src="https://github.com/user-attachments/assets/86f21ac8-d015-4dd0-b72e-0b96177a3895"
/>
<img width="909" alt="Screenshot 2025-03-14 at 9 51 29 AM"
src="https://github.com/user-attachments/assets/fd6f4faf-1383-4471-8885-9869725f50f4"
/>
<img width="912" alt="Screenshot 2025-03-14 at 9 51 44 AM"
src="https://github.com/user-attachments/assets/abdc405d-1a80-4043-aad7-acb81ce23e72"
/>
<img width="902" alt="Screenshot 2025-03-14 at 9 51 59 AM"
src="https://github.com/user-attachments/assets/0efbab16-8f53-4c33-b34a-f32139c06a00"
/>
<img width="903" alt="Screenshot 2025-03-14 at 9 52 07 AM"
src="https://github.com/user-attachments/assets/0ab1000e-9739-4388-8d3f-83098756bcdd"
/>
<img width="898" alt="Screenshot 2025-03-14 at 9 52 14 AM"
src="https://github.com/user-attachments/assets/c0ab9f8f-b9f2-4694-af59-d17cf613360f"
/>
<img width="895" alt="Screenshot 2025-03-14 at 9 52 24 AM"
src="https://github.com/user-attachments/assets/a0181467-84f9-4df0-a11c-0cc0ecaec5fb"
/>
<img width="907" alt="Screenshot 2025-03-14 at 9 52 42 AM"
src="https://github.com/user-attachments/assets/5bc6c81b-ce47-4907-b7a4-006032933001"
/>
<img width="916" alt="Screenshot 2025-03-14 at 9 53 37 AM"
src="https://github.com/user-attachments/assets/bdc1ddf0-fa24-4b30-acb4-f25d39e02313"
/>
<img width="894" alt="Screenshot 2025-03-14 at 9 54 40 AM"
src="https://github.com/user-attachments/assets/d81b75fd-4cda-4380-a1bb-f57d0cdbccaf"
/>
<img width="894" alt="Screenshot 2025-03-14 at 9 54 53 AM"
src="https://github.com/user-attachments/assets/faf04696-09d4-4b7e-892e-dbbe75acea5e"
/>
<img width="898" alt="Screenshot 2025-03-14 at 10 01 29 AM"
src="https://github.com/user-attachments/assets/ef3645b1-4d57-4f87-a999-4c2cce9fce38"
/>
<img width="899" alt="Screenshot 2025-03-14 at 10 02 04 AM"
src="https://github.com/user-attachments/assets/10345772-937b-4cb6-ae58-11fb94b86b9c"
/>
This commit is contained in:
parent
da8d9bbec9
commit
65f2a4ca37
35 changed files with 2036 additions and 435 deletions
38
.github/workflows/test-docs-mcp.yml
vendored
38
.github/workflows/test-docs-mcp.yml
vendored
10
.github/workflows/version-packages.yml
vendored
10
.github/workflows/version-packages.yml
vendored
2
packages/mcp-docs-server/.gitignore
vendored
2
packages/mcp-docs-server/.gitignore
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
984
pnpm-lock.yaml
generated
984
pnpm-lock.yaml
generated
Loading…
Add table
Add a link
Reference in a new issue