MCP ExplorerExplorer

Openapi Mcp Server

@3locon a year ago
1 MIT
FreeCommunity
AI Systems
This is a skeleton project that you can use as a starting point for building your own MCP server. The example addition function demonstrates how to implement handlers across all three protocols.

Overview

What is Openapi Mcp Server

OpenAPI MCP Server is a skeleton project designed to provide a foundation for building a multiprotocol communication server, implementing Standard I/O, Server-Sent Events, and OpenAPI/REST interfaces.

Use cases

The MCP server can be used in various scenarios, including microservices communication, real-time data streaming with SSE, and RESTful API development, making it suitable for applications requiring diverse interaction methods.

How to use

To use the server, you can build it using Docker Compose or Docker directly. Set the MODE environment variable to choose between stdio, SSE, or OpenAPI modes, and run the corresponding commands to start the server in the desired mode.

Key features

Key features include support for multiple communication modes (stdio, SSE, OpenAPI), flexible configuration via an mcp.json file, and simple deployment through Docker containers, enabling easy management and scalability.

Where to use

This server can be deployed in cloud environments, on local machines for development purposes, or within container orchestration platforms, making it versatile for both production and testing scenarios.

Content

OpenAPI MCP Server

This is a skeleton project that you can use as a starting point for building your own MCP server. The example addition function demonstrates how to implement handlers across all three protocols.

Features

Current implementation status:

  • ✅ Standard I/O (stdio)
  • ✅ Server-Sent Events (SSE)
  • ✅ OpenAPI/REST endpoints

Running Modes

The server supports three different modes of operation, controlled by the MODE environment variable:

  • stdio: Run as a standard I/O server
  • sse: Run as a Server-Sent Events server (port 8001)
  • openapi: Run as an OpenAPI/REST server (port 8002)

Building and Running

Using Docker Compose

  1. Build the container:
docker compose build
  1. Run specific services:
# Run all services
docker compose up

# Run only SSE server
docker compose up sse-mcp-server

# Run only OpenAPI server
docker compose up openapi-mcp-server

Using Docker directly

You can also run the server directly using Docker:

# Run in stdio mode
docker run -i --rm -e MODE=stdio 3loc/openapi-mcp-server

# Run in SSE mode
docker run -p 8001:8000 --rm -e MODE=sse 3loc/openapi-mcp-server

# Run in OpenAPI mode
docker run -p 8002:8000 --rm -e MODE=openapi 3loc/openapi-mcp-server

Configuration

The server can be configured using an mcp.json file. Here’s an example configuration:

{
  "mcpServers": {
    "stdio-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "--name",
        "openapi-mcp-server",
        "-e",
        "MODE=stdio",
        "3loc/openapi-mcp-server"
      ]
    },
    "sse-mcp-server": {
      "url": "http://localhost:8001/sse"
    }
  }
}

Development

The project provides a foundation for implementing an MCP server with multiple communication protocols. All three modes (stdio, SSE, and OpenAPI) are now implemented and can be used interchangeably based on your needs.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers