---
schema: rendered-html/v1
title: "Eunomia Authorization 🤝 FastMCP - FastMCP"
source_url: https://gofastmcp.com/integrations/eunomia-authorization
generated_at: 2026-06-11T19:42:06.733975+00:00
---




[FastMCP home page![light logo](images/gofastmcp__com__integrations__eunomia-authorization__wordmark.avif)![dark logo](images/gofastmcp__com__integrations__eunomia-authorization__wordmark-white.avif)](gofastmcp__com.md)







Auth

Eunomia Authorization 🤝 FastMCP



















  - [Auth0](gofastmcp__com__integrations__auth0.md)
  - [AuthKit](gofastmcp__com__integrations__authkit.md)
  - [AWS Cognito](gofastmcp__com__integrations__aws-cognito.md)
  - [Azure (Entra ID)](gofastmcp__com__integrations__azure.md)
  - [Descope](gofastmcp__com__integrations__descope.md)
  - [Discord](gofastmcp__com__integrations__discord.md)
  - [Eunomia Auth](/integrations/eunomia-authorization)
  - [GitHub](gofastmcp__com__integrations__github.md)
  - [Google](gofastmcp__com__integrations__google.md)
  - [Keycloak

    NEW](gofastmcp__com__integrations__keycloak.md)
  - [Oracle](gofastmcp__com__integrations__oci.md)
  - [Permit.io](gofastmcp__com__integrations__permit.md)
  - [PropelAuth](gofastmcp__com__integrations__propelauth.md)
  - [Scalekit](gofastmcp__com__integrations__scalekit.md)
  - [Supabase](gofastmcp__com__integrations__supabase.md)
  - [WorkOS](gofastmcp__com__integrations__workos.md)




- [How it Works](#how-it-works)
  - [Listing Operations](#listing-operations)
  - [Execution Operations](#execution-operations)
- [Add Authorization to Your Server](#add-authorization-to-your-server)
  - [Create a Server with Authorization](#create-a-server-with-authorization)
  - [Configure Access Policies](#configure-access-policies)
  - [Run the Server](#run-the-server)

Auth

# Eunomia Authorization 🤝 FastMCP


Add policy-based authorization to your FastMCP servers with Eunomia


Add **policy-based authorization** to your FastMCP servers with one-line code addition with the **[Eunomia](https://github.com/whataboutyou-ai/eunomia) authorization middleware**.
Control which tools, resources and prompts MCP clients can view and execute on your server. Define dynamic JSON-based policies and obtain a comprehensive audit log of all access attempts and violations.

## [​](#how-it-works) How it Works

Exploiting FastMCP’s [Middleware](gofastmcp__com__servers__middleware.md), the Eunomia middleware intercepts all MCP requests to your server and automatically maps MCP methods to authorization checks.

### [​](#listing-operations) Listing Operations

The middleware behaves as a filter for listing operations (`tools/list`, `resources/list`, `prompts/list`), hiding to the client components that are not authorized by the defined policies.

### [​](#execution-operations) Execution Operations

The middleware behaves as a firewall for execution operations (`tools/call`, `resources/read`, `prompts/get`), blocking operations that are not authorized by the defined policies.

## [​](#add-authorization-to-your-server) Add Authorization to Your Server

Eunomia is an AI-specific authorization server that handles policy decisions. The server runs embedded within your MCP server by default for a zero-effort configuration, but can alternatively be run remotely for centralized policy decisions.

### [​](#create-a-server-with-authorization) Create a Server with Authorization

First, install the `eunomia-mcp` package:

pip install eunomia-mcp

Then create a FastMCP server and add the Eunomia middleware in one line:


from eunomia_mcp import create_eunomia_middleware

# Create your FastMCP server
mcp = FastMCP("Secure MCP Server 🔒")

@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers"""
    return a + b

# Add middleware to your server
middleware = create_eunomia_middleware(policy_file="mcp_policies.json")
mcp.add_middleware(middleware)

    mcp.run()

### [​](#configure-access-policies) Configure Access Policies

Use the `eunomia-mcp` CLI in your terminal to manage your authorization policies:

# Create a default policy file
eunomia-mcp init

# Or create a policy file customized for your FastMCP server
eunomia-mcp init --custom-mcp "app.server:mcp"

This creates `mcp_policies.json` file that you can further edit to your access control needs.

# Once edited, validate your policy file
eunomia-mcp validate mcp_policies.json

### [​](#run-the-server) Run the Server

Start your FastMCP server normally:

python server.py

The middleware will now intercept all MCP requests and check them against your policies. Requests include agent identification through headers like `X-Agent-ID`, `X-User-ID`, `User-Agent`, or `Authorization` and an automatic mapping of MCP methods to authorization resources and actions.

For detailed policy configuration, custom authentication, and remote
deployments, visit the [Eunomia MCP Middleware
repository](https://github.com/whataboutyou-ai/eunomia/tree/main/pkgs/extensions/mcp).

[Discord OAuth 🤝 FastMCP

Previous](gofastmcp__com__integrations__discord.md)[GitHub OAuth 🤝 FastMCP

Next](gofastmcp__com__integrations__github.md)






