URL: https://gofastmcp.com/integrations/eunomia-authorization
Title: Eunomia Authorization 🤝 FastMCP - FastMCP

Documentation Index
Fetch the complete documentation index at:
/llms.txt
Use this file to discover all available pages before exploring further.
Skip to main content
Meet
Prefect Horizon
, the enterprise MCP gateway built by the team behind FastMCP
FastMCP
home page
v3
Prefect Horizon
PrefectHQ/fastmcp
25,596
PrefectHQ/fastmcp
25,596
Search...
Navigation
Auth
Eunomia Authorization 🤝 FastMCP
Search the docs...
Ctrl
K
Documentation
Get Started
Welcome!
Installation
Quickstart
Servers
Overview
Core Components
Working with Tools
MCP Providers
Interactivity
Extensibility
Auth
Deployment
Apps
Overview
Quickstart
NEW
FastMCPApp
NEW
Interactive Tools
NEW
Generative UI
NEW
Custom HTML
Reference
Clients
Overview
Client-Only Package
Transports
fastmcp-remote
Operations
UPDATED
Authentication
UPDATED
Integrations
Auth
Auth0
AuthKit
AWS Cognito
Azure (Entra ID)
Descope
Discord
Eunomia Auth
GitHub
Google
Keycloak
NEW
Oracle
Permit.io
PropelAuth
Scalekit
Supabase
WorkOS
Web Frameworks
AI Assistants
AI SDKs
MCP.json
More
Settings
CLI
Upgrading
Development
What's New
FAQ
On this page
How it Works
Listing Operations
Execution Operations
Add Authorization to Your Server
Create a Server with Authorization
Configure Access Policies
Run the Server
Auth
Eunomia Authorization 🤝 FastMCP
Copy page
Add policy-based authorization to your FastMCP servers with Eunomia
Copy page
Add
policy-based authorization
to your FastMCP servers with one-line code addition with the
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
Exploiting FastMCP’s
Middleware
, the Eunomia middleware intercepts all MCP requests to your server and automatically maps MCP methods to authorization checks.
​
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
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
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
First, install the
eunomia-mcp
package:
pip
install
eunomia-mcp
Then create a FastMCP server and add the Eunomia middleware in one line:
server.py
from
fastmcp
import
FastMCP
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
)
if
__name__
==
"
__main__
"
:
mcp
.
run
()
​
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
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
.
Discord OAuth 🤝 FastMCP
Previous
GitHub OAuth 🤝 FastMCP
Next
Ctrl
+I
discord
github
website
x
Powered by
This documentation is built and hosted on Mintlify, a developer documentation platform
Assistant
Responses are generated using AI and may contain mistakes.
\n\n
\n
\n \n
\n
