Eunomia Authorization + FastMCP
Add policy-based authorization to your FastMCP servers
Add policy-based authorization to your FastMCP servers with minimal code changes using Eunomia authorization middleware.
Control which actions MCP clients can perform on your server by restricting how the agent can access resources, tools and prompts by using JSON-based policies, while obtaining a comprehensive audit log of all access attempts and violations.
Eunomia Authorization Middleware
The middleware intercepts all MCP requests to your server and automatically maps MCP methods to authorization checks.
Eunomia is an AI-specific standalone authorization server that handles policy decisions. You must have an Eunomia server running alongside your FastMCP server for the middleware to function.
Run it in the background with Docker:
Create a Server with Authorization
First, install the eunomia-mcp
package:
Then create a FastMCP server and add the Eunomia middleware with a few lines of code:
Configure Access Policies
Use the eunomia-mcp
CLI in your terminal to manage your authorization policies:
This creates a policy file you can customize to control access to your MCP tools and resources.
Run the Server
Start your FastMCP server normally:
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
, or Authorization
and an automatic mapping of MCP methods to authorization resources and actions.
For detailed policy configuration, custom authentication, and advanced deployment patterns, visit the Eunomia MCP Middleware repository.