Auth Configuration
11/26/25Less than 1 minute
Auth Configuration
This document provides examples of common authentication configurations in the mcp-any-rest project and their HTTP data effects.
Table of Contents
Direct Authentication
Direct authentication uses pre-configured credentials that are directly included in every request.
Token Authentication
This is the simplest form of authentication, where the token is directly included in the request.
Configuration
{
"mode": "direct",
"direct_config": {
"auth_type": "token",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ"
},
"token_expiry": 3600,
"refresh_buffer": 300,
"max_retry_attempts": 3
}HTTP Data Effect
When making a request with this configuration, the following HTTP header will be added:
Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQRequest Example
GET /api/users HTTP/1.1
Host: example.com
Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ
Content-Type: application/jsonBearer Token Authentication
Bearer Token authentication is similar to Token authentication, but follows the standard Bearer Token format.
Configuration
{
"mode": "direct",
"direct_config": {
"auth_type": "bearer",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ"
},
"token_expiry": 3600,
"refresh_buffer": 300,
"max_retry_attempts": 3
}HTTP Data Effect
When making a request with this configuration, the following HTTP header will be added:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQRequest Example
GET /api/users HTTP/1.1
Host: example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ