claude-safe-mcp

claude-safe-mcp

A secure MCP wrapper for Anthropic Claude Code that eliminates the need for permission flags while preserving full CLI functionality and working seamlessly with MCP-compatible IDEs.

Category
Visit Server

README

🚀 Claude Proxy

Tests Coverage Node.js License

A secure HTTP API proxy for Anthropic Claude with comprehensive safety controls, permission management, and seamless integration with VS Code AI assistants.

⚡ Quick Start (One Command)

git clone https://github.com/saxyguy81/claude-proxy.git && cd claude-proxy && ./install.sh && code .

That's it! The API proxy starts automatically when you open VS Code.

🎯 Features

🔒 Enterprise-Grade Safety

  • Permission Management: Interactive approval for dangerous operations
  • Dangerous Pattern Detection: Blocks rm -rf, format, delete, etc.
  • Tool Restrictions: Configurable allowlists for Claude tools
  • Request Monitoring: Complete logging of all API interactions

🌐 Universal API Compatibility

  • OpenAI API Format: /v1/chat/completions endpoint
  • Claude API Format: /v1/messages endpoint
  • Model Mapping: Automatic translation between API formats
  • Standards Compliant: Works with any OpenAI-compatible tool

🛠️ VS Code Integration

  • Automatic Startup: Server starts when you open workspace
  • Pre-configured Extensions: Cline, Continue, Roo Code ready to use
  • Background Tasks: Start/stop/restart through VS Code commands
  • Real-time Monitoring: Permission prompts and request logs

🚀 Supported AI Assistants

Cline - Pre-configured, zero setup
Continue - Pre-configured, zero setup
Roo Code - Environment variables set
Cursor IDE - Manual configuration (5 minutes)
Any OpenAI-compatible tool - Just point to http://localhost:8081/v1

🏗️ Architecture

┌─────────────────┐    HTTP API     ┌─────────────────┐    Safety Layer    ┌─────────────────┐
│   AI Assistant  │ ──────────────→ │   API Proxy     │ ─────────────────→ │  Claude CLI     │
│  (Cline, etc.)  │ ←────────────── │  (Port 8081)    │ ←───────────────── │  (Anthropic)    │
└─────────────────┘    JSON/HTTP    └─────────────────┘   Permission Mgmt   └─────────────────┘

📋 Manual Setup (5 Minutes)

1. Install and Start

git clone https://github.com/saxyguy81/claude-proxy.git
cd claude-proxy
npm install
npm start

2. Configure Your AI Assistant

For Cline Extension

{
  "cline.apiProvider": "openai",
  "cline.openaiApiKey": "dummy-key-not-needed",
  "cline.openaiBaseUrl": "http://localhost:8081/v1",
  "cline.openaiModelId": "gpt-4"
}

For Continue Extension

{
  "continue.apiBase": "http://localhost:8081/v1",
  "continue.apiKey": "dummy-key-not-needed",
  "continue.modelName": "gpt-4"
}

For Roo Code

export OPENAI_API_BASE=http://localhost:8081/v1
export OPENAI_MODEL=gpt-4

For Cursor IDE

  • Settings → Models → Custom API Base: http://localhost:8081/v1
  • Model: gpt-4
  • API Key: dummy-key-not-needed

🔍 Verify It's Working

# Health check
curl http://localhost:8081/health

# List models
curl http://localhost:8081/v1/models

# Test chat completion
curl -X POST http://localhost:8081/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4",
    "messages": [{"role": "user", "content": "Hello!"}],
    "max_tokens": 50
  }'

🛡️ Safety in Action

When an AI assistant tries to use dangerous tools, you'll see:

🔐 Permission Request
Tool: Bash
Command: rm -rf temp/
⚠️  DANGEROUS PATTERN DETECTED: rm -rf
Allow this operation? [y/N/always]: 

⚙️ Configuration

Default Config (claude-proxy.json)

{
  "allowedTools": ["Read", "Edit", "Bash", "Write", "Glob", "Grep"],
  "requirePermissionFor": ["Bash", "Edit", "Write"],
  "dangerousPatterns": ["rm -rf", "format", "delete", "DROP TABLE", "sudo"],
  "safety": {
    "requireApproval": true,
    "autoApprovePatterns": ["ls", "pwd", "cat"]
  },
  "maxConcurrentRequests": 5
}

VS Code Workspace Settings

The automated setup creates .vscode/settings.json with:

  • Extension configurations for Cline, Continue
  • Environment variables for terminals
  • Auto-start task configuration

🧪 Testing & Quality

  • 60 comprehensive tests - All passing
  • 78.62% code coverage - Production ready
  • API Server: 76.51% coverage
  • Safety Proxy: 98.22% coverage
  • Zero lint errors - Clean codebase

📚 Documentation

🔧 Commands

# Development
npm start              # Start the API proxy
npm test              # Run test suite
npm run lint          # Check code quality

# VS Code Integration
npm run start         # Start with auto-reload
code .                # Open in VS Code (auto-starts proxy)

🚨 Troubleshooting

Port Already in Use

# Kill existing processes
pkill -f api-cli.js

# Or use different port
npm start -- --port 8082

VS Code Extensions Can't Connect

  1. Check server status: curl http://localhost:8081/health
  2. Verify extension settings in VS Code
  3. Restart VS Code or reload window

🔄 Updates

git pull origin main
npm install
./install.sh

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Run npm test and npm run lint
  5. Submit a pull request

📝 License

MIT - see LICENSE file for details.

🙏 Acknowledgments

  • Anthropic for Claude and the Claude CLI
  • VS Code extension developers for Cline, Continue, and other AI assistants
  • Open source community for tools and libraries

🔗 Ready to get started?

Run the one-line setup: git clone https://github.com/saxyguy81/claude-proxy.git && cd claude-proxy && ./install.sh && code .

Your AI coding assistant will be running securely through the proxy in under 2 minutes! 🎉

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured