Skip to content

Commit 7860f51

Browse files
committed
docs: update readme
1 parent 333b1b1 commit 7860f51

File tree

1 file changed

+103
-2
lines changed

1 file changed

+103
-2
lines changed

README.md

Lines changed: 103 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# vite-plugin-vue-mcp
22

3+
[![npm version][npm-version-src]][npm-version-href]
4+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
5+
[![bundle][bundle-src]][bundle-href]
6+
[![License][license-src]][license-href]
7+
38
Vite plugin that enables a MCP server for your Vue app to provide information about the component tree, state, routes, and pinia tree and state.
49

510
## Installation 📦
@@ -19,32 +24,128 @@ export default defineConfig({
1924
})
2025
```
2126

22-
## Features ✨
27+
Then the MCP server will be available at `http://localhost:[port]/__mcp/sse`.
28+
29+
If you are using Cursor, create a `.cursor/mcp.json` file in your project root, this plugin will automatically update it for you. For more details about the MCP, check the [official Cursor documentation](https://docs.cursor.com/context/model-context-protocol).
30+
31+
### Options
32+
33+
```ts
34+
export interface VueMcpOptions {
35+
/**
36+
* The host to listen on, default is `localhost`
37+
*/
38+
host?: string
39+
40+
/**
41+
* The port to listen on, default is the port of the Vite dev server
42+
*/
43+
port?: number
44+
45+
/**
46+
* Print the MCP server URL in the console
47+
*
48+
* @default true
49+
*/
50+
printUrl?: boolean
51+
52+
/**
53+
* The MCP server info. Ingored when `mcpServer` is provided
54+
*/
55+
mcpServerInfo?: McpServerInfo
56+
57+
/**
58+
* Custom MCP server, when this is provided, the built-in MCP tools will be ignored
59+
*/
60+
mcpServer?: (viteServer: ViteDevServer) => Awaitable<McpServer>
61+
62+
/**
63+
* Setup the MCP server, this is called when the MCP server is created
64+
* You may also return a new MCP server to replace the default one
65+
*/
66+
mcpServerSetup?: (server: McpServer, viteServer: ViteDevServer) => Awaitable<void | McpServer>
67+
68+
/**
69+
* The path to the MCP server, default is `/__mcp`
70+
*/
71+
mcpPath?: string
72+
73+
/**
74+
* Update the address of the MCP server in the cursor config file `.cursor/mcp.json`,
75+
* if `.cursor` folder exists.
76+
*
77+
* @default true
78+
*/
79+
updateCursorMcpJson?: boolean | {
80+
enabled: boolean
81+
/**
82+
* The name of the MCP server, default is `vue-mcp`
83+
*/
84+
serverName?: string
85+
}
86+
87+
/**
88+
* append an import to the module id ending with `appendTo` instead of adding a script into body
89+
* useful for projects that do not use html file as an entry
90+
*
91+
* WARNING: only set this if you know exactly what it does.
92+
* @default ''
93+
*/
94+
appendTo?: string | RegExp
95+
}
96+
```
97+
98+
## Features/Tools ✨
2399

24100
### Get Component Tree
25101

102+
`get-component-tree`: Get the Vue component tree.
103+
26104
![component-tree](./screenshots/component-tree.gif)
27105

28106
### Get Component State
29107

108+
`get-component-state`: Get the state of a component (input: `componentName`).
109+
30110
![component-state](./screenshots/component-state.gif)
31111

32112
### Get Routes
33113

114+
`get-router-info`: Get the Vue router info of the application.
115+
34116
![route-tree](./screenshots/router-info.gif)
35117

36118
### Get Pinia Tree
37119

120+
`get-pinia-tree`: Get the Pinia tree of the application.
121+
38122
![pinia-tree](./screenshots/pinia-tree.gif)
39123

40124
### Get Pinia State
41125

126+
`get-pinia-state`: Get the Pinia state of the application (input: `storeName`).
127+
42128
![pinia-state](./screenshots/pinia-state.gif)
43129

44130
## Notice 💡
45131

46-
**Please ensure the application is open in your browser when using this plugin.**
132+
**Please ensure the application is running in your browser before using the features.**
47133

48134
## Credits 💖
49135

50136
This project is inspired by [vite-plugin-mcp](https://github.com/antfu/nuxt-mcp/tree/main/packages/vite-plugin-mcp). Thanks to [@antfu](https://github.com/antfu) for the great work.
137+
138+
## License 📖
139+
140+
[MIT](./LICENSE) License © [Arlo](https://github.com/webfansplz)
141+
142+
<!-- Badges -->
143+
144+
[npm-version-src]: https://img.shields.io/npm/v/vite-plugin-vue-mcp?style=flat&colorA=080f12&colorB=1fa669
145+
[npm-version-href]: https://npmjs.com/package/vite-plugin-vue-mcp
146+
[npm-downloads-src]: https://img.shields.io/npm/dm/vite-plugin-vue-mcp?style=flat&colorA=080f12&colorB=1fa669
147+
[npm-downloads-href]: https://npmjs.com/package/vite-plugin-vue-mcp
148+
[bundle-src]: https://img.shields.io/bundlephobia/minzip/vite-plugin-vue-mcp?style=flat&colorA=080f12&colorB=1fa669&label=minzip
149+
[bundle-href]: https://bundlephobia.com/result?p=vite-plugin-vue-mcp
150+
[license-src]: https://img.shields.io/github/license/webfansplz/vite-plugin-vue-mcp.svg?style=flat&colorA=080f12&colorB=1fa669
151+
[license-href]: https://github.com/webfansplz/vite-plugin-vue-mcp/blob/main/LICENSE

0 commit comments

Comments
 (0)