Skip to main content
Glama
README.md
# ๐Ÿ” API Manager MCP Server

An enhanced MCP (Model Context Protocol) server for securely managing API keys that works seamlessly with Claude Desktop and Claude Code.

## โœจ Features

### ๐Ÿ”’ Security First
- **Secure file permissions** (600) for environment files
- **Atomic file operations** to prevent corruption
- **Automatic backups** before deletions
- **Value masking** for safe display
- **Input validation** for all operations

### ๐Ÿ“Š Smart Organization
- **Automatic categorization** of API keys based on service providers
- **Advanced search** across key names and categories
- **Statistics and analytics** for your API key usage
- **Export functionality** in multiple formats

### ๐Ÿ› ๏ธ Enhanced Functionality
- **Comprehensive logging** for audit trails
- **Command-line interface** with flexible options
- **Error handling** with detailed feedback
- **Backup management** with timestamped backups

### ๐ŸŽฏ Supported Categories
- **AI/LLM Services**: Anthropic, OpenAI, Google AI, Groq, Mistral, DeepSeek, etc.
- **Database & Storage**: Supabase, Neo4j, Qdrant, Pinecone, Airtable, etc.
- **Communication**: Discord, Slack, Twilio, Telegram, etc.
- **Development Tools**: GitHub, Firebase, Vercel, Netlify, etc.
- **Cloud & Hosting**: AWS, Azure, GCP, Railway, Heroku, etc.
- **And many more...**

## ๐Ÿš€ Quick Start

### Prerequisites
- Python 3.8 or higher
- Claude Desktop or Claude Code

### Installation

1. **Clone the repository:**
```bash
git clone https://github.com/yourusername/API_Manager_MCPServer.git
cd API_Manager_MCPServer
```

2. **Install dependencies:**
```bash
pip install -r requirements.txt
```

3. **Configure for Claude Desktop:**

Add to your Claude Desktop configuration file (`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "api-manager": {
      "command": "python",
      "args": ["/path/to/API_Manager_MCPServer/api_manager.py"],
      "env": {}
    }
  }
}
```

4. **Configure for Claude Code:**

Add to your Claude Code MCP settings:

```json
{
  "mcp": {
    "servers": {
      "api-manager": {
        "command": "python",
        "args": ["/path/to/API_Manager_MCPServer/api_manager.py"]
      }
    }
  }
}
```

### Basic Usage

Once configured, you can use the API Manager through Claude with natural language:

```
"List my API keys"
"Add a new OpenAI API key"
"Search for Discord keys"
"Show statistics about my API keys"
"Create a backup of my environment file"
```

## ๐Ÿ“– Detailed Usage

### Available Commands

#### ๐Ÿ” Query Commands

**`list_api_keys`** - List all API keys with categories
- `show_values`: Show actual values (default: false)
- `category`: Filter by specific category

**`get_api_key`** - Get a specific API key by name
- `key_name`: Name of the key to retrieve

**`search_api_keys`** - Search for API keys by name or category
- `query`: Search term
- `show_values`: Show actual values (default: false)

**`list_categories`** - List all categories with counts

#### ๐Ÿ“ Management Commands

**`add_api_key`** - Add or update an API key
- `key_name`: Name of the API key
- `value`: The API key value

**`delete_api_key`** - Delete an API key
- `key_name`: Name of the key to delete

#### ๐Ÿ› ๏ธ Utility Commands

**`backup_env_file`** - Create timestamped backup

**`get_stats`** - Show detailed statistics

**`export_keys`** - Export keys in JSON or ENV format
- `format`: "json" or "env" (default: json)
- `include_values`: Include actual values (default: false)

**`help`** - Show comprehensive help

### Command Line Options

```bash
python api_manager.py --help
python api_manager.py --version
python api_manager.py --env-file /custom/path/.env
python api_manager.py --log-level DEBUG
```

### Environment File Location

By default, API keys are stored in:
- `~/.config/api_manager/.env`

You can specify a custom location using:
- Command line: `--env-file /path/to/.env`
- Environment variable: `API_MANAGER_ENV_FILE`

## ๐Ÿ”ง Configuration

### Environment File Format

```bash
# API Manager Environment File
# Created on 2024-01-01 12:00:00

# AI Services
ANTHROPIC_API_KEY=sk-ant-1234567890abcdef
OPENAI_API_KEY=sk-1234567890abcdef

# Database Services
SUPABASE_API_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9

# Communication
DISCORD_BOT_TOKEN=ODcyNzM0NjI5NjU2MjE3NjAw
```

### Security Best Practices

1. **File Permissions**: The environment file is automatically created with secure permissions (600)
2. **Backups**: Always create backups before making changes
3. **Value Masking**: Use `show_values=false` when listing keys
4. **Logging**: Monitor the log file for any suspicious activity
5. **Access Control**: Limit access to the environment file location

## ๐Ÿงช Testing

Run the test suite:

```bash
# Install test dependencies
pip install pytest pytest-asyncio pytest-cov

# Run tests
pytest tests/

# Run with coverage
pytest tests/ --cov=api_manager --cov-report=html
```

## ๐Ÿ“Š Monitoring and Logs

The API Manager creates detailed logs in `api_manager.log`:

```bash
# View recent activity
tail -f api_manager.log

# Search for specific operations
grep "Tool called" api_manager.log
```

## ๐Ÿ”ง Development

### Project Structure

```
API_Manager_MCPServer/
โ”œโ”€โ”€ api_manager.py          # Main MCP server
โ”œโ”€โ”€ requirements.txt        # Dependencies
โ”œโ”€โ”€ setup.py               # Package configuration
โ”œโ”€โ”€ README.md              # This file
โ”œโ”€โ”€ LICENSE                # License file
โ”œโ”€โ”€ tests/                 # Test suite
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ test_api_manager.py
โ”‚   โ””โ”€โ”€ test_integration.py
โ”œโ”€โ”€ docs/                  # Documentation
โ”‚   โ”œโ”€โ”€ configuration.md
โ”‚   โ”œโ”€โ”€ security.md
โ”‚   โ””โ”€โ”€ troubleshooting.md
โ””โ”€โ”€ examples/              # Usage examples
    โ”œโ”€โ”€ claude_desktop_config.json
    โ””โ”€โ”€ usage_examples.md
```

### Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Submit a pull request

## ๐Ÿ“œ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## ๐Ÿค Support

- **Issues**: [GitHub Issues](https://github.com/yourusername/API_Manager_MCPServer/issues)
- **Discussions**: [GitHub Discussions](https://github.com/yourusername/API_Manager_MCPServer/discussions)
- **Documentation**: [Full Documentation](https://api-manager-mcp.readthedocs.io/)

## ๐Ÿšง Roadmap

- [ ] Web UI for API key management
- [ ] Integration with popular password managers
- [ ] Multi-environment support (dev, staging, prod)
- [ ] API key rotation notifications
- [ ] Advanced audit logging
- [ ] Team collaboration features

## ๐Ÿ™ Acknowledgments

- Built on the [Model Context Protocol (MCP)](https://github.com/anthropics/mcp) by Anthropic
- Inspired by the need for secure API key management in AI workflows
- Community feedback and contributions

---

**โš ๏ธ Security Notice**: API keys are sensitive credentials. Always follow security best practices and never commit API keys to version control systems.