返回市场
暴露点

暴露点

作者:a0dotrun20 星标更新:2025-03-22

项目介绍


title: Expose description: 轻松构建用于Claude桌面应用的MCP工具

Expose允许您构建可以使用MCP客户端(如Claude桌面应用)调用的MCP工具。

  • 自托管: 您可以轻松地自行托管工具,并将其部署到自己的服务器上。
  • 统一网关: 生成一个单一的HTTP端点,您可以使用expose-cli进行注册。
  • 灵活: 轻松配置和定制您的工具以满足您的需求。

开始使用

  1. 设置expose CLI

    curl -fsSL https://github.com/a0dotrun/expose/releases/download/stable/download_cli.sh | bash
    
  2. 安装依赖项

    npm i @a0dotrun/expose
    
  3. 创建服务器

    touch src/server.ts
    
    import { create } from "@a0dotrun/expose"
    
    const app = create({
      tools: [],
    })
    
    export default {
      port: 3000,
      fetch: app.fetch,
    }
    
  4. 定义您的工具

+ import { tool } from "@a0dotrun/expose/tool"
+ import { subscription } from "@acme/lib/subscription"
+ import { z } from "zod"

+ const getCustomerSubscription = tool({
+   name: "getCustomerSubscription",
+   description: "获取客户的订阅信息",
+   args: z.object({
+       customer: z.string().uuid()
+   }),
+   run: async (input) => {
+     // 您的订阅逻辑在这里
+     return input;
+   },
+ });


+ const createCustomerSubscription = tool({
+   name: "createCustomerSubscription",
+   description: "为客户创建订阅",
+   args: z.object({
+       customer: z.string().uuid()
+   }),
+   run: async (input) => {
+     // 您的订阅逻辑在这里
+     return input;
+   },
+ });

const app = create({
  tools: [
+    getCustomerSubscription,
+    createCustomerSubscription,
  ],
});
  1. 启动服务器

    npm run dev
    

    您也可以部署服务器并记录下公共URL。

  2. 在Claude桌面应用中注册 macOS Claude桌面MCP配置路径:~/Library/Application Support/Claude/claude_desktop_config.json

{
  ...
  "mcpServers": {
    "subscriptionManager": {
      "command": "/Users/acmeuser/.local/bin/expose-cli",
      "args": ["--url", "http://localhost:3000", "--timeout", "15"]
    }
  }
  ...
}

将localhost替换为您自己的公共URL


expose由@_sanchitrka0创建

致谢

我受到了opencontrol的启发