MCP API Server

MCP API Server

A Model Context Protocol server that enables AI assistants to make HTTP requests (GET, POST, PUT, DELETE) to external APIs through standardized MCP tools.

Category
Visit Server

README

MCP API Server

A Model Context Protocol (MCP) server that provides HTTP API calling capabilities. This server allows MCP clients to make HTTP requests (GET, POST, PUT, DELETE) through standardized MCP tools.

Features

  • 🚀 HTTP API Tools: GET, POST, PUT, DELETE request support
  • 🔒 Security: Request validation with configurable security policies
  • 📝 Logging: Comprehensive debug logging and request tracking
  • ⚙️ Configurable: Flexible configuration via CLI args and environment variables
  • 🛡️ Error Handling: Robust error handling with detailed error messages
  • 🔄 Graceful Shutdown: Proper cleanup and shutdown handling

Installation

NPX (Recommended)

Run directly without installation:

npx mcp-api-server

Global Installation

npm install -g mcp-api-server
mcp-api-server

Local Installation

npm install mcp-api-server
npx mcp-api-server

Usage

Basic Usage

# Start the server
mcp-api-server

# Start with debug logging
mcp-api-server --debug

# Allow localhost requests (useful for development)
mcp-api-server --allow-localhost

# Allow private IP requests
mcp-api-server --allow-private-ips

# Show help
mcp-api-server --help

Environment Variables

Configure the server using environment variables:

# Enable debug logging
DEBUG=true mcp-api-server

# Set custom timeout (in milliseconds)
API_TIMEOUT=60000 mcp-api-server

# Allow localhost and private IPs
ALLOW_LOCALHOST=true ALLOW_PRIVATE_IPS=true mcp-api-server

# Set maximum response length (in bytes)
MAX_RESPONSE_LENGTH=100000 mcp-api-server

# Set custom user agent
USER_AGENT="MyApp/1.0.0" mcp-api-server

Configuration Options

Option Environment Variable Default Description
--debug DEBUG false Enable debug logging
--allow-localhost ALLOW_LOCALHOST false Allow requests to localhost/127.0.0.1
--allow-private-ips ALLOW_PRIVATE_IPS false Allow requests to private IP ranges
N/A API_TIMEOUT 30000 Request timeout in milliseconds
N/A MAX_RESPONSE_LENGTH 50000 Maximum response length in bytes
N/A USER_AGENT MCP-API-Server/1.0.0 Custom user agent string

Available Tools

The server provides the following MCP tools:

api_get

Make an HTTP GET request.

Parameters:

  • url (string): The URL to request
  • headers (object, optional): HTTP headers to include

api_post

Make an HTTP POST request.

Parameters:

  • url (string): The URL to request
  • body (string, optional): Request body
  • headers (object, optional): HTTP headers to include

api_put

Make an HTTP PUT request.

Parameters:

  • url (string): The URL to request
  • body (string, optional): Request body
  • headers (object, optional): HTTP headers to include

api_delete

Make an HTTP DELETE request.

Parameters:

  • url (string): The URL to request
  • headers (object, optional): HTTP headers to include

MCP Client Configuration

To use this server with an MCP client, add it to your MCP configuration:

Claude Desktop Configuration

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "api-server": {
      "command": "npx",
      "args": ["mcp-api-server"],
      "env": {
        "DEBUG": "false"
      }
    }
  }
}

With Custom Configuration

{
  "mcpServers": {
    "api-server": {
      "command": "npx",
      "args": ["mcp-api-server", "--debug", "--allow-localhost"],
      "env": {
        "API_TIMEOUT": "60000",
        "MAX_RESPONSE_LENGTH": "100000"
      }
    }
  }
}

Development

Building from Source

# Clone the repository
git clone https://github.com/yourusername/mcp-api-server.git
cd mcp-api-server

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm test

# Run the server
npm start

Development Mode

# Watch mode for development
npm run dev

# Run with development settings
npm run start:dev

# Run individual test suites
npm run test:validation
npm run test:handlers
npm run test:flow

Security Considerations

  • By default, requests to localhost and private IP ranges are blocked
  • Use --allow-localhost and --allow-private-ips flags carefully in production
  • The server validates all requests and sanitizes responses
  • Request timeouts prevent hanging connections
  • Response size limits prevent memory exhaustion

Error Handling

The server provides detailed error messages for:

  • Invalid URLs
  • Network timeouts
  • JSON parsing errors
  • Validation failures
  • HTTP errors

All errors are logged with timestamps and context for debugging.

License

MIT License - see LICENSE file for details.

Contributing

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

Support

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