ServeMyAPI (macOS Keychain) MCP server

Securely stores and retrieves API keys using macOS Keychain, allowing natural language access to credentials without exposing them in .env files
Back to servers
Provider
James King
Release date
Mar 18, 2025
Language
TypeScript
Stats
12 stars

ServeMyAPI is a personal MCP (Model Context Protocol) server that lets you securely store and access API keys across multiple projects using the macOS Keychain. It provides a consistent interface for storing credentials that can be accessed through natural language when used with LLMs like Claude.

Installation

# Clone the repository
git clone https://github.com/yourusername/servemyapi.git
cd servemyapi

# Install dependencies
npm install

# Build the project
npm run build

Running the Server

As a stdio Server

This is the simplest way to use ServeMyAPI with Claude Desktop:

npm start

As an HTTP Server

For applications requiring HTTP access:

node dist/server.js

This starts the server on port 3000 (or the port specified in the PORT environment variable).

Using the CLI Interface

ServeMyAPI includes a command-line interface for key management:

# Install the CLI globally
npm run build
npm link

# List all stored API keys
api-key list

# Get a specific API key
api-key get github_token

# Store a new API key
api-key store github_token ghp_123456789abcdefg

# Delete an API key
api-key delete github_token

# Display help
api-key help

Configuring MCP Clients

Claude Desktop

To connect ServeMyAPI with Claude Desktop:

  1. Find or create the Claude Desktop configuration file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  2. Add ServeMyAPI to the mcpServers section:

    {
      "mcpServers": {
        "serveMyAPI": {
          "command": "node",
          "args": [
            "/ABSOLUTE/PATH/TO/servemyapi/dist/index.js"
          ]
        }
      }
    }
    
  3. Replace /ABSOLUTE/PATH/TO/servemyapi with your actual installation path

  4. Restart Claude Desktop

Using Smithery

ServeMyAPI is available as a hosted service on 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(", ")}`)

Available MCP Tools

store-api-key

Stores an API key in the keychain.

Parameters:

  • name: The name/identifier for the API key
  • key: The API key to store

Example (from Claude):

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

get-api-key

Retrieves an API key from the keychain.

Parameters:

  • name: The name/identifier of the API key to retrieve

Example (from Claude):

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

delete-api-key

Deletes an API key from the keychain.

Parameters:

  • name: The name/identifier of the API key to delete

Example (from Claude):

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

list-api-keys

Lists all stored API keys.

No parameters required.

Example (from Claude):

Using serveMyAPI, list all my stored API keys

Security Notes

  • All API keys are stored securely in the macOS Keychain
  • Keys are only accessible to the current user
  • The keychain requires authentication for access
  • No keys are stored in plaintext or logged anywhere
  • Important: ServeMyAPI is a macOS-specific tool and not compatible with Windows or Linux operating systems

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later