ServeMyAPI

by Jktfe
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Provides an alternative to .ENV files by securely storing API keys in the macOS Keychain while maintaining accessibility across projects

  • Mentioned in the roadmap as a framework that will have easy integration options for accessing securely stored API keys

  • Solves security conflicts with GitHub by storing API keys securely in the Keychain rather than in .gitignore'd files

ServeMyAPI

个人 MCP(模型上下文协议)服务器,用于使用 macOS 钥匙串跨项目安全地存储和访问 API 密钥。

重要提示:ServeMyAPI 是一款 macOS 专用工具,依赖 macOS 钥匙串进行安全存储。它与 Windows 或 Linux 操作系统不兼容。更多详情,请参阅安全说明部分。

概述

ServeMyAPI 允许您将 API 密钥安全地存储在 macOS 钥匙串中,并通过一致的 MCP 接口访问它们。这让您可以轻松:

  • 安全地存储 API 密钥(它们在 .env 文件或配置文件中不可见)
  • 跨多个项目访问相同的密钥
  • 使用自然语言来存储和检索密钥(与 Claude 等 LLM 一起使用时)
  • 当您的人工智能助手需要访问服务时,直接向其提供密钥

为什么使用 ServeMyAPI 而不是 .ENV 文件?

使用 ServeMyAPI 代替传统的 .ENV 文件可以解决几个常见问题:

  1. GitHub 安全冲突
    • 为了安全起见,.ENV 文件需要从 Git 存储库中排除(通过 .gitignore)
    • 这会产生“隐藏上下文”问题,其中重要的配置对于合作者和 LLM 是不可见的
    • 新开发人员经常难以设置正确的环境变量
  2. LLM 整合挑战
    • 由于安全限制,像 Claude 这样的 LLM 无法直接访问你的 .ENV 文件
    • 当 LLM 需要 API 密钥来完成任务时,你通常需要手动解决方法
    • ServeMyAPI 让您的 AI 助手通过自然语言请求密钥
  3. 跨项目一致性
    • 使用 .ENV 文件,您通常需要在多个项目之间复制 API 密钥
    • 当密钥改变时,需要更新多个文件
    • ServeMyAPI 提供了一个可从任何项目访问的中央存储位置

这种方法为您提供了两全其美的效果:安全存储敏感凭据,同时又不牺牲 AI 工具的可见性和可访问性。

特征

  • 在 macOS 钥匙串中安全存储 API 密钥
  • 用于存储、检索、列出和删除密钥的简单 MCP 工具
  • 支持 stdio 和 HTTP/SSE 传输
  • 与任何 MCP 客户端兼容(Claude Desktop 等)

安装

# Clone the repository git clone https://github.com/yourusername/servemyapi.git cd servemyapi # Install dependencies npm install # Build the project npm run build

用法

作为 stdio 服务器运行

这是使用 ServeMyAPI 最简单的方法,尤其是在使用 Claude Desktop 时:

npm start

作为 HTTP 服务器运行

对于需要 HTTP 访问的应用程序:

node dist/server.js

这将在端口 3000(或 PORT 环境变量中指定的端口)上启动服务器。

使用 Smithery

ServeMyAPI 可作为Smithery上的托管服务使用。

import { createTransport } from "@smithery/sdk/transport.js" const transport = createTransport("https://server.smithery.ai/@Jktfe/servemyapi") // Create MCP client import { Client } from "@modelcontextprotocol/sdk/client/index.js" const client = new Client({ name: "Test client", version: "1.0.0" }) await client.connect(transport) // Use the server tools with your LLM application const tools = await client.listTools() console.log(`Available tools: ${tools.map(t => t.name).join(", ")}`)

有关更多详细信息,请参阅Smithery API 文档

配置 MCP 客户端

ServeMyAPI 可与任何兼容 MCP 的客户端兼容。示例配置文件位于examples目录中。

克劳德桌面

要将 ServeMyAPI 与 Claude Desktop 结合使用:

  1. 找到或创建 Claude Desktop 配置文件:
    • macOS~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows%AppData%\Claude\claude_desktop_config.json
  2. 将 ServeMyAPI 添加到mcpServers部分(您可以从examples/claude_desktop_config.json复制):
    { "mcpServers": { "serveMyAPI": { "command": "node", "args": [ "/ABSOLUTE/PATH/TO/servemyapi/dist/index.js" ] } } }
  3. /ABSOLUTE/PATH/TO/servemyapi替换为 ServeMyAPI 安装的实际路径。
  4. 重新启动 Claude Desktop。

风帆冲浪

要将 ServeMyAPI 与 Windsurf 一起使用:

  1. 打开 Windsurf 编辑器并导航至“设置”
  2. 使用examples/windsurf_config.json中的示例将 ServeMyAPI 添加到您的 MCP 服务器配置中
  3. 调整路径以适应您的本地安装

MCP 工具

ServeMyAPI 公开了以下工具:

商店 API 密钥

将 API 密钥存储在钥匙串中。

参数:

  • name :API 密钥的名称/标识符
  • key :要存储的 API 密钥

示例(来自 Claude):

Using serveMyAPI, store my API key ABC123XYZ as "OpenAI API Key"

获取 API 密钥

从钥匙串中检索 API 密钥。

参数:

  • name :要检索的 API 密钥的名称/标识符

示例(来自 Claude):

Using serveMyAPI, get the API key named "OpenAI API Key"

删除 API 密钥

从钥匙串中删除 API 密钥。

参数:

  • name :要删除的 API 密钥的名称/标识符

示例(来自 Claude):

Using serveMyAPI, delete the API key named "OpenAI API Key"

列出 API 密钥

列出所有存储的 API 密钥。

无需任何参数。

示例(来自 Claude):

Using serveMyAPI, list all my stored API keys

安全说明

  • 所有 API 密钥都安全地存储在 macOS 钥匙串中
  • 只有当前用户可以访问密钥
  • 钥匙串需要身份验证才能访问
  • 没有以明文形式存储或记录任何密钥

路线图

ServeMyAPI 的未来计划包括:

  • 代码扫描工具:该工具可自动扫描代码库中的 API 端点、敏感 URL 和环境变量,并建议将其存储在 Keychain 中的名称。这将允许开发人员继续在其常规工作流程中使用 .ENV 文件,同时确保凭据在需要时也可供 LLM 和其他工具使用。
  • 跨平台支持:研究 Windows 和 Linux 的安全凭证存储选项,以使 ServeMyAPI 更广泛地被访问。
  • 与流行框架集成:提供与 Next.js、Express 等框架的轻松集成。
  • 密钥管理的 UI :一个简单的 Web 界面,用于直接管理您存储的 API 密钥。

欢迎通过提出问题或拉取请求来建议其他功能或为路线图做出贡献。

发展

# Run in development mode with hot reload npm run dev # Lint the code npm run lint # Build for production npm run build

执照

麻省理工学院

-
security - not tested
F
license - not found
-
quality - not tested

个人 MCP 服务器,使用 macOS Keychain 跨项目安全地存储和访问 API 密钥,让 AI 助手和应用程序通过自然语言检索凭据。

  1. Overview
    1. Why ServeMyAPI over .ENV Files?
      1. Features
        1. Installation
          1. Usage
            1. Running as a stdio server
            2. Running as an HTTP server
            3. Using Smithery
            4. Configuring MCP Clients
          2. MCP Tools
            1. store-api-key
            2. get-api-key
            3. delete-api-key
            4. list-api-keys
          3. Security Notes
            1. Roadmap
              1. Development
                1. License
                  ID: y2unl3n9g4