axum-http-mcp-server

axum-http-mcp-server

1

Axum-HTTP-MCP-Server is a server project that uses Axum framework and is run using WasmEdge Runtime. It allows users to perform operations like incrementing, decrementing, and retrieving the value of a counter through HTTP API calls.

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
          }
      }