{"id":31892020,"url":"https://github.com/colinaaa/rsbuild-plugin-mcp","last_synced_at":"2025-10-16T20:44:20.415Z","repository":{"id":318711683,"uuid":"1073428986","full_name":"colinaaa/rsbuild-plugin-mcp","owner":"colinaaa","description":null,"archived":false,"fork":false,"pushed_at":"2025-10-10T14:01:27.000Z","size":49,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-10T15:54:31.388Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/colinaaa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-10T05:24:14.000Z","updated_at":"2025-10-10T14:00:59.000Z","dependencies_parsed_at":"2025-10-10T15:54:45.991Z","dependency_job_id":"0c1a42fb-8abf-426a-b45f-6d9ce4574074","html_url":"https://github.com/colinaaa/rsbuild-plugin-mcp","commit_stats":null,"previous_names":["colinaaa/rsbuild-plugin-mcp"],"tags_count":1,"template":false,"template_full_name":"rspack-contrib/rsbuild-plugin-template","purl":"pkg:github/colinaaa/rsbuild-plugin-mcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinaaa%2Frsbuild-plugin-mcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinaaa%2Frsbuild-plugin-mcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinaaa%2Frsbuild-plugin-mcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinaaa%2Frsbuild-plugin-mcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/colinaaa","download_url":"https://codeload.github.com/colinaaa/rsbuild-plugin-mcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinaaa%2Frsbuild-plugin-mcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018331,"owners_count":26086352,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-13T08:24:08.035Z","updated_at":"2025-10-15T11:52:02.782Z","avatar_url":"https://github.com/colinaaa.png","language":"TypeScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Rsbuild Plugins"],"readme":"# rsbuild-plugin-mcp\n\nRsbuild plugin that enables a MCP server for your Rsbuild app to provide information about your setup and modules graphs.\n\n\u003cp\u003e\n  \u003ca href=\"https://npmjs.com/package/rsbuild-plugin-mcp\"\u003e\n   \u003cimg src=\"https://img.shields.io/npm/v/rsbuild-plugin-mcp?style=flat-square\u0026colorA=564341\u0026colorB=EDED91\" alt=\"npm version\" /\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square\u0026colorA=564341\u0026colorB=EDED91\" alt=\"license\" /\u003e\n  \u003ca href=\"https://npmcharts.com/compare/rsbuild-plugin-mcp?minimal=true\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/rsbuild-plugin-mcp.svg?style=flat-square\u0026colorA=564341\u0026colorB=EDED91\" alt=\"downloads\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Usage\n\nInstall:\n\n```bash\nnpm add rsbuild-plugin-mcp -D\n```\n\nAdd plugin to your `rsbuild.config.ts`:\n\n```ts\nimport { defineConfig } from '@rsbuild/core';\nimport { pluginMcp } from 'rsbuild-plugin-mcp';\n\nexport default defineConfig({\n  plugins: [pluginMcp()],\n});\n```\n\n## Options\n\n### `mcpRouteRoot`\n\n- Type: `string | undefined`\n- Default: `/__mcp`\n\nCustomize the routes of the MCP server.\n\n- Example:\n\n```ts\nimport { defineConfig } from '@rsbuild/core';\nimport { pluginMcp } from 'rsbuild-plugin-mcp';\n\nexport default defineConfig({\n  plugins: [\n    pluginMcp({\n      mcpRouteRoot: '/api/__mcp',\n    }),\n  ],\n});\n```\n\n## Customize the MCP server\n\nThe MCP server can be extended with the following ways:\n\n### With plugin options\n\nUse the `mcpServerSetup` to customize the MCP server.\n\n```ts\nimport { defineConfig } from '@rsbuild/core';\nimport { pluginMcp } from 'rsbuild-plugin-mcp';\n\nexport default defineConfig({\n  plugins: [\n    pluginMcp({\n      mcpServerSetup(mcpServer) {\n        // Register tools, resources and prompts\n        mcpServer.tool(); /** args */\n        mcpServer.resource(); /** args */\n        mcpServer.prompt(); /** args */\n      },\n    }),\n  ],\n});\n```\n\nYou may also return a new `McpServer` instance to replace the default one:\n\n```js\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { defineConfig } from '@rsbuild/core';\nimport { pluginMcp } from 'rsbuild-plugin-mcp';\n\nexport default defineConfig({\n  plugins: [\n    pluginMcp({\n      mcpServerSetup() {\n        // Create a new `McpServer` and return\n        const mcpServer = new McpServer();\n        // Register tools, resources and prompts\n        mcpServer.tool();\n        return mcpServer;\n      },\n    }),\n  ],\n});\n```\n\n### With other plugins\n\nThis plugin exposes the `McpServer` instance using [`api.expose`](https://rsbuild.rs/plugins/dev/core#apiexpose).\n\nYou may use [`api.useExposed`](https://rsbuild.rs/plugins/dev/core#apiuseexposed) to get the instance and make customization:\n\n```ts\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { RsbuildPlugin } from '@rsbuild/core'\n\nexport function pluginFoo(): RsbuildPlugin {\n  return {\n    name: 'plugin-foo',\n    pre: ['plugin-mcp'],\n    setup(api) {\n      if (api.isPluginExists('plugin-mcp')) {\n        const mcpServer = api.useExposed\u003cMcpServer\u003e('rsbuild-plugin-mcp:mcpServer')!\n        // Register tools, resources and prompts\n        mcpServer.tool(/** args */)\n        mcpServer.resource(/** args */)\n        mcpServer.prompt(/** args */)\n      }\n    },\n  },\n}\n```\n\n## Credits\n\nThis plugin is inspired by [vite-plugin-mcp](https://github.com/antfu/nuxt-mcp/tree/main/packages/vite-plugin-mcp). Both the implementation and documentation have been adapted and referenced from the original Vite plugin.\n\n## License\n\n[MIT](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolinaaa%2Frsbuild-plugin-mcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcolinaaa%2Frsbuild-plugin-mcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolinaaa%2Frsbuild-plugin-mcp/lists"}