mcp_api

iNetworkX/mcp_api

3.2

If you are the rightful owner of mcp_api and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP API Server is a lightweight, high-performance server written in Go that facilitates AI assistants in making HTTP API requests, bridging AI tools with external web services securely and efficiently.

Tools
  1. tools/list

    List available tools

  2. tools/call

    Execute a tool

MCP API Server

A lightweight, high-performance MCP (Model Context Protocol) server written in Go that enables AI assistants to make HTTP API requests. This server bridges the gap between AI tools and external web services, providing a secure and standardized way to perform HTTP operations.

Quick Start

# Build the server
go build -o mcp_api main.go

# Run the server
./mcp_api

Table of Contents

Overview

The MCP API Server implements the Model Context Protocol (MCP) specification, providing a send_api_request tool that allows AI assistants to:

  • Make HTTP requests to any endpoint
  • Handle various HTTP methods (GET, POST, PUT, DELETE, PATCH, etc.)
  • Include custom headers and request bodies
  • Receive complete response data including status codes, headers, and body content

This server is particularly useful for:

  • AI-powered API testing and debugging
  • Dynamic web scraping and data collection
  • Integration with third-party services
  • Automated API workflows

Features

  • MCP Protocol Compliant: Fully implements the MCP specification for seamless integration
  • Universal HTTP Support: Supports all HTTP methods with custom headers and bodies
  • Complete Response Data: Returns status codes, headers, and response bodies
  • Safe by Design: Runs in a sandboxed environment with controlled access
  • High Performance: Lightweight Go implementation with minimal dependencies
  • Zero Configuration: Works out of the box with sensible defaults
  • VS Code Ready: Pre-configured for VS Code Chat integration

Installation

Prerequisites

  • Go 1.24.4 or later
  • VS Code 1.99+ (for VS Code integration)

Build from Source

# Clone the repository
git clone https://github.com/iNetworkX/mcp_api.git
cd mcp_api

# Build the binary
go build -o mcp_api main.go

# Verify installation
echo '{"method": "tools/list", "id": 1}' | ./mcp_api

VS Code Integration

Automatic Setup

This project comes pre-configured for VS Code with the following files:

  • .vscode/mcp.json - MCP server configuration
  • .vscode/settings.json - VS Code settings with MCP enabled

Manual Setup

  1. Enable MCP Support:

    {
      "chat.mcp.enabled": true
    }
    
  2. Configure MCP Server: The server is automatically configured via .vscode/mcp.json:

    {
      "servers": {
        "mcp_api": {
          "type": "stdio",
          "command": "./mcp_api",
          "args": [],
          "env": {},
          "description": "MCP API server for sending HTTP requests"
        }
      }
    }
    
  3. Using in VS Code Chat:

    • Open VS Code Chat (Ctrl+Shift+I)
    • Select Agent mode
    • Use natural language to make API requests:
      "Make a GET request to https://api.github.com/users/octocat"
      "Send a POST request to https://httpbin.org/post with JSON data"
      

Usage

Command Line Testing

List Available Tools
echo '{"method": "tools/list", "id": 1}' | ./mcp_api
Make a Simple GET Request
echo '{"method": "tools/call", "params": {"name": "send_api_request", "arguments": {"method": "GET", "url": "https://httpbin.org/get"}}, "id": 2}' | ./mcp_api
Make a POST Request with Headers
echo '{"method": "tools/call", "params": {"name": "send_api_request", "arguments": {"method": "POST", "url": "https://httpbin.org/post", "headers": {"Content-Type": "application/json", "Authorization": "Bearer token123"}, "body": "{\"key\": \"value\"}"}}, "id": 3}' | ./mcp_api

VS Code Chat Examples

User: "Check the status of the GitHub API"
Agent: I'll check the GitHub API status for you.
[Uses send_api_request tool to GET https://api.github.com/status]

User: "Create a new GitHub issue in my repository"
Agent: I'll help you create a GitHub issue. Let me make a POST request to the GitHub API.
[Uses send_api_request tool with POST method and JSON body]

API Reference

MCP Methods

MethodDescriptionParameters
tools/listList available toolsid (required)
tools/callExecute a toolname, arguments, id (required)

send_api_request Tool

Parameters
ParameterTypeRequiredDescription
methodstringYesHTTP method (GET, POST, PUT, DELETE, etc.)
urlstringYesTarget URL for the request
headersobjectNoHTTP headers as key-value pairs
bodystringNoRequest body content
Response Format
{
  "result": {
    "content": [
      {
        "type": "text",
        "text": "API Request sent successfully:

Status: 200
Headers: {...}
Body: {...}"
      }
    ]
  },
  "id": 1
}

Development

Code Quality

# Format code
go fmt ./...

# Run static analysis
go vet ./...

# Run tests
go test ./...

# Clean up dependencies
go mod tidy

Building

# Build for current platform
go build -o mcp_api main.go

# Build for Linux
GOOS=linux GOARCH=amd64 go build -o mcp_api-linux main.go

# Build for Windows
GOOS=windows GOARCH=amd64 go build -o mcp_api-windows.exe main.go

# Build for macOS
GOOS=darwin GOARCH=amd64 go build -o mcp_api-macos main.go

Architecture

Core Components

[VS Code Chat] --> [MCP Protocol] --> [HTTP Client]
(AI Assistant)     (stdin/stdout)     (External APIs)

Key Structures

  • MCPServer: Main server struct handling MCP protocol
  • APIRequest: Represents HTTP request parameters
  • APIResponse: Encapsulates HTTP response data
  • MCPMessage: MCP protocol message structure
  • MCPResponse: MCP protocol response structure

Project Structure

mcp_api/
ā”œā”€ā”€ main.go                 # Main server implementation
ā”œā”€ā”€ go.mod                  # Go module definition
ā”œā”€ā”€ go.sum                  # Go dependencies checksum
ā”œā”€ā”€ mcp_api                 # Built binary
ā”œā”€ā”€ .vscode/
│   ā”œā”€ā”€ mcp.json           # VS Code MCP server configuration
│   └── settings.json      # VS Code settings
ā”œā”€ā”€ README.md              # This documentation
└── LICENSE                # MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Setup

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

Code Style

  • Follow Go conventions and idioms
  • Use go fmt to format code
  • Add comments for exported functions and types
  • Include tests for new functionality

License

This project is licensed under the MIT License - see the file for details.

Links


Made with Go | MCP Protocol Ready | VS Code Integrated