Skip to content

Commit 4ef5604

Browse files
teads-sylvainclaude
andcommitted
feat: add get_app_user tool to retrieve user assignment for an application
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 043ff2c commit 4ef5604

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ The Okta MCP Server provides the following tools for LLMs to interact with your
474474
| ----------------------------- | ------------------------------------------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------|
475475
| `list_applications` | List all applications in your Okta organization | - `Show me the applications in my Okta org` <br> - `Find applications with 'API' in their name` <br> - `What SSO applications do we have configured?` |
476476
| `get_application` | Get detailed information about a specific app | - `Show me details for the Salesforce application` <br> - `What are the callback URLs for our mobile app?` <br> - `Get the client ID for our web application` |
477+
| `get_app_user` | Get a user's assignment and profile for an app | - `Show me the app user profile for john.doe in the Salesforce app` <br> - `What attributes are mapped for this user in our SSO app?` <br> - `Get the external ID for this user in the provisioning app` |
477478
| `create_application` | Create a new application | - `Create a new SAML application for our HR system` <br> - `Set up a new API service application` <br> - `Add a mobile app integration` |
478479
| `update_application` | Update an existing application | - `Update the callback URLs for our web app` <br> - `Change the logo for the Salesforce application` <br> - `Modify the SAML settings for our HR system` |
479480
| `delete_application` | Delete an application (requires confirmation) | - `Delete the old legacy application` <br> - `Remove the unused test application` <br> - `Clean up deprecated integrations` |

src/okta_mcp_server/tools/applications/applications.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,38 @@ async def get_application(ctx: Context, app_id: str, expand: Optional[str] = Non
123123
return {"error": str(e)}
124124

125125

126+
@mcp.tool()
127+
async def get_app_user(ctx: Context, app_id: str, user_id: str) -> Any:
128+
"""Get a user assignment for an application by app ID and user ID.
129+
130+
Parameters:
131+
app_id (str, required): The ID of the application
132+
user_id (str, required): The ID of the user
133+
134+
Returns:
135+
Dictionary containing the app user profile and assignment details.
136+
"""
137+
logger.info(f"Getting app user: app_id={app_id}, user_id={user_id}")
138+
139+
manager = ctx.request_context.lifespan_context.okta_auth_manager
140+
141+
try:
142+
client = await get_okta_client(manager)
143+
logger.debug(f"Calling Okta API to get app user {user_id} in app {app_id}")
144+
145+
app_user, _, err = await client.get_application_user(app_id, user_id)
146+
147+
if err:
148+
logger.error(f"Okta API error while getting app user {user_id} in app {app_id}: {err}")
149+
return {"error": str(err)}
150+
151+
logger.info(f"Successfully retrieved app user: {user_id} in app {app_id}")
152+
return app_user
153+
except Exception as e:
154+
logger.error(f"Exception while getting app user {user_id} in app {app_id}: {type(e).__name__}: {e}")
155+
return {"error": str(e)}
156+
157+
126158
@mcp.tool()
127159
async def create_application(ctx: Context, app_config: Dict[str, Any], activate: bool = True) -> Any:
128160
"""Create a new application in the Okta organization.

0 commit comments

Comments
 (0)