Search

Connectors

Contact support

Helpdesk portal

Build a custom MCP Server on Peliqan

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().

Contents

How to build a Custom MCP Server in Peliqan

  1. Install the “MCP Server” script from the app templates:
  2. image
  3. 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.
  4. image
  5. Update the credentials (API key) in your script and store in the Peliqan Secret Store.

Configure your MCP Client

ChatGPT

Claude

Microsoft Copilot

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.

Text-to-SQL search

See full example in the MCP Server template.

Example code (click to expand)

RAG search

More info:

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.

Example code (click to expand)

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.

Example custom MCP Server with intent detection (click to expand code)

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…)

Implement SSO (single sign on) using oAuth in your MCP Server:

Build a custom MCP Server on Peliqan with Google oAuthBuild a custom MCP Server on Peliqan with Microsoft Azure Entra 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 in AI chatbots & MCP Servers
Example MCP server with row-level 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.

Example on how to add permissions on MCP tool usage (click to expand)

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