Implementing MCP Server for Chat UI
Model Context Protocol (MCP) is an open standard that provides a consistent way for AI applications to connect with external systems.
Note:
Use this implementation only when working with the PeopleSoft-delivered Chat UI. If you want to implement a generic MCP deployment that exposes PeopleSoft APIs to external LLM agents, refer to Configuring the MCP Stream Server.Note:
The framework provides the interfaces required to implement AI agents for the Chat UI but does not include AI agent logic. Customers are responsible for implementing the integration with their chosen LLM provider and MCP client, including connecting to the PeopleSoft MCP Server for the Chat UI, discovering and invoking MCP tools, and formatting the responses returned to Chat UI based on their business requirements.- Set up Application Server domain. The application server domain boot process starts the PSASSISTANTSRV server and advertises the GenAgentResponse service.
Login as the psadm1 user and run the following commands:
$ cd $PS_HOME/bin/ps_assistant $ python -m venv venv $ source venv/bin/activate $ python -m pip install -r requirements.txt - Enable the MCP Server feature for the Chat UI within the application server domain settings. This feature is disabled by default.
The following image illustrates the MCP Server feature for the Chat UI in the application server domain.

Enter Yes to enable the MCP Server feature for the Chat UI.
Enable the MCP Server feature for the Chat UI on only a single application server domain.Note:
The MCP Server feature for the Chat UI is only available for Linux application server domains. - Implement the
AgentOrchestratorclass based on your AI agent, LLM provider, and MCP client requirements. TheCustomAgentOrchestratorclass acts as the integration point between Chat UI, the MCP client, and the AI agent implementation.The following sample shows the defaultCustomAgentOrchestratorimplementation. Users can extend or replace this class to integrate their own MCP client, AI Agent, and business logic.class CustomAgentOrchestrator(AgentOrchestrator): """ Custom Agent Orchestrator template. Users can subclass or replace this implementation to integrate their own AI Agent, MCP client, and business logic while keeping the server contract unchanged. """ def __init__(self, config_file: str): """ Initialize the custom agent orchestrator. This constructor is invoked during the booting of the PSASSISTANTSRV application server process. Users can implement the following initialization logic here: 1. Read the MCP Server configuration from the config file. 2. Initialize the MCP client based on the selected LLM provider. 3. Connect the MCP client to the configured MCP Server. 4. Retrieve the available MCP Server tools. 5. Initialize the AI Agent. 6. Associate the retrieved MCP tools with the AI Agent. """ # Store the configuration file path. # The config file contains MCP Server details under the "mcpServers" section. self.config_file = config_file # Example placeholders for user implementation: # # self.mcp_client = initialize_mcp_client(self.config_file) # self.mcp_tools = self.mcp_client.get_available_tools() # self.ai_agent = initialize_ai_agent() # self.ai_agent.register_tools(self.mcp_tools) def get_query_result(self, user_query: dict) -> str: """ Process the chatbot user query and return the response. This method is invoked when a chat request is received from the chatbot UI. The user_query dictionary contains the user input, authentication details, chat metadata, and request-specific context. Sample user_query structure: { "username": "", "password": "", "token": "<PSTOKEN_REDACTED>", "basicauthtoken": "<BASIC_AUTH_TOKEN_REDACTED>", "headers": {}, "userprompt": "My emplid is KU0046, emplrcd is 0 and department name is CS", "message": "Hi", "chatid": "2ecadd283d1c82e597fcf2fa7e15b021", "authtype": "pstoken" } Field details: - username: User name, if available. - password: Password, if applicable. - token: PeopleSoft authentication token. This value should be handled securely. - basicauthtoken: Basic authentication token. This value should be handled securely. - headers: Additional request headers, if any. - userprompt: User-provided context or prompt details. - message: Current chat message entered by the user. - chatid: Unique chat session identifier. - authtype: Authentication type used for the request, such as "pstoken". Users can pass the relevant details from user_query to the AI Agent conversation flow. The AI Agent can then invoke the appropriate MCP Server tools, retrieve the required data, format the response, and return it as a string. The returned string will be displayed in the chatbot UI. """ # The user_query parameter contains the user input and chat metadata. # Example keys available in user_query: # # user_query["username"] -> User name, if provided. # user_query["password"] -> Password, if applicable. # user_query["token"] -> PeopleSoft token. Handle securely. # user_query["basicauthtoken"] -> Basic auth token. Handle securely. # user_query["headers"] -> Additional request headers. # user_query["userprompt"] -> User-provided prompt/context. # user_query["message"] -> Current chat message. # user_query["chatid"] -> Chat session ID. # user_query["authtype"] -> Authentication type, for example "pstoken". # # Avoid logging sensitive values such as password, token, or basicauthtoken # in production environments. # Example placeholder for user implementation: # # response = self.ai_agent.invoke(user_query) # return response return ( "CustomAgentOrchestrator default implementation. " "Override get_query_result to process user queries." ) def delete_all_chat_history(self, chatid: str) -> List[str]: """ Delete chat history for the given chat ID. Users can override this method if their AI Agent or LLM provider stores chat history externally and requires explicit cleanup. The method should return a list of deleted chat history identifiers, if applicable. """ # Default implementation does not perform any chat history cleanup. return []
Sample User Query Payload Format
user_query payload format in the AgentOrchestrator class implementation:{
"user_query": {
"username": "",
"password": "",
"token": "<PSTOKEN_REDACTED>",
"basicauthtoken": "<BASIC_AUTH_TOKEN_REDACTED>",
"headers": {},
"userprompt": "<USER_PROMPT_FROM_UI>",
"message": "<USER_MESSAGE_FROM_UI>",
"chatid": "<UNIQUE_CHAT_ID>",
"authtype": "pstoken"
}
}
Use the following configuration parameters to define user_query.
| Field Name | Type | Description |
|---|---|---|
username |
str |
Not required for this implementation. |
password |
str |
Not required for this implementation. |
token |
str |
This field will have |
basicauthtoken |
str |
Proxy user login details are used for PeopleSoft Application Service authentication. These details are generated by the UI and passed to the Agent Orchestrator as part of the |
headers |
dict |
Not required for this implementation. |
userprompt |
str |
The prompt data configured in the Prompt table will be available in this field. Users must define and set the prompt through the UI. |
message |
str |
The actual user chat message entered in the PeopleSoft Assistant Chat UI will be available in this field. |
chatid |
str |
A unique ID generated by the UI to track the conversation. |
authtype |
str |
The value is |