Access Request MCP Implementation Guide
The Permit.io Access Request MCP Server is a powerful way to control AI automation with human oversight. It is designed for use in agentic systems where AI tools don’t just generate text but initiate real-world actions.
You can read more about its use cases here
Deployment Options
The Permit MCP server can be deployed in two primary ways:
Local Mode
Ideal for testing and development, the server can be run alongside agents like Claude Desktop. It executes locally, with environment-based secrets.
Hosted / Production Mode
In production, the server is deployed within a secure backend environment. It handles requests from AI agents (like LangGraph or LangChain) and interacts with the Permit.io API to enforce fine-grained access control policies.
Requirements
To run and develop with the Permit MCP server, you'll need the following tools and language support in your environment:
Required
Python ≥ 3.10
The server uses modern async features and type annotations that require Python 3.10 or later.
uv ≥ 0.6.1
uv is a modern Python package manager and virtual environment tool used to manage dependencies and run the project.
A Permit.io Account
You’ll need API credentials and configuration values from your Permit.io dashboard.
Additional Dependencies (Automatically Installed)
The following libraries will be installed via uv:
fastapi: for building async APIsmcp: for MCP tool interfaces and executionpermit-sdk: official Permit Python SDKpython-dotenv: for managing environment variablesaiosqlite: for async database interactions (if extending the server)bcrypt,python-jose[cryptography]: for auth features in custom serverswebsockets,httpx,rich: used in more advanced setups like the CLI demo or FastAPI backend
You do not need to install these manually—just follow the installation instructions using uv in the next section and all dependencies will be resolved.
Installation
Clone the MCP Server Repository
Clone the repository from GitHub, and change directory to the project folder
git clone https://github.com/permitio/permit-mcp
cd permit-mcp
Create and Activate a Virtual Environment
Use uv to set up a new environment, and activate it for your OS
uv venv
source .venv/bin/activate # For Windows: .venv\Scripts\activate
If you don’t have uv installed yet, follow the instructions at https://github.com/astral-sh/uv.
Install Dependencies
Install the project and all required dependencies in editable mode.
This ensures all MCP tools, Permit SDKs, and FastAPI components are available
uv pip install -e .
MCP Server Configuration
Before running the MCP server, you’ll need to configure environment variables that connect your instance to your Permit.io project and define the resources and flows you intend to manage.
Create a .env File
Use the provided .env.example as a starting point:
cp .env.example .env
Then open .env and set the following variables:
Required Variables
| Variable | Description |
|---|---|
PERMIT_API_KEY | Your Permit API key. Get this from the Permit dashboard under API Keys. |
PERMIT_PDP_URL | The Permit PDP (Policy Decision Point) URL. Defaults to https://cloudpdp.api.permit.io . |
TENANT | Tenant identifier for your application. Most use "default". |
PROJECT_ID | Your Permit project ID. Found in the Permit dashboard under Project Settings. |
ENV_ID | Your Permit environment ID (e.g., production, staging). |
RESOURCE_KEY | The key of the resource type you want to manage (e.g., restaurants). |
ACCESS_ELEMENTS_CONFIG_ID | ID of the user management element. Found under Elements > User Management. |
OPERATION_ELEMENTS_CONFIG_ID | ID of the operation approval element. Found under Elements > Approval Management. |
Example
PERMIT_API_KEY=pk_123abc456
PERMIT_PDP_URL=http://localhost:7766
TENANT=default
PROJECT_ID=proj_abc123
ENV_ID=env_prod
RESOURCE_KEY=restaurants
ACCESS_ELEMENTS_CONFIG_ID=restaurant-requests
OPERATION_ELEMENTS_CONFIG_ID=dish-requests
Use Local PDP for ReBAC Authorization
If your project uses ABAC (Attribute-Based Access Control) or ReBAC (Relationship-Based Access Control),
you must run the Permit Local PDP and point PERMIT_PDP_URL to:
PERMIT_PDP_URL=http://localhost:7766
This setup enables ReBAC role checks and contextual permission logic not available in the default cloud PDP.
Optional — Sync Users with Additional Metadata
To enhance clarity in the UI and debugging tools, it's recommended to sync users with first_name or role metadata:
await permit.api.sync_user({
"key": user_id,
"first_name": firstname
})
This makes reviewing access and approval requests easier and more auditable.
Running the Server
The Permit MCP server can be run either locally for development and testing—e.g., with Claude Desktop or another AI client—or deployed in a hosted environment for use in production AI workflows.
Local Usage with Claude Desktop
For testing locally with a conversational AI interface (like Claude Desktop), you can configure Claude to launch the MCP server as a subprocess using the following config:
Claude Desktop Configuration
{
"mcpServers": {
"permit": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/src/permit_mcp",
"run",
"server.py"
]
}
}
}
Replace /ABSOLUTE/PATH/TO/PARENT/FOLDER/ with the correct local file path to your cloned permit-mcp repo.
Claude will automatically start the server using this configuration and route tool requests to it.
Hosted / Production Deployment
For production use, the MCP server should be deployed alongside your LLM application (or behind an API gateway) in a secure environment. In this setup:
- The MCP server handles sensitive logic and connects to Permit.io’s PDP.
- The LLM agent (e.g., LangGraph, LangChain) calls MCP tools when the user requests access or approval.
- The Permit dashboard is used to monitor, approve, or deny requests, or this can be done via the API.
A working production example is included in the Family Food Ordering CLI Tool tutorial.
Verifying It’s Working
After configuring your .env and launching the server:
uv run server.py
You should see output indicating that the server is running and ready to accept tool calls from a connected AI client.
Extending the MCP Server
The Permit MCP server is designed to be modular and developer-friendly. It allows you to extend, override, or selectively exclude tools to fit the needs of your application.
Why use MCP Server Extensions?
- Add domain-specific functionality (e.g. list, update, or delete domain entities)
- Enforce custom business logic on top of Permit checks
- Customize request routing or formatting for specific LLMs or frontends
- Interoperate with ReBAC attributes, external services, or embedded tools
Importing the Server Class
The core server logic is encapsulated in the PermitServer class, which plugs into your FastMCP instance:
from mcp.server.fastmcp import FastMCP
from src.permit_mcp.server import PermitServer
mcp = FastMCP("custom_server_name")
permit_server = PermitServer(mcp)
This will register all built-in tools like create_access_request, list_resource_instances, and others onto your MCP instance.
Excluding Tools
Want to remove certain tools? Use the exclude_tools parameter when instantiating PermitServer:
permit_server = PermitServer(
mcp,
exclude_tools=['create_access_request', 'create_operation_approval']
)
Only the remaining tools will be available to your LLM or frontend.
Adding Custom Tools
You can easily register your own tools alongside Permit’s by using the @mcp.tool() decorator:
@mcp.tool()
async def list_dishes(user_id: str, restaurant_id: str) -> List[str]:
# Custom logic to fetch dish data from a database
...
This allows your AI agent to interact with your application’s business logic while still using the Permit SDK for permission enforcement.