Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
270 changes: 270 additions & 0 deletions docs/integrations/oci.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
---
title: OCI IAM OAuth 🤝 FastMCP
sidebarTitle: Oracle
description: Secure your FastMCP server with OCI IAM OAuth
icon: oracle
tag: NEW
---

import { VersionBadge } from "/snippets/version-badge.mdx"

<VersionBadge version="2.13.0" />

This guide shows you how to secure your FastMCP server using **OCI IAM OAuth**. Since OCI IAM doesn't support Dynamic Client Registration, this integration uses the [**OIDC Proxy**](/servers/auth/oidc-proxy) pattern to bridge OCI's traditional OAuth with MCP's authentication requirements.

## Configuration

### Prerequisites

1. An OCI cloud Account with access to create an Integrated Application in an Identity Domain.
2. Your FastMCP server's URL (For dev environments, it is http://localhost:8000. For PROD environments, it could be https://mcp.${DOMAIN}.com)

### Make sure client access is enabled for JWK's URL

1. Login to OCI console (https://cloud.oracle.com for OCI commercial cloud).
2. From "Identity & Security" menu, open Domains page.
3. On the Domains list page, select the domain that you are using for MCP Authentication.
4. Open Settings tab.
5. Click on "Edit Domain Settings" button.

![alt text](ocieditdomainsettingsbutton.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add descriptive alt text for accessibility.

The image uses generic "alt text" placeholder instead of describing the image content, which fails accessibility requirements.

Based on coding guidelines: "Include descriptive alt text for all images and diagrams."

Apply this diff:

-![alt text](ocieditdomainsettingsbutton.png)
+![Screenshot showing the Edit Domain Settings button in OCI console](ocieditdomainsettingsbutton.png)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
![alt text](ocieditdomainsettingsbutton.png)
![Screenshot showing the Edit Domain Settings button in OCI console](ocieditdomainsettingsbutton.png)
🤖 Prompt for AI Agents
In docs/integrations/oci.mdx around line 30 the image uses a placeholder alt
attribute ("alt text"); replace it with a concise, descriptive alt string that
conveys the image content and purpose (e.g., describe the button and the UI
context such as "OCI console — Edit Domain Settings button") so the markdown
image tag reads with a meaningful alt value for accessibility and screen
readers.


6. Enable "Configure client access" checkbox as show in the screenshot.

![alt text](ocieditdomainsettings.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add descriptive alt text for accessibility.

Apply this diff:

-![alt text](ocieditdomainsettings.png)
+![Screenshot of domain settings with Configure client access checkbox enabled](ocieditdomainsettings.png)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
![alt text](ocieditdomainsettings.png)
![Screenshot of domain settings with Configure client access checkbox enabled](ocieditdomainsettings.png)
🤖 Prompt for AI Agents
In docs/integrations/oci.mdx around line 34, the image uses a non-descriptive
alt text ("alt text") which hurts accessibility; replace it with a concise,
descriptive alt string that explains the image contents (e.g., "OCI Console —
Edit Domain Settings screenshot showing Domain Name and Configuration options")
so screen readers convey the image purpose; update the markdown image tag to use
that descriptive alt text.


### Create OAuth client for MCP server authentication
Follow the steps as mentioned below to create an OAuth client.

1. Login to OCI console (https://cloud.oracle.com for OCI commercial cloud).
2. From "Identity & Security" menu, open Domains page.
3. On the Domains list page, select the domain in which you want to create MCP server OAuth client. If you need help finding the list page for the domain, see [Listing Identity Domains.](https://docs.oracle.com/en-us/iaas/Content/Identity/domains/to-view-identity-domains.htm#view-identity-domains).
4. On the details page, select Integrated applications. A list of applications in the domain is displayed.
5. Select Add application.
6. In the Add application window, select Confidential Application.
7. Select Launch workflow.
8. In the Add application details page, Enter name and description as shown below.

![alt text](ociaddapplication.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add descriptive alt text for accessibility.

Apply this diff:

-![alt text](ociaddapplication.png)
+![Screenshot of the Add Application form with name and description fields](ociaddapplication.png)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
![alt text](ociaddapplication.png)
![Screenshot of the Add Application form with name and description fields](ociaddapplication.png)
🤖 Prompt for AI Agents
In docs/integrations/oci.mdx around line 48, the image uses a non-descriptive
alt attribute ("alt text"); replace it with meaningful descriptive alt text that
conveys the image content and purpose (e.g., what UI or step is shown and any
key labels or actions visible) so screen readers can understand the image;
ensure the alt text is concise, specific to the screenshot (not the filename)
and describes the relevant information a reader needs from the image.


9. Once the Integrated Application is created, Click on "OAuth configuration" tab.
10. Click on "Edit OAuth configuration" button.
11. Configure the application as OAuth client by selecting "Configure this application as a client now" radio button.
12. Select "Authorization code" grant type. If you are planning to use the same OAuth client application for token exchange then select "Client credentials" grant type as well. In the sample, we will use the same client.
13. For Authorization grant type, select redirect URL. This is, in most cases, will be MCP server URL followed by "/oauth/callback".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Inconsistent redirect path in documentation.

Line 54 states the redirect URL is /oauth/callback, but the code implementation uses /auth/callback as the default (line 236 confirms FASTMCP_SERVER_AUTH_OCI_REDIRECT_PATH defaults to /auth/callback).

Apply this diff:

-13. For Authorization grant type, select redirect URL. This is, in most cases, will be MCP server URL followed by "/oauth/callback".
+13. For Authorization grant type, select redirect URL. This is, in most cases, will be MCP server URL followed by "/auth/callback".
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
13. For Authorization grant type, select redirect URL. This is, in most cases, will be MCP server URL followed by "/oauth/callback".
13. For Authorization grant type, select redirect URL. This is, in most cases, will be MCP server URL followed by "/auth/callback".
🤖 Prompt for AI Agents
In docs/integrations/oci.mdx around line 54, the redirect URL is documented as
"/oauth/callback" but the code default and env var
(FASTMCP_SERVER_AUTH_OCI_REDIRECT_PATH) use "/auth/callback"; update the
documentation to use "/auth/callback" (or explicitly state that the redirect
path is configurable via FASTMCP_SERVER_AUTH_OCI_REDIRECT_PATH and defaults to
"/auth/callback") so the docs match the implementation.


![alt text](ocioauthconfiguration.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add descriptive alt text for accessibility.

Apply this diff:

-![alt text](ocioauthconfiguration.png)
+![Screenshot of OAuth configuration showing Authorization code grant type and redirect URL settings](ocioauthconfiguration.png)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
![alt text](ocioauthconfiguration.png)
![Screenshot of OAuth configuration showing Authorization code grant type and redirect URL settings](ocioauthconfiguration.png)
🤖 Prompt for AI Agents
In docs/integrations/oci.mdx around line 56, the image tag uses non-descriptive
alt text ("alt text"); replace it with a concise, meaningful description of the
image content and purpose (e.g., "OCI OAuth configuration screen showing client
ID, client secret, and redirect URI fields" or similar) so it conveys the image
to screen-reader users; update only the alt attribute text to accurately reflect
the screenshot's contents and intent.


14. Click on "Submit" button to update OAuth configuration for the client application.
**Note: You don't need to do any special configuration to support PKCE for the OAuth client.**
15. Make sure to Activate the client application.
16. Note down client ID and client secret for the application. Update .env file and replace IAM_CLIENT_ID and IAM_CLIENT_SECRET values.
17. IAM_DOMAIN in the env file is the Identity domain URL that you chose for the MCP server.

This is all you need to implement MCP server authentication against OCI IAM. However, if you want to use authenticated user token to invoke OCI control plane APIs and propagate identity to the OCI control plane instead of using a service user account, then you need to implement token exchange.

### Token Exchange Setup
Token exchange helps you exchange logged in user's OCI IAM token for OCI control plane session token aka. UPST. To learn more about token exchange, refer to my [Workload Identity Federation Blog.](https://www.ateam-oracle.com/post/workload-identity-federation)

For token exchange, we need to configure Identity propagation trust. The blog above talks more about setting up the trust using REST APIs. However, you can use oci cli as well. Before you use the cli command below, make sure to create token exchange OAuth client. In most cases, you can use the same OAuth client that you created above. You will use client ID of the token exchange OAuth client in the cli command below and replace it for {IAM_TOKENEXCHANGE_CLIENT_ID}.

You will also need to update client secret for the token exchange OAuth client in .env file. It is IAM_TOKENEXCHANGE_CLIENT_SECRET parameter. Update IAM_GUID and IAM_TOKENEXCHANGE_CLIENT_ID as well for the token exchange OAuth client in the .env file.

```
oci identity-domains identity-propagation-trust create \
--schemas '["urn:ietf:params:scim:schemas:oracle:idcs:IdentityPropagationTrust"]' \
--name "For Token Exchange" --type "JWT" \
--issuer "https://identity.oraclecloud.com/" \
--endpoint "https://${IAM_GUID}}.identity.oraclecloud.com" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix syntax error in CLI command.

The command has an extra closing brace: ${IAM_GUID}} should be ${IAM_GUID}.

Apply this diff:

---endpoint "https://${IAM_GUID}}.identity.oraclecloud.com" \
+--endpoint "https://${IAM_GUID}.identity.oraclecloud.com" \
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
--endpoint "https://${IAM_GUID}}.identity.oraclecloud.com" \
--endpoint "https://${IAM_GUID}.identity.oraclecloud.com" \
🤖 Prompt for AI Agents
In docs/integrations/oci.mdx around line 78, the CLI command contains a syntax
error with an extra closing brace in the endpoint variable (${IAM_GUID}}).
Remove the extra brace so the placeholder reads ${IAM_GUID}; update the endpoint
string to "https://${IAM_GUID}.identity.oraclecloud.com" to correct the
substitution and ensure the CLI parses the variable correctly.

--subject-claim-name "sub" --allow-impersonation false \
--subject-mapping-attribute "username" \
--subject-type "User" --client-claim-name "iss" \
--client-claim-values '["https://identity.oraclecloud.com/"]' \
--oauth-clients '["{IAM_TOKENEXCHANGE_CLIENT_ID}"]'
```

To exchange access token for OCI token and create a signer object, you need to add below code in MCP server. You can then use the signer object to create any OCI control plane client.

```
_global_token_cache = {} #In memory cache for OCI session token signer

def get_oci_signer() -> TokenExchangeSigner:

#Check if the signer exists for the token ID in memory cache
cached_signer = _global_token_cache.get(tokenID)
logger.debug(f"Global cached signer: {cached_signer}")
if cached_signer:
logger.debug(f"Using globally cached signer for token ID: {tokenID}")
return cached_signer

#If the signer is not yet created for the token then create new OCI signer object
logger.debug(f"Creating new signer for token ID: {tokenID}")
signer = TokenExchangeSigner(
jwt_or_func=token,
oci_domain_id=IAM_GUID,
client_id=IAM_TOKENEXCHANGE_CLIENT_ID,
client_secret=IAM_TOKENEXCHANGE_CLIENT_SECRET
)
logger.debug(f"Signer {signer} created for token ID: {tokenID}")

#Cache the signer object in memory cache
_global_token_cache[tokenID] = signer
logger.debug(f"Signer cached for token ID: {tokenID}")

return signer
```
Comment on lines +88 to +115
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Incomplete code example with undefined variables.

The token exchange example references undefined variables (tokenID, token, IAM_GUID, IAM_TOKENEXCHANGE_CLIENT_ID, IAM_TOKENEXCHANGE_CLIENT_SECRET) and is missing necessary imports.

Users cannot copy and execute this code as-is, violating the coding guideline: "Always include complete, runnable code examples that users can copy and execute."

Add the missing context:

+```python
+import os
+from oci.auth.signers import TokenExchangeSigner
+from fastmcp.server.dependencies import get_access_token
+
+# Configuration from environment
+IAM_GUID = os.environ["IAM_GUID"]
+IAM_TOKENEXCHANGE_CLIENT_ID = os.environ["IAM_TOKENEXCHANGE_CLIENT_ID"]
+IAM_TOKENEXCHANGE_CLIENT_SECRET = os.environ["IAM_TOKENEXCHANGE_CLIENT_SECRET"]
+
 _global_token_cache = {} #In memory cache for OCI session token signer
     
 def get_oci_signer() -> TokenExchangeSigner:
+    # Get the access token from the current request
+    access_token_obj = get_access_token()
+    token = access_token_obj.token
+    tokenID = access_token_obj.claims.get("jti")  # JWT ID as cache key
     
     #Check if the signer exists for the token ID in memory cache
🤖 Prompt for AI Agents
In docs/integrations/oci.mdx around lines 88 to 115 the example references
undefined variables and missing imports which makes it non-runnable; add the
necessary imports (os, TokenExchangeSigner, get_access_token), load IAM_GUID,
IAM_TOKENEXCHANGE_CLIENT_ID and IAM_TOKENEXCHANGE_CLIENT_SECRET from environment
variables, and inside get_oci_signer call get_access_token() to extract the
access token string and a stable tokenID (e.g., JWT "jti") to use as the cache
key before checking/creating the TokenExchangeSigner and storing it in
_global_token_cache.


## Running MCP server

Once the setup is complete, to run the MCP server, run the below command.
```
fastmcp run server.py:mcp --transport http --port 8000
```

To run MCP client, run the below command.
```
python3 client.py
```
MCP Client sample is as below.
```
from fastmcp import Client
import asyncio

async def main():
# The client will automatically handle OCI OAuth flows
async with Client("http://localhost:8000/mcp/", auth="oauth") as client:
# First-time connection will open OCI login in your browser
print("✓ Authenticated with OCI IAM")

tools = await client.list_tools()
print(f"🔧 Available tools ({len(tools)}):")
for tool in tools:
print(f" - {tool.name}: {tool.description}")

if __name__ == "__main__":
asyncio.run(main())
```

When you run the client for the first time:
1. Your browser will open to OCI IAM's login page
2. Sign in with your OCI account and grant the requested permissions
3. After authorization, you'll be redirected back
4. The client receives the token and can make authenticated requests

## Production Configuration

<VersionBadge version="2.13.0" />

For production deployments with persistent token management across server restarts, configure `jwt_signing_key`, and `client_storage`:

```python server.py

import os
from fastmcp import FastMCP
from fastmcp.server.auth.providers.oci import OCIProvider
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Incorrect import path.

The import path fastmcp.server.auth.providers.oci is incorrect. Based on the file being added, it should be fastmcp.server.auth.providers.ociprovider.

Apply this diff:

-from fastmcp.server.auth.providers.oci import OCIProvider
+from fastmcp.server.auth.providers.ociprovider import OCIProvider
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
from fastmcp.server.auth.providers.oci import OCIProvider
from fastmcp.server.auth.providers.ociprovider import OCIProvider
🤖 Prompt for AI Agents
In docs/integrations/oci.mdx around line 164, the import path used is incorrect;
replace the import from fastmcp.server.auth.providers.oci with
fastmcp.server.auth.providers.ociprovider so it matches the actual module name.
Update the single import statement to reference the ociprovider module and save
the file.


from key_value.aio.stores.redis import RedisStore
from key_value.aio.wrappers.encryption import FernetEncryptionWrapper
from cryptography.fernet import Fernet

# Production setup with encrypted persistent token storage
auth_provider = OCIProvider(
config_url="https://{IDCS_GUID}.identity.oraclecloud.com/.well-known/openid-configuration",
client_id="tv2ObNgaZAWWhhycr7Bz1LU2mxlnsmsB",
client_secret="idcscsvPYqbjemq...",
Comment on lines +173 to +174
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Remove hardcoded credentials from example.

The example includes what appear to be real client IDs and partial secrets. Even if these are fake, it sets a bad precedent.

Based on coding guidelines: "Use realistic data instead of placeholder values" - but for credentials, use environment variables.

Apply this diff:

     config_url="https://{IDCS_GUID}.identity.oraclecloud.com/.well-known/openid-configuration",
-    client_id="tv2ObNgaZAWWhhycr7Bz1LU2mxlnsmsB",
-    client_secret="idcscsvPYqbjemq...",
+    client_id=os.environ["OCI_CLIENT_ID"],
+    client_secret=os.environ["OCI_CLIENT_SECRET"],
     base_url="https://your-production-domain.com",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
client_id="tv2ObNgaZAWWhhycr7Bz1LU2mxlnsmsB",
client_secret="idcscsvPYqbjemq...",
config_url="https://{IDCS_GUID}.identity.oraclecloud.com/.well-known/openid-configuration",
client_id=os.environ["OCI_CLIENT_ID"],
client_secret=os.environ["OCI_CLIENT_SECRET"],
base_url="https://your-production-domain.com",
🤖 Prompt for AI Agents
In docs/integrations/oci.mdx around lines 173 to 174, remove the hardcoded
client_id and client_secret values and replace them with instructions to pull
credentials from environment variables (or clearly named placeholders
referencing env vars) so examples no longer contain secrets; update the snippet
and surrounding text to show using environment variables (e.g., OCI_CLIENT_ID,
OCI_CLIENT_SECRET) and add a short note advising readers to set these in their
environment or secret manager rather than embedding credentials in code.

base_url="https://your-production-domain.com",

# Production token management
jwt_signing_key=os.environ["JWT_SIGNING_KEY"],
client_storage=FernetEncryptionWrapper(
key_value=RedisStore(
host=os.environ["REDIS_HOST"],
port=int(os.environ["REDIS_PORT"])
),
fernet=Fernet(os.environ["STORAGE_ENCRYPTION_KEY"])
)
)

mcp = FastMCP(name="Production OCI App", auth=auth_provider)
```

<Note>
Parameters (`jwt_signing_key` and `client_storage`) work together to ensure tokens and client registrations survive server restarts. **Wrap your storage in `FernetEncryptionWrapper` to encrypt sensitive OAuth tokens at Rest** - without it, tokens are stored in plaintext. Store secrets in environment variables and use a persistent storage backend like Redis for distributed deployments.

For complete details on these parameters, see the [OAuth Proxy documentation](/servers/auth/oauth-proxy#configuration-parameters).
</Note>

<Info>
The client caches tokens locally, so you won't need to re-authenticate for subsequent runs unless the token expires or you explicitly clear the cache.
</Info>

## Environment Variables

For production deployments, use environment variables instead of hardcoding credentials.

### Provider Selection

Setting this environment variable allows the OCI provider to be used automatically without explicitly instantiating it in code.

<Card>
<ParamField path="FASTMCP_SERVER_AUTH" default="Not set">
Set to `fastmcp.server.auth.providers.oci.OCIProvider` to use OCI IAM authentication.
</ParamField>
</Card>

### OCI-Specific Configuration

These environment variables provide default values for the OCI IAM provider, whether it's instantiated manually or configured via `FASTMCP_SERVER_AUTH`.

<Card>
<ParamField path="FASTMCP_SERVER_AUTH_OCI_CONFIG_URL" required>
Your OCI Application Configuration URL (e.g., `https://{IDCS_GUID}.identity.oraclecloud.com/.well-known/openid-configuration`)
</ParamField>

<ParamField path="FASTMCP_SERVER_AUTH_OCI_CLIENT_ID" required>
Your OCI Application Client ID (e.g., `tv2ObNgaZAWWhhycr7Bz1LU2mxlnsmsB`)
</ParamField>

<ParamField path="FASTMCP_SERVER_AUTH_OCI_CLIENT_SECRET" required>
Your OCI Application Client Secret (e.g., `vPYqbjemq...`)
</ParamField>

<ParamField path="FASTMCP_SERVER_AUTH_OCI_BASE_URL" required>
Public URL where OAuth endpoints will be accessible (includes any mount path)
</ParamField>

<ParamField path="FASTMCP_SERVER_AUTH_OCI_REDIRECT_PATH" default="/auth/callback">
Redirect path configured in your OCI IAM Integrated Application
</ParamField>

</Card>

Example `.env` file:
```bash
# Use the OCI IAM provider
FASTMCP_SERVER_AUTH=fastmcp.server.auth.providers.oci.OCIProvider

# OCI IAM configuration and credentials
FASTMCP_SERVER_AUTH_OCI_CONFIG_URL=https://{IDCS_GUID}.identity.oraclecloud.com/.well-known/openid-configuration
FASTMCP_SERVER_AUTH_OCI_CLIENT_ID=tv2ObNgaZAWWhhycr7Bz1LU2mxlnsmsB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Remove potentially real client ID from documentation.

Line 249 contains what appears to be a real client ID (tv2ObNgaZAWWhhycr7Bz1LU2mxlnsmsB), which was also flagged by Gitleaks as a potential secret. Even if this is a fake example, it's identical to line 173 and should use a placeholder.

Based on static analysis hints.

Apply this diff:

-FASTMCP_SERVER_AUTH_OCI_CLIENT_ID=tv2ObNgaZAWWhhycr7Bz1LU2mxlnsmsB
+FASTMCP_SERVER_AUTH_OCI_CLIENT_ID=your_oci_client_id_here
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
FASTMCP_SERVER_AUTH_OCI_CLIENT_ID=tv2ObNgaZAWWhhycr7Bz1LU2mxlnsmsB
FASTMCP_SERVER_AUTH_OCI_CLIENT_ID=your_oci_client_id_here
🧰 Tools
🪛 Gitleaks (8.28.0)

[high] 249-249: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🤖 Prompt for AI Agents
In docs/integrations/oci.mdx around line 249, replace the actual-looking client
ID value (tv2ObNgaZAWWhhycr7Bz1LU2mxlnsmsB) with a non-sensitive placeholder
(e.g. FASTMCP_SERVER_AUTH_OCI_CLIENT_ID=REPLACE_WITH_OCI_CLIENT_ID or
FASTMCP_SERVER_AUTH_OCI_CLIENT_ID=${OCI_CLIENT_ID}); also check and replace the
identical value at line 173 to avoid leaking secrets and re-run the secret
scanner to confirm removal.

FASTMCP_SERVER_AUTH_OCI_CLIENT_SECRET=idcscsvPYqbjemq...
FASTMCP_SERVER_AUTH_OCI_BASE_URL=https://your-server.com
```

With environment variables set, your server code simplifies to:

```python server.py
from fastmcp import FastMCP

# Authentication is automatically configured from environment
mcp = FastMCP(name="OCI Secured App")

@mcp.tool
def whoami() -> str:
"""The whoami function is to test MCP server without requiring token exchange.
This tool can be used to test successful authentication against OCI IAM.
It will return logged in user's subject (username from IAM domain)."""
token = get_access_token()
user = token.claims.get("sub")
return f"You are User: {user}"
Comment on lines +267 to +269
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add missing import to make example complete.

The whoami function uses get_access_token() but the import is not shown in this code block.

Apply this diff:

 ```python server.py
 from fastmcp import FastMCP
+from fastmcp.server.dependencies import get_access_token
 
 # Authentication is automatically configured from environment
🤖 Prompt for AI Agents
In docs/integrations/oci.mdx around lines 267 to 269 the example calls
get_access_token() but does not show its import; add an import line for
get_access_token from fastmcp.server.dependencies alongside the existing FastMCP
import (i.e., insert "from fastmcp.server.dependencies import get_access_token"
near the top of the Python example imports) so the whoami example is complete
and runnable.

```
Binary file added docs/integrations/ociaddapplication.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/integrations/ocieditdomainsettings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/integrations/ocieditdomainsettingsbutton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/integrations/ocioauthconfiguration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading