Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eunomia library MCP Server #555

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vincenzopecorella
Copy link

Description

Eunomia is an open-source Python library developed by What About You for data governance in Large Language Model (LLM) applications. It offers precise control over the data entering LLM-based applications by enforcing governance at the token level. Eunomia utilizes a modular set of instruments to address specific challenges, allowing for versatile combinations to support a wide variety of use cases.

Today, the integration of Eunomia with the Model Context Protocol (MCP) has been launched, significantly enhancing the ability to govern unstructured data flowing through MCP servers into enterprise LLM-powered applications.

Server Details

  • Changes to: Readme.md

Motivation and Context

Eunomia MCP Server is an extension of the Eunomia framework that connects Eunomia instruments with MCP servers. It provides a simple way to orchestrate data governance policies (like PII detection or user access control) and seamlessly integrate them with external server processes in the MCP ecosystem.

How Has This Been Tested?

Tested with LLM client implementation reported in the modelcontextprotocol docs

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • [x ] Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

Overview

Eunomia MCP Server is an extension of the Eunomia framework that connects Eunomia instruments with MCP servers. It provides a simple way to orchestrate data governance policies (like PII detection or user access control) and seamlessly integrate them with external server processes in the MCP ecosystem.

With Eunomia MCP Server, you can:

  • Enforce data governance on top of LLM or other text-based pipelines.
  • Orchestrate multiple servers that communicate via the MCP framework.

Get Started

Installation

git clone https://github.com/whataboutyou-ai/eunomia-mcp-server.git

Basic Usage

Eunomia MCP Server uses the same "instrument" concept as Eunomia. By defining your set of instruments in an Orchestra, you can apply data governance policies to text streams that flow through your MCP-based servers.

Below is a simplified example of how to define application settings and run the MCP server with uv.

"""
Example Settings for MCP Orchestra Server
=========================================
This example shows how we can combine Eunomia with a web-browser-mcp-server
(https://github.com/blazickjp/web-browser-mcp-server).
"""

from pydantic_settings import BaseSettings
from pydantic import ConfigDict
from eunomia.orchestra import Orchestra
from eunomia.instruments import IdbacInstrument, PiiInstrument


class Settings(BaseSettings):
    """
    Application settings class for MCP orchestra server using pydantic_settings.

    Attributes:
        APP_NAME (str): Name of the application
        APP_VERSION (str): Current version of the application
        LOG_LEVEL (str): Logging level (default: "info")
        MCP_SERVERS (dict): Servers to be connected
        ORCHESTRA (Orchestra): Orchestra class from Eunomia to define data governance policies
    """

    APP_NAME: str = "mcp-server_orchestra"
    APP_VERSION: str = "0.1.0"
    LOG_LEVEL: str = "info"
    MCP_SERVERS: dict = {
        "web-browser-mcp-server": {
            "command": "uv",
            "args": [
                "tool",
                "run",
                "web-browser-mcp-server"
            ],
            "env": {
                "REQUEST_TIMEOUT": "30"
            }
        }
    }
    ORCHESTRA: Orchestra = Orchestra(
        instruments=[
            PiiInstrument(entities=["EMAIL_ADDRESS", "PERSON"], edit_mode="replace"),
            # You can add more instruments here
            # e.g., IdbacInstrument(), etc.
        ]
    )

Running the Server

Once your settings are defined, you can run the MCP Orchestra server by pointing uv to the directory containing your server code, for example:

uv --directory "path/to/server/" run orchestra_server

This will:

  1. Load the settings from .env or environment variables.
  2. Launch the Eunomia MCP Server to handle requests and orchestrate your external MCP server(s).
  3. Apply Eunomia instruments (like PiiInstrument) to the incoming text, ensuring data governance policies are automatically enforced.

Further Reading

For more detailed usage, advanced configuration, and additional instruments, check out the following resources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant