--- pdfexport: true alias: tutorials-ai-custom-agent-mcp-server timetoread: true tutorial: full description: "Configure a custom AI Agent and MCP Server for a Cookie Factory scenario in Critical Manufacturing MES" --- # Configure a Custom Agent and MCP Server This advanced tutorial shows how to configure a user-defined **AI Agent** that can use the tools provided by a user-defined **MCP Server**. The scenario uses a Cookie Factory operations assistant that users select from **AI**. ## Before You Start Review the configuration information in [[user-guide-ai-agent|AI Agent]], [[user-guide-ai-mcp-server|AI MCP Server]], and [[user-guide-ai-prompt-configuration|Prompt Configuration]]. ## Prepare the Scenario Prepare the following items before creating the custom configuration: | Item | Required preparation | Reference | | --- | --- | --- | | **AI Infrastructure** | Verify that the AI Infrastructure is deployed and configured in the environment. | [[user-guide-ai-librechat-integration|LibreChat Integration]] | | MCP-compatible tool server | Obtain the approved endpoint URL, authentication requirements, and credentials from the server owner. Obtain the required trusted certificates when the endpoint uses TLS. | [[user-guide-ai-mcp-server|AI MCP Server]] | | **Model** | Identify a **Model** that is available for the user-defined **AI Agent**. | [[user-guide-ai-agent|AI Agent]] | | User access | Confirm that your user can create and manage **AI Agents** and **MCP Servers**. | [[user-guide-ai-agent|AI Agent]] and [[user-guide-ai-mcp-server|AI MCP Server]] | Table: Custom Agent and MCP Server scenario setup ## Scenario !!! info "Cookie Factory Scenario" The Cookie Factory scenario is an example only. Use an approved tool server and a business scenario available in your environment. Adapt the Agent, MCP Server, and object names to your own scenario. Cookie Factory supervisors need an assistant that can answer questions about production operations by using an approved tool server. The configuration includes: * An **MCP Server** named `Cookie Factory Tools`. * An **AI Agent** named `Cookie Factory Operations Assistant`. * A direct **AI** conversation that users can start with the configured agent. ## Create the MCP Server 1. Open the **AI MCP Server** page. 2. Create a user-defined **MCP Server** named `Cookie Factory Tools`. 3. Enter the approved **URL**. 4. Select the **Authentication Mode** required by the tool server and provide the required authentication information. ![Custom MCP Server Configuration](../../images/ai_custom_agent_mcp_tutorial01.png) 5. Save the **MCP Server**. ![Custom MCP Server Synchronization Status](../../images/ai_custom_agent_mcp_tutorial02.png) 6. After the runtime synchronizes the **MCP Server**, confirm that the **Tools** section displays the available tool metadata. ![Custom MCP Server Tools Synchronized](../../images/ai_custom_agent_mcp_tutorial03.png) The **MCP Server** provides tools to the runtime. It does not define how the assistant responds to a prompt. ## Create the Agent 1. Open the **AI Agent** page. 2. Create a user-defined **AI Agent** named `Cookie Factory Operations Assistant`. 3. Select the required **Model**. ![Custom Agent Configuration](../../images/ai_custom_agent_mcp_tutorial04.png) 4. Open **Instructions** and enter instructions that describe the intended scope of the assistant. Example instructions: `Help Cookie Factory supervisors review production operations. Use the available tools only when they are relevant, and state when the available context is insufficient to answer the question.` ![Custom Agent Instructions](../../images/ai_custom_agent_mcp_tutorial05.png) 5. Create the Agent. ![Created Agent](../../images/ai_custom_agent_mcp_tutorial06.png) 6. Open **MCP Servers** and select **Manage**. ![Add the Custom MCP Server - Manage](../../images/ai_custom_agent_mcp_tutorial07.png) 7. Select the Custom **MCP Server** `Cookie Factory Tools` and the required Tools. ![Add the Custom MCP Server - Select](../../images/ai_custom_agent_mcp_tutorial08.png) 8. Refresh the **AI Agent** and confirm that it is connected to the custom **MCP Server**. ![Add the Custom MCP Server - Updated](../../images/ai_custom_agent_mcp_tutorial09.png) The selected **MCP Server** determines which tools are available to the **AI Agent** after synchronization. ## Use the Agent in AI 1. From the main navigation menu, select **AI**. 2. Select `Cookie Factory Operations Assistant`. ![Custom Agent Available on AI](../../images/ai_custom_agent_mcp_tutorial10.png) 3. Enter a question that is relevant to the configured assistant and its available tools. 4. Review the response. ![Custom Agent in use on AI](../../images/ai_custom_agent_mcp_tutorial11.png) !!! tip To make an Agent available in AI, enable `isSelectable` and `Publish to Runtime`. ## Expected Result The selected agent can use the tools provided by `Cookie Factory Tools` when they are available and relevant to the request. ## Next Steps Use [[user-guide-ai-librechat-integration|LibreChat Integration]] to understand runtime synchronization. For general user scenarios, return to [[tutorials-ai-index|AI Tutorials]].