Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>API to MCP ConverterNew to Visual Studio Code? Get it now.
API to MCP Converter

API to MCP Converter

Deepu Singh

|
59 installs
| (0) | Free
Convert REST APIs to Model Context Protocol (MCP) wrappers automatically
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

API to MCP Converter

A powerful VS Code extension that automatically analyzes REST APIs in any repository and converts them to Model Context Protocol (MCP) wrappers. This tool makes any REST API accessible through the MCP framework with automatic authentication handling and AI-powered enhancement capabilities.

🚀 Features

🔍 Intelligent API Discovery

  • Multi-format Support: Scans workspace for OpenAPI/Swagger specifications (JSON/YAML)
  • Code Analysis: Detects API endpoints in code files across multiple frameworks
  • Static Code Scanning: Analyzes source code to extract REST API definitions
  • AI-Enhanced Analysis: Uses Azure OpenAI to enrich API understanding with business context

🛠️ Advanced MCP Server Generation

  • Complete Server Implementation: Generates production-ready Node.js MCP servers
  • Multi-Authentication Support: Handles Bearer tokens, API keys, Basic auth, OAuth2
  • Auto-build & Validation: Automated compilation and testing pipeline
  • Test Harness Generation: Includes comprehensive testing infrastructure

🌐 Interactive MCP Tester UI

  • Swagger-like Interface: Browser-based UI for testing MCP servers
  • Real-time Server Management: Start, stop, and monitor MCP servers
  • Live Testing: Interactive tool invocation with parameter validation
  • Visual Server Explorer: Tree view of all available MCP tools and resources

🧠 Azure AI Integration

  • Intelligent Code Analysis: AI-powered endpoint detection and enhancement
  • Business Context Extraction: Understands API purpose and use cases
  • Smart Documentation: Auto-generates comprehensive API documentation
  • Configurable AI Models: Supports various Azure OpenAI deployments

🎯 Supported Frameworks & Languages

Backend Frameworks

  • Node.js: Express.js, Fastify, Koa
  • Python: Flask, FastAPI, Django REST Framework
  • Java: Spring Boot, JAX-RS
  • C#/.NET: ASP.NET Core (Minimal APIs & Controllers)
  • PHP: Laravel, Symfony
  • Go: Gin, Echo
  • Rust: Actix-Web, Rocket

Specification Formats

  • OpenAPI 3.0/3.1 (JSON/YAML)
  • Swagger 2.0 (JSON/YAML)
  • Custom API documentation formats

📦 Installation & Setup

1. Extension Installation

# From VS Code Marketplace
# Search: "API to MCP Converter" by deepusingh-fiber

2. Prerequisites Setup

# Install Node.js (required for MCP server generation)
# Download from: https://nodejs.org/

# Install extension dependencies
npm install

3. Azure AI Configuration (Optional but Recommended)

  • Open VS Code Settings (Ctrl+,)
  • Search for "Azure AI"
  • Configure your Azure OpenAI settings:
    • Endpoint: Your Azure OpenAI endpoint URL
    • API Key: Your Azure OpenAI API key
    • Deployment Name: Your model deployment (e.g., gpt-4)
    • API Version: API version (default: 2024-12-01-preview)

🚀 Quick Start Guide

Step 1: Analyze Your Workspace

# Command Palette (Ctrl+Shift+P)
> API to MCP: Analyze Workspace for APIs

# Or click the status bar item: "API to MCP Ready"

Step 2: Generate MCP Wrappers

# From Command Palette
> API to MCP: Setup MCP for Cline

# Or right-click any API in the "API Discovery" tree view
> Generate MCP Wrapper

Step 3: Test Your Generated Servers

# Launch the MCP Tester UI
> API to MCP: Open MCP Tester UI

# Or test individual servers
> API to MCP: Test MCP Wrapper

🎮 Available Commands

Core Commands

Command Description Shortcut
API to MCP: Analyze Workspace for APIs Scan workspace for API definitions -
API to MCP: Setup MCP for Cline Complete MCP setup workflow -
API to MCP: Generate MCP Servers for Endpoints Generate MCP servers for selected endpoints -
API to MCP: Create MCP Wrapper from API Interactive wrapper creation -

Testing & Validation

Command Description
API to MCP: Test MCP Wrapper Run automated test harness
API to MCP: Open MCP Tester UI Launch browser-based testing interface

AI & Analysis

Command Description
API to MCP: Get API Specifications from Selected Files AI-powered API analysis
API to MCP: Configure Azure AI Settings Setup Azure OpenAI integration

📁 Project Structure

your-project/
├── mcp-wrappers/                 # Generated MCP servers
│   ├── your-api-mcp-server.js   # Main server file
│   ├── package.json             # Dependencies & scripts
│   ├── test-mcp-server.js       # Test harness
│   ├── test-mcp-mock.js         # Mock testing
│   └── README.md                # Server documentation
├── .api-discovery/              # Analysis cache
│   ├── openapi.synthetic.json   # Synthesized OpenAPI spec
│   └── runtime-cache.json       # Runtime discovery cache
└── DISCOVERY_REPORT.md          # Analysis summary

🧪 Testing Your MCP Servers

1. Automated Test Harness

cd mcp-wrappers
npm install
npm run test:server          # Full test suite
npm run test:server:neg      # Negative auth testing
npm run test:mock           # Mock HTTP testing

2. Interactive MCP Tester UI

  • Launch via command: API to MCP: Open MCP Tester UI
  • Browser opens at: http://localhost:3001
  • Features:
    • Visual server explorer
    • Interactive tool testing
    • Real-time response inspection
    • Parameter validation

3. Manual Server Testing

# Set authentication (if required)
export API_KEY="your-api-key"
# or
set API_KEY=your-api-key  # Windows

# Run server directly
node your-api-mcp-server.js

🔐 Authentication Configuration

Environment Variables

# API Key Authentication
export API_KEY="your-api-key"

# Bearer Token Authentication  
export BEARER_TOKEN="your-bearer-token"

# Basic Authentication (username:password)
export BASIC_AUTH="username:password"

# OAuth2 Token
export OAUTH_TOKEN="your-oauth-token"

Windows Environment Variables

set API_KEY=your-api-key
set BEARER_TOKEN=your-bearer-token
set BASIC_AUTH=username:password
set OAUTH_TOKEN=your-oauth-token

📊 Development Scripts

Main Project Scripts

npm run compile              # Compile TypeScript
npm run watch               # Watch mode compilation
npm run build               # Full build including UI
npm run dev                 # Development mode
npm run package             # Create VSIX package
npm run lint                # Code linting
npm run test                # Run tests

MCP Tester UI Scripts

# In mcp-tester-ui/ directory
npm run install-all         # Install all dependencies
npm run dev                 # Development server
npm run build               # Production build
npm run backend             # Backend server only
npm run frontend            # Frontend server only

🔧 Advanced Configuration

Azure AI Settings

{
  "azureAI.endpoint": "https://your-resource.openai.azure.com",
  "azureAI.apiKey": "your-api-key",
  "azureAI.deploymentName": "gpt-4",
  "azureAI.apiVersion": "2024-12-01-preview",
  "azureAI.maxTokens": 30000,
  "azureAI.temperature": 0.3,
  "azureAI.debug": false
}

MCP Server Package.json Template

Generated servers include:

{
  "name": "your-api-mcp-server",
  "version": "1.0.0",
  "type": "module",
  "main": "your_api_mcp_server.js",
  "bin": {
    "your-api-mcp-server": "your_api_mcp_server.js"
  },
  "scripts": {
    "start": "node your_api_mcp_server.js",
    "test:server": "node test-mcp-server.js",
    "test:server:neg": "NO_API_KEY=1 node test-mcp-server.js",
    "test:mock": "node test-mcp-mock.js"
  },
  "dependencies": {
    "@modelcontextprotocol/sdk": "^0.5.0",
    "axios": "^1.7.0"
  }
}

🚀 Publishing MCP Servers

1. Prepare for Publishing

cd mcp-wrappers
npm version patch           # Bump version

2. Publish to NPM

npm publish --access public

3. Global Installation

npm install -g your-api-mcp-server
your-api-mcp-server         # Run globally

🔗 MCP Integration

Cline/Claude Desktop Configuration

{
  "mcpServers": {
    "your_api": {
      "command": "your-api-mcp-server",
      "env": {
        "API_KEY": "your-key-here"
      }
    }
  }
}

VS Code Extension Integration

// Spawn MCP server programmatically
const mcpServer = spawn('node', [wrapperPath], {
  env: { ...process.env, API_KEY: 'your-key' }
});

🐛 Troubleshooting

Common Issues

Issue Cause Solution
Server exits immediately Missing API_KEY env var Set required environment variable
No tools appear JSON parse failure in host Check stdout for pure JSON output
401/403 errors Invalid credentials Regenerate/rotate API key
Mock test failures Unexpected HTTP calls Update nock definitions
Build failures Missing dependencies Run npm install in project root
UI won't load Frontend not built Run npm run build-tester-ui

Debug Mode

Enable detailed logging:

{
  "azureAI.debug": true
}

Check output channels:

  • "API to MCP Debug" - Extension debugging
  • Terminal - MCP server logs

🛣️ Roadmap & Future Enhancements

Planned Features

  • [ ] Auto-generate test harness at wrapper generation time
  • [ ] Schema-driven validation with improved UX
  • [ ] Multi-auth strategy injection via config files
  • [ ] Telemetry & analytics (opt-in)
  • [ ] GraphQL support for modern APIs
  • [ ] WebSocket endpoint detection
  • [ ] API versioning handling
  • [ ] Bulk server generation for multiple APIs

Performance Improvements

  • [ ] Incremental analysis with change detection
  • [ ] Parallel processing for large workspaces
  • [ ] Smart caching strategies
  • [ ] Memory optimization for large codebases

📚 Documentation

Comprehensive Guides

  • User Guide - Complete usage instructions
  • Troubleshooting Guide - Common issues & solutions
  • MCP Setup & Integration - Cline/MCP configuration
  • Development Guide - Extension development
  • API Reference - Technical specifications

Examples & Templates

  • Stock Price API Example - Complete implementation
  • Authentication Patterns - Security implementations
  • Framework-Specific Guides - Language-specific tips

🤝 Contributing

Development Setup

git clone https://github.com/deepusingh_microsoft/apitomcp.git
cd apitomcp
npm install
npm run compile

Testing

# Run extension in development mode
# Press F5 in VS Code to launch Extension Development Host

# Run unit tests
npm test

# Test with sample projects
npm run test:samples

Contribution Guidelines

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

MIT License - see LICENSE file for details.

🙏 Acknowledgments

  • Model Context Protocol - Claude/Anthropic for the MCP specification
  • OpenAPI Initiative - For API specification standards
  • VS Code Team - For the excellent extension API
  • Azure OpenAI - For AI-powered analysis capabilities

📞 Support & Community

Getting Help

  • 🐛 Issues: GitHub Issues
  • 💬 Discussions: GitHub Discussions
  • 📧 Email: Support available through GitHub

Version Information

  • Current Version: 0.0.14
  • VS Code Compatibility: ^1.103.0
  • Node.js Requirement: 18+
  • MCP SDK Version: ^0.5.0

⭐ Star this repository if you find it useful!

🔄 Stay Updated - Watch for releases to get the latest features and improvements.


Note: This extension generates MCP servers that require the Model Context Protocol SDK. Dependencies are automatically managed in generated server directories.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft