Skip to main content
Peliqan has an out-of-the-box MCP Server. However, you can also build custom MCP Servers in Peliqan. You can use the Peliqan MCP Server template to get started. You can extend this template by adding your own “tools”, these are Python functions decorated with @mcp.tool().

How to build a Custom MCP Server in Peliqan

  1. Install the “MCP Server” script from the app templates:
MCP Server template tile in Peliqan
  1. Add an API endpoint (method POST) and link it to the “MCP Server” script (this is the API handler script). Click here for more info on how to publish an API endpoint in Peliqan.
API endpoint linked to MCP Server script
  1. Update the credentials (API key) in your script and store in the Peliqan Secret Store.

Configure your MCP Client

In ChatGPT, click on your account name (bottom left corner) and click on Settings.Go to Settings > Apps > Advanced Settings > Enable “Developer mode”.Go to Settings > Apps > Create App.Enter the URL of your MCP API endpoint, including the API key:ChatGPT app creation with MCP endpoint URLIf you make updates to your MCP Server (e.g. you add tools), make sure to click the “Refresh” button on the detail screen of your app and check if the new actions are available for your app.
You can use Claude.ai (in the browser) or Claude Desktop, but you need a Paid plan (e.g. Claude Pro) to add a Remote MCP Server.Go to Settings > Connectors > Add custom connector.Enter the URL of your MCP API endpoint, including the API key:Claude add custom connector with API key
In Copilot Studio, add an Agent and add a Tool of type “MCP Server” to the agent.Select None or API key for the MCP Server authentication type (depending on how you implemented authorization in your custom MCP Server).Publish your agent in Copilot Studio to make it available in Copilot chat. Next, you can access your Agent in Copilot chat and use it to access your MCP Server.Troubleshooting in Copilot StudioIf you don’t have permissions to publish you agent, follow the below steps to allow a user to publish an agent:Add a security group (to which the user belongs) in Power Automate Admin center, for the setting Manage > Tenant settings > “Copilot studio authors”.Power Automate Admin center tenant settingsPower Automate Admin center security group selectionIf you get an error “A custom connector with display name xxx already exists”, follow the below steps:Go to Power Automate > More > Discover all > Custom connectors. This will show a list of all “Tools” of type MCP Server that were added to your Copilot agents in the past. Delete old connectors here.

Implement capabilities

The Peliqan MCP Server template contains various examples on how to implement capabilities into your custom MCP Server such as Text-to-SQL data search for conversational analytics, RAG search on unstructured data, Writeback into business applications etc. See full example in the MCP Server template.
More info: Implement RAG

Writeback

Writeback is the concept of doing live API calls to a connected business application. This can be used to fetch live data or to take actions in a business application, e.g. add a deal in a CRM, create a draft invoice in accounting software etc.

Other

See the MCP Server template for an example on how to implement your own custom tools. Implement them as Python functions and decorate with @mcp.tool().

Implement intent detection

Intent detection (logging the original intent of the user) is useful to improve your MCP implementation. See example code below. Without intent detection you will only be able to log tool invokations, without knowing what the user (using the MCP) wanted to achieve.

Implement permissions

If you want to enforce permissions per user in your MCP Server, you have to authenticate individual users and apply authorization (permissions).

Authentication

You can authenticate users in your MCP Server using personal API keys or SSO using oAuth.

Personal API keys

  • Personal API keys

SSO using OAuth (Azure Entra, Google, Peliqan OAuth)

Implement SSO (single sign on) using OAuth in your MCP Server. More info: Build a custom MCP Server on Peliqan with OAuth

Authorization

You can apply permissions on various resources in your MCP Server code.

Permissions on data access

Use Peliqan groups, in order to limit access to datasets in your MCP Server. Put data resources (schemas and tables) in specific groups, map the authenticated user or group to a “Service account user” in Peliqan and use impersonation in your MCP Server. Example impersonation in your MCP Server code:
More info on the Peliqan permission model with groups: Permissions

Row-level data access

See also: Row-level data access

Permissions on MCP tool access

Limit access to certain MCP tools based on the authenticated user or a group of users. Below is an example using access levels to MCP tools.

Permissions on Writeback

In order to implement permissions on Writeback (live API calls from the MCP Server to connected business applications), use private connections in Peliqan:
  • Create a group in Peliqan per user
  • Invite every user to add their own private connections in Peliqan (e.g. to your CRM). Use the “Send invite” feature when adding a connection.
  • Add these private connections to the specific groups (one group per user)
  • Expose the private connections based on the authenticated user in your MCP Server