Build an in-product copilot without code
Copy page
Step-by-step tutorial to build an in-product copilot.
Overview
In this tutorial, you'll build an in-product copilot using the Inkeep Visual Builder. The copilot is embedded in your application and acts on behalf of the signed-in user by forwarding their credentials to an MCP server at runtime.
When a user asks "What are my open tickets?", the copilot will:
- Receive the user's authentication token and user ID from the host application via HTTP headers
- Forward those credentials to your MCP server on each tool call
- Return personalized results scoped to that user
Prerequisites
- An existing Inkeep Visual Builder instance running (follow the quick start guide to get started)
- Or access to Inkeep Enterprise
- A deployed MCP server that accepts per-user auth tokens (see Build Custom MCP Servers if you need to create one)
Set up the agent
Create the copilot agent
Go to the Agents tab in the left sidebar, then select Create Agent. Provide the following details:
- Name:
Support Copilot - Description:
An in-product copilot that helps users manage their tickets and account
Define the headers schema
The headers schema tells Inkeep which headers to expect and validate on every incoming request. These values come from your host application at runtime.
On the agent settings pane, scroll down to Headers schema and enter the following:
Click Save to apply the schema.
Header keys are normalized to lowercase before validation. Always define schema properties in lowercase (e.g., auth-token, not authToken).
Configure the sub agent
Click on the Default Sub Agent to configure it. Provide the following details:
- Name:
Support assistant - Description:
Help users with their tickets and account information - Prompt: Copy the prompt below
Prompt:
The {{headers.user-id}} template is resolved at runtime from the validated request headers. You can reference any key defined in the headers schema.
Register and connect the MCP server
Register the MCP server
Because each user has their own token, you don't store a single static credential. Instead, credentials are forwarded dynamically from the incoming request headers.
Go to the MCP Servers tab in the left sidebar, then select + New MCP Server. Fill in the server details:
- Name:
Product API - URL: The URL of your deployed MCP server (e.g.,
https://api.yourproduct.com/mcp) - Credential: Select No Authentication
Click Create to register the server.
Leaving the credential blank is intentional. Auth will be injected per-request via header forwarding in the next step.
Connect the MCP server with header forwarding
Navigate to the agent canvas: Agents → Support Copilot. Drag and drop an MCP block from the top left toolbar onto the canvas, then select the Product API MCP server and connect it to the Support assistant sub agent.
Click on the connection line between the MCP server and the sub agent. In the Headers field, enter:
Click Save Changes in the top right corner.
The {{headers.*}} templates are resolved at runtime from the validated incoming request headers. On every tool call to the MCP server, Inkeep replaces the template with the actual header value from the current request.
Embed the copilot in your application
Pass the signed-in user's credentials as custom headers from your chat component. The chat component sends these headers with every request to the agent API.
Replace YOUR_APP_ID with the App ID from your project's Apps settings. See App Credentials for setup details.
Test the copilot
Test in the Visual Builder playground
Click Try it in the top right corner to open the chat interface. Click the Custom headers button and enter test values:
Click Apply, then send a message like "What are my open tickets?"
The agent should call your MCP server tools with the Authorization and X-User-Id headers populated from the values you entered. Verify in your MCP server logs that the headers arrive as expected.
Test in your application
After embedding the chat component, sign in as a test user and interact with the copilot. Confirm that:
- The agent responds with data scoped to the signed-in user
- Your MCP server logs show the correct auth token and user ID on each tool call
- Switching users changes the data the copilot returns