شعار unplugin-mcp

unplugin-mcp

المجتمع
situ2001

A unified plugin for developers integrating MCP servers into modern JavaScript build tools, including Webpack, Rollup, Vite, and more.

الناشرsitu2001
المستودعunplugin-mcp
اللغةTypeScript
التفريعات
2
النجوم
31
الأدوات المتاحة
0
نوع نقل البياناتstdio
الفئات
الترخيصMIT
الروابط
  • اربط الأدوات بسير عمل الذكاء الاصطناعي

    يتيح unplugin-mcp إمكانات MCP التي يمكن لتطبيقات الذكاء الاصطناعي العميلة ووكلاء الذكاء الاصطناعي المتوافقة استخدامها.

  • الأدوات المتاحة: 0

    تصفّح الإجراءات القابلة للاستدعاء أدناه، بما في ذلك أسماؤها وأوصافها عندما يوفّرها الخادم.

  • إعدادات جاهزة للنسخ

    استخدم أمثلة إعداد التثبيت لتهيئة هذا الخادم في تطبيق MCP العميل المفضّل لديك.

  • مؤشرات الاهتمام بالمصدر المفتوح

    النجوم: 31، والنسخ المتفرعة: 2 في المستودع المرتبط.

unplugin-mcp

GitHub Repo npm version npm download npm license

[!IMPORTANT] This is a work in progress. Not ready for production use yet. If you are interested in and want to help, feel free to open an issue or PR.

A unified MCP (Model Context Protocol) plugin that creates and manages an MCP Server and provides MCP tools by which AI can know more about your codebase, build tools, and even control the build process. It works with multiple JavaScript build tools supported by unplugin, including Rollup, Vite, Webpack, and others.

Here is the vision of this plugin, to provide a unified MCP Server and MCP tools to MCP Client.

Features

  • 🚀 Cross-Platform MCP Integration: Creates and manages an MCP server seamlessly across multiple build tools.
  • 🧩 Bi-directional AI Integration: Not only provides context to AI assistants about your codebase, but also enables AI to actively modify and control your build process.
  • 🧰 Rich built-in tools: Collection of built-in tools for analyzing module dependencies, inspecting build configuration, debugging error messages, and so on.
  • 🛠️ Extensible Tool Framework: Create custom MCP tools with the simple UnpluginMcpTool interface to expose project-specific information or functionality.
  • 🔍 Build Process Integration: Seamlessly integrates at any point in the plugin chain and hooks of your build tools like Rollup.
  • 🔄 Persistent Server: Keeps running even after build completion in watch mode, enabling continuous AI interaction.
  • 🌐 Standard Transport Layer: Uses HTTP and Server-Sent Events (SSE) for broad compatibility with AI assistants implementing the MCP protocol.

Installation

bash
# Install the plugin
pnpm add -D unplugin-mcp

# or install bundler-specific one, it shares the same codebase but only exports the plugin for the specific bundler
pnpm add -D rollup-plugin-mcp

Usage

Build Tool Integration

Here is an example of how to use the plugin with Rollup. The server will be started automatically when you run rollup in watch mode (rollup -w).

js
// rollup.config.js
import { defineConfig } from 'rollup';
import { rollupPlugin as mcp } from 'unplugin-mcp';

// import some built-in tools
import { ModuleTool, BuildConfigTool, BuildErrorTool } from 'unplugin-mcp/tools';

export default defineConfig({
  plugins: [
    // other plugins...
    mcp({
      provideUnpluginMcpTools: () => [
        new ModuleTool(),
        new BuildConfigTool(),
        new BuildErrorTool()
      ]
    }),
    // other plugins...
  ]
});

🚧 Usage on other bundlers is on the way.

Usage in Cursor

Just add a MCP Server to Cursor Settings. For example, in ~/.config/cursor/mcp.json:

json
{
  "mcpServers": {
    "rollup": {
      "url": "http://localhost:14514/mcp/sse"
    }
  }
}

Options

Check McpPluginOptions in types file for all available options.

Built-in Tools Compatibility

Notes: Currently, implementation of built-in tools is relatively simple and may not cover all edge cases.

ToolDescriptionRollupWebpack
ModuleToolAnalyze module dependencies and imports✅❌
BuildConfigToolInspect build configuration✅✅
BuildErrorToolDebug build errors✅✅
BundleSizeToolInspect size of bundle and its modules✅❌
  • ✅ = Supported
  • ❌ = Not yet implemented

Custom Tools

You can extend the plugin with custom tools implementing the UnpluginMcpTool interface:

typescript
import { InputOptions } from "rollup";
import { UnpluginMcpTool, UnpluginMcpToolSetupOptions } from "unplugin-mcp";
import DeferredCtor, { Deferred } from 'promise-deferred';
import { UnpluginOptions } from "unplugin";

export class BuildConfigTool implements UnpluginMcpTool {
  private buildConfig: Deferred<InputOptions>;

  affectsBuildProcess: boolean = false;

  constructor() {
    this.buildConfig = new DeferredCtor<InputOptions>();
  }

  setupMcpServer(mcpServer: any, options?: any) {
    mcpServer.tool(
      `get-build-config`,
      "Get build configuration",
      {},
      async () => {
        const cfg = await this.buildConfig.promise;

        return {
          content: [
            {
              type: 'text',
              text: `Build configuration: ${JSON.stringify(cfg)}`
            }
          ]
        };
      }
    );

    return mcpServer;
  }

  registerPlugins(options?: UnpluginMcpToolSetupOptions): UnpluginOptions {
    let self = this;

    return {
      name: 'build-config-tool',

      rollup: {
        options(config) {
          self.buildConfig.resolve(config);
        }
      }
    }
  }
}

And then register it in the plugin options, for example, in the Rollup config:

js
// rollup.config.js
// ... 
plugins: [
  mcp({
    provideUnpluginMcpTools: () => [
      new BuildConfigTool()
    ]
  })
]
// ...

Examples

Check out the examples directory for working examples, including:

  • simple-hello: A basic example demonstrating MCP integration with Rollup

How it works

It initializes and setup these components:

  1. Creates and setup a singleton MCP server instance.
  2. Registers some UnpluginMcpTool instances to the MCP server.
  3. Creates an HTTP server and sets up HTTP routes for the MCP server.
  4. Starts the HTTP server, listening on the specified port and host.
  5. Registers the hooks created by UnpluginMcpTool instances to build tools.

After these steps, the plugin can:

  1. Handle incoming requests from MCP client and responding to them.
  2. React to hooks triggered by the build tool during the build process.
  3. Provide build contextual information to the MCP client.

License

MIT License. Copyright (c) 2025 situ2001.

التثبيت

TypingMind
المتطلبات المسبقة:

Node.js 18+

{
  "mcpServers": {
    "situ2001-unplugin-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "unplugin-mcp"
      ]
    }
  }
}

استخدم MCP الخاص بـ unplugin-mcp مع نماذج ذكاء اصطناعي متعددة

يربط TypingMind أدوات MCP على مستوى مساحة العمل، لذا بمجرد توصيل unplugin-mcp، يمكنك استخدامه مع نماذج ذكاء اصطناعي مختلفة في TypingMind بدلًا من إعداده لكل نموذج على حدة. يعمل تكامل MCP هذا محليًا عبر موصل MCP الخاص بـ TypingMind على جهازك.

دليل الإعداد لاستخدام الموصل المحلي

استخدم هذا الخيار عندما يحتاج خادم MCP إلى الوصول إلى ملفات محلية أو تطبيقات أو موارد خاصة على جهاز الكمبيوتر لديك.

1

فتح إعدادات MCP

في TypingMind، انتقل إلى «الإعدادات»، ثم «الإعدادات المتقدمة»، ثم «بروتوكول سياق النموذج»، واختر «إعداد الموصل».

  1. افتح TypingMind في متصفحك.
  2. انقر على أيقونة الإعدادات.
  3. انتقل إلى الإعدادات المتقدمة.
  4. افتح قسم بروتوكول سياق النموذج.
  5. انقر على «إعداد الموصل» واختر «هذا الجهاز».
شاشة إعداد موصل MCP في TypingMind مع تحديد «هذا الجهاز»
2

تنفيذ أمر الموصل

اختر «هذا الجهاز»، وانسخ الأمر من TypingMind وشغّله في Terminal. أبقِ العملية قيد التشغيل أثناء استخدام MCP.

  1. انسخ أمر الإعداد الذي يعرضه TypingMind.
  2. افتح Terminal على macOS أو Windows Terminal على Windows.
  3. الصق الأمر ونفّذه.
  4. وافق على تثبيت الحزمة إذا طلب منك Terminal تأكيد المتابعة.
  5. أبقِ نافذة Terminal والعملية التي تعمل فيها قيد التشغيل أثناء استخدام أدوات MCP.
3

أضف unplugin-mcp كخادم

عندما تظهر حالة الموصل «جاهز»، انقر على «تعديل الخوادم» والصق إعدادات خادم MCP.

  1. انتظر حتى تظهر حالة الموصل «جاهز».
  2. انقر على «تعديل الخوادم».
  3. الصق إعدادات خادم MCP الخاص بـ unplugin-mcp.
  4. احفظ قائمة الخوادم.
  5. حدّث الحالة إذا أردت التأكد من أن الموصل لا يزال جاهزًا.
إعدادات MCP في TypingMind تعرض خادمًا نشطًا وزر «تعديل الخوادم»
{
  "mcpServers": {
    "situ2001-unplugin-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "unplugin-mcp"
      ]
    }
  }
}
4

استخدام الاتصال مع نماذج مختلفة

احفظ قائمة الخوادم، وافتح «الإضافات»، وفعّل أدوات MCP الخاصة بـ unplugin-mcp، ثم اختر أي نموذج ذكاء اصطناعي مدعوم في TypingMind واستخدم الأدوات في المحادثة أو أسندها إلى وكيل ذكاء اصطناعي.

  1. افتح صفحة الإضافات في TypingMind.
  2. فعّل أدوات MCP الخاصة بـ unplugin-mcp.
  3. ابدأ محادثة واختر نموذج الذكاء الاصطناعي الذي تريد استخدامه.
  4. استخدم أدوات MCP في المحادثة أو عيّنها لوكيل ذكاء اصطناعي.
  5. انتقل إلى نموذج ذكاء اصطناعي آخر عند الحاجة دون إعادة الاتصال بـ MCP.
محادثة في TypingMind تستخدم أدوات MCP المفعّلة مع نموذج ذكاء اصطناعي محدّد
هل يمكنك استخدام unplugin-mcp لمساعدتي في هذه المهمة؟
unplugin-mcp
بالتأكيد. قرأته.
إليك ما وجدته باستخدام unplugin-mcp.

الأسئلة الشائعة

ما استخدامات خادم MCP unplugin-mcp؟

unplugin-mcp هو خادم MCP يتيح لتطبيقات الذكاء الاصطناعي المتوافقة الاتصال بأدوات ومصادر سياق خارجية. في TypingMind، يمكنك إضافة خادم MCP هذا مرة واحدة وإتاحة أدواته في مساحة عملك للذكاء الاصطناعي.

هل يمكنني استخدام خادم MCP unplugin-mcp مع نماذج ذكاء اصطناعي متعددة في TypingMind؟

نعم. يربط TypingMind أدوات MCP على مستوى مساحة العمل، لذا يمكنك استخدام unplugin-mcp مع نماذج ذكاء اصطناعي مختلفة مثل Claude أو ChatGPT أو Gemini أو غيرها من النماذج التي أعددتها في TypingMind، دون إعداد خادم MCP لكل نموذج على حدة.

لماذا تستخدم موصل MCP unplugin-mcp مع TypingMind؟

يُعد TypingMind من أفضل واجهات المحادثة مع النماذج اللغوية الكبيرة، إذ يجمع نماذج ذكاء اصطناعي متعددة ومطالبات وإضافات ووكلاء ذكاء اصطناعي ومفاتيح API وأدوات MCP في مساحة عمل واحدة. بعد توصيل unplugin-mcp، يمكنك استخدام أدوات MCP الخاصة به عبر نماذجك المفضلة مع الحفاظ على سير عمل محادثاتك منظمًا في TypingMind.

كيف أوصّل خادم MCP unplugin-mcp بـ TypingMind؟

يعمل unplugin-mcp عبر موصل MCP المحلي في TypingMind. هذا هو الخيار الأنسب عندما يحتاج خادم MCP إلى الوصول إلى ملفات محلية أو تطبيقات سطح المكتب أو أدوات سطر الأوامر أو موارد خاصة على حاسوبك.

ما الأدوات التي يوفّرها خادم MCP unplugin-mcp في TypingMind؟

يتيح unplugin-mcp إمكانات MCP يمكنك تفعيلها من صفحة الإضافات في TypingMind واستخدامها في المحادثات أو تعيينها لوكلاء ذكاء اصطناعي.

هل أحتاج إلى مشاركة مفاتيح API الخاصة بي مع TypingMind لاستخدام خادم MCP unplugin-mcp؟

لا. يعطي TypingMind الأولوية للعمل المحلي ويُبقي مزوّدي النماذج ومفاتيح API والمطالبات وإعدادات MCP تحت تحكمك. إذا كان unplugin-mcp يتطلب مصادقة، فأضف الترويسات أو إعدادات OAuth أو الإعدادات المحلية المطلوبة لخادم MCP هذا عند إنشاء الاتصال.

خوادم MCP ذات صلة

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا البريدية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇