MCP ExplorerExplorer

Axum Http Mcp Server

@apepkusson a year ago
1 MIT
FreeCommunity
AI Systems
A server using Axum and WasmEdge for handling HTTP requests with a counter tool.

Overview

What is Axum Http Mcp Server

axum-http-mcp-server is a server built using the Axum framework, designed to handle HTTP requests and facilitate communication through JSON-RPC. It leverages the WasmEdge Runtime for executing WebAssembly modules.

Use cases

Use cases for axum-http-mcp-server include building APIs for web applications, creating microservices that handle specific tasks like counting, and integrating with other services that require JSON-RPC communication.

How to use

To use axum-http-mcp-server, clone the repository, build the project using Cargo, install the WasmEdge Runtime, and then start the server. You can interact with the server using curl commands to call various tools like ‘counter’.

Key features

Key features of axum-http-mcp-server include support for JSON-RPC, the ability to increment and decrement a counter, and the capability to retrieve the current counter value. It operates in a WebAssembly environment for enhanced performance.

Where to use

axum-http-mcp-server can be used in web applications that require efficient HTTP handling and real-time data manipulation, particularly in environments that support WebAssembly.

Content

Axum-HTTP-MCP-Server

Build

git clone https://github.com/apepkuss/axum-http-mcp-server.git

cd axum-http-mcp-server

cargo build --release

Run

  • Install WasmEdge Runtime
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install_v2.sh | bash -s -- -v 0.14.1
  • Start the server

    wasmedge --dir .:. ./target/wasm32-wasip1/release/axum-mcp-server.wasm
    
  • Test the server

    • Call “counter” tool to increment the counter

      curl -X POST http://localhost:10086/api/counter \
        --header "Content-Type: application/json" \
        --data '{
            "jsonrpc": "2.0",
            "id": 5,
            "method": "tools/call",
            "params": {
                "name": "counter",
                "arguments": {
                    "operation": "increment"
                }
            }
        }'
      

      Response:

      {
        "id": 5,
        "jsonrpc": "2.0",
        "result": {
          "value": 1
        }
      }
    • Call “counter” tool to decrement the counter

      curl -X POST http://127.0.0.1:10086/api/counter \
        --header "Content-Type: application/json" \
        --data '{
          "jsonrpc": "2.0",
          "id": 5,
          "method": "tools/call",
          "params": {
              "name": "counter",
              "arguments": {
                  "operation": "decrement"
              }
          }
      }'
      

      Response:

      {
        "id": 5,
        "jsonrpc": "2.0",
        "result": {
          "value": 0
        }
      }
    • Call “counter” tool to get the counter value

      curl -X POST http://127.0.0.1:10086/api/counter \
        --header "Content-Type: application/json" \
        --data '{
            "jsonrpc": "2.0",
            "id": 5,
            "method": "tools/call",
            "params": {
                "name": "counter",
                "arguments": {
                    "operation": "get_value",
                }
            }
        }'
      

      Response:

      {
        "id": 5,
        "jsonrpc": "2.0",
        "result": {
          "value": 0
        }
      }

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers