MCP HubMCP Hub
y86

ex-mcp-test

by: y86

Test implementation of mcp server in Elixir

9created 30/11/2024
Visit
Elixir
Testing

📌Overview

Purpose: To provide a test implementation of the Model Context Protocol (MCP) server in Elixir for experimental and developmental purposes.

Overview: The ExMCP Test Server serves as a compliant JSON-RPC 2.0 server, facilitating the use of standard MCP protocol methods. It supports a modular architecture, allowing for enhanced validation and middleware capabilities through a schema-driven approach.

Key Features:

  • JSON-RPC 2.0 Compliance: Ensures compatibility with JSON-RPC protocol, allowing for seamless integration with various clients.

  • Pluggable Middleware Pipeline: Offers customization through middleware for additional processing and validation of requests.

  • Schema-driven Validation: Utilizes schema validation for request and response data, enhancing data integrity and reducing errors.

  • OpenRPC Specification: Includes detailed OpenRPC specifications to aid in API documentation and client generation.


ExMCP Test Server

An MCP (Model Context Protocol) server implementation in Elixir that provides a test implementation for experimenting with the protocol.

Features

  • JSON-RPC 2.0 compliant server implementation
  • Standard MCP protocol methods supported
  • Pluggable validation and middleware pipeline
  • Schema-driven request/response validation
  • OpenRPC specification included

Architecture

The server is built using:

  • PhxJsonRpc for the RPC layer
  • ExJsonSchema for schema validation
  • Jason for JSON encoding/decoding

Usage

Run the server locally:

mix run --no-halt

Configuration

Generate a release with:

mix release

Add it to your claude_desktop_config.json:

{
  "mcpServers": {
    "ex-mcp-test": {
      "command": "path/to/your/realease/bin/my_app",
      "args": [
        "start"
      ]
    }
  }
}

Development

Requirements:

  • Elixir 1.14+
  • Mix

Install dependencies:

mix deps.get

Run tests:

mix test

API Documentation

The server implements the following MCP methods:

initialize - Initialize the server
notifications/initialized - Handle initialization notification

prompts/list - List available prompts
resources/list - List available resources

tools/list - List available tools
tools/call - Call a specific tool

The OpenRPC specification can be found in priv/static/mcp-openrpc.json.

License

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