Skip to main content
Glama

MCP Multi-API Server

by lokendra005

MCP Multi-API Server 🌉

A Model Context Protocol (MCP) server that bridges AI/LLMs with multiple real-world APIs including weather, finance, and news services. This server acts as a standardized interface, allowing any MCP-compatible AI application to seamlessly interact with external APIs without custom integration work.

🚀 Features

  • Multi-API Support: Weather (OpenWeatherMap), Finance (Alpha Vantage), News (NewsAPI)
  • MCP Protocol Compliant: Full implementation of Anthropic's MCP standard
  • Intelligent Caching: Configurable TTL-based caching to reduce API calls
  • Rate Limiting: Built-in rate limiting to respect API quotas
  • Comprehensive Logging: Winston-based logging with multiple transports
  • Error Handling: Robust error handling with meaningful error messages
  • TypeScript: Fully typed for better developer experience

📋 Prerequisites

🛠️ Installation

  1. Clone the repository:
git clone https://github.com/yourusername/mcp-multi-api-server.git cd mcp-multi-api-server
  1. Install dependencies:
npm install
  1. Copy the environment template and add your API keys:
cp .env.example .env
  1. Edit .env and add your API keys:
OPENWEATHER_API_KEY=your_key_here ALPHA_VANTAGE_API_KEY=your_key_here NEWS_API_KEY=your_key_here
  1. Build the project:
npm run build

🚀 Usage

Starting the Server

npm start

For development with auto-reload:

npm run dev

🏗️ Architecture

src/ ├── index.ts # Entry point & MCP server setup ├── api/ # API client implementations ├── tools/ # MCP tool definitions ├── utils/ # Utilities (cache, rate limiter, logger) └── types/ # TypeScript type definitions

⚙️ Configuration

Environment Variables

VariableDescriptionDefault
OPENWEATHER_API_KEYOpenWeatherMap API keyRequired
ALPHA_VANTAGE_API_KEYAlpha Vantage API keyRequired
NEWS_API_KEYNewsAPI keyRequired
MCP_SERVER_PORTServer port3000
LOG_LEVELLogging levelinfo
CACHE_TTL_WEATHERWeather cache TTL (seconds)300
CACHE_TTL_FINANCEFinance cache TTL (seconds)60
CACHE_TTL_NEWSNews cache TTL (seconds)600
RATE_LIMIT_REQUESTSRate limit requests100
RATE_LIMIT_WINDOWRate limit window (ms)60000

🧪 Testing

Run the test script:

npm test

Using MCP Inspector (Visual Testing)

# Install MCP Inspector globally npm install -g @modelcontextprotocol/inspector # Run the inspector mcp-inspector node dist/index.js

This opens a web interface at http://localhost:5173 where you can:

  • See all available tools
  • Test tool calls interactively
  • View request/response logs

Manual STDIO Testing

# Start the server node dist/index.js # Run the test script node dist/test-runner.js ## Testing Individual APIs ### Test Weather API ```bash # Create a test file: test-weather.ts import { getCurrentWeather, getWeatherForecast } from './src/api/weather.js'; async function testWeather() { try { console.log('Testing current weather...'); const current = await getCurrentWeather('London'); console.log('Current weather:', current); console.log('\nTesting forecast...'); const forecast = await getWeatherForecast('Paris', 3); console.log('Forecast:', forecast); } catch (error) { console.error('Error:', error); } } testWeather();

Run:

npx tsx test-weather.ts

Test Finance API

import { getStockQuote, getCurrencyExchange } from './src/api/finance.js'; async function testFinance() { try { console.log('Testing stock quote...'); const stock = await getStockQuote('AAPL'); console.log('Stock:', stock); console.log('\nTesting currency exchange...'); const exchange = await getCurrencyExchange('USD', 'EUR'); console.log('Exchange:', exchange); } catch (error) { console.error('Error:', error); } } testFinance();

Test News API

# Create a test file: test-news.ts import { getTopHeadlines, searchNews } from './src/api/news.js'; async function testNews() { try { console.log('Testing headlines...'); const headlines = await getTopHeadlines('us', 'technology'); console.log('Headlines:', headlines); console.log('\nTesting search...'); const search = await searchNews('artificial intelligence'); console.log('Search results:', search); } catch (error) { console.error('Error:', error); } } testNews();
-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

A bridge allowing AI/LLMs to seamlessly interact with external APIs for weather, finance, and news services through a standardized MCP-compliant interface.

  1. 🚀 Features
    1. 📋 Prerequisites
      1. 🛠️ Installation
        1. 🚀 Usage
          1. Starting the Server
        2. 🏗️ Architecture
          1. ⚙️ Configuration
            1. Environment Variables
          2. 🧪 Testing
            1. Using MCP Inspector (Visual Testing)
            2. Manual STDIO Testing
          3. Create a test file: test-weather.ts
            1. Create a test file: test-news.ts

              Related MCP Servers

              • A
                security
                F
                license
                A
                quality
                A bridge that enables seamless integration of Ollama's local LLM capabilities into MCP-powered applications, allowing users to manage and run AI models locally with full API coverage.
                Last updated -
                10
                33
                JavaScript
                • Apple
              • -
                security
                A
                license
                -
                quality
                A Server-Sent Events implementation using FastAPI framework that integrates Model Context Protocol (MCP), allowing AI models to access external tools and data sources like weather information.
                Last updated -
                9
                Python
                MIT License
              • -
                security
                A
                license
                -
                quality
                A proxy server that bridges AI agents and external APIs by dynamically translating OpenAPI specifications into standardized MCP tools, enabling seamless interaction without custom integration code.
                Last updated -
                39
                Python
                MIT License
                • Linux
                • Apple
              • -
                security
                A
                license
                -
                quality
                A server that integrates the MCP library with OpenAI's API, allowing users to interact with various tools, such as the weather tool, through natural language queries.
                Last updated -
                Python
                MIT License

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/lokendra005/mcp'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server