标题:暴露 description:为Claude桌面应用程序轻松构建MCP工具
Expose允许您构建MCP工具,您可以使用MCP客户端调用这些工具,如Claude桌面应用程序。
- 自托管:您可以轻松地自托管工具并将其部署在自己的服务器上。
- 统一网关:生成一个可以注册的HTTP端点
expose-cli - 灵活的:轻松配置和定制您的工具以满足您的需求。
入门
- 安装程序公开CLI```bash
curl -fsSL https://github.com/a0dotrun/expose/releases/download/stable/download_cli.sh | bash
1. **安装依赖项**```bash
npm i @a0dotrun/expose
- 创建服务器```bash
touch src/server.ts
``````ts title=src/server.ts
import { create } from "@a0dotrun/expose"
const app = create({
tools: [],
})
export default {
port: 3000,
fetch: app.fetch,
}
1. **定义您的工具**```diff lang=ts title=src/server.ts
+ import { tool } from "@a0dotrun/expose/tool"
+ import { subscription } from "@acme/lib/subscription"
+ import { z } from "zod"
+ const getCustomerSubscription = tool({
+ name: "getCustomerSubscription",
+ description: "Get subscription information for a customer",
+ args: z.object({
+ customer: z.string().uuid()
+ }),
+ run: async (input) => {
+ // Your subscription logic here
+ return input;
+ },
+ });
+ const createCustomerSubscription = tool({
+ name: "createCustomerSubscription",
+ description: "Create a subscription for a customer",
+ args: z.object({
+ customer: z.string().uuid()
+ }),
+ run: async (input) => {
+ // Your subscription logic here
+ return input;
+ },
+ });
const app = create({
tools: [
+ getCustomerSubscription,
+ createCustomerSubscription,
],
});
- 启动服务器```bash
npm run dev
您还可以部署服务器并记下公共URL。
1. **在Claude桌面应用程序中注册**
MACOS克劳德桌面MCP配置路径: `~/Library/Application Support/Claude/claude_desktop_config.json````json
{
...
"mcpServers": {
"subscriptionManager": {
"command": "/Users/acmeuser/.local/bin/expose-cli",
"args": ["--url", "http://localhost:3000", "--timeout", "15"]
}
}
...
}
用您的公共URL替换localhost
exposure是通过以下方式创建的 您的电子邮件 在 a0级
致谢
我受到了启发 未知
