Connectors

Contact support

MCP (Model Context Protocol)

MCP (Model Context Protocol)

MCP is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications. Just as USB-C provides a standardized way to connect your devices to various peripherals and accessories, MCP provides a standardized way to connect AI models to different data sources and tools.

More info on MCP: https://modelcontextprotocol.io/introduction

This article describes how you can set up an MCP server that connects to your Peliqan account, to fetch e.g. data from your data warehouse. We will show how to use the MCP Server in Claude Desktop or in Visual Studio (VSCode).

Setting up your MCP server

Follow the below steps to set up an MCP server on your local computer.

Install uv:

curl -LsSf https://astral.sh/uv/install.sh | sh

Create a Python project:

# Create a new directory for the project
uv init peliqan-mcp
cd peliqan-mcp

# Create virtual environment and activate it
uv venv
source .venv/bin/activate

# Install dependencies
uv add "mcp[cli]" httpx

# Create our server file
touch peliqan.py

If you prefer not to use uv and no virtual environment, you can also simply use: pip install mcp pip install httpx

Example code for the MCP server in peliqan.py:

from typing import Any
import httpx
from mcp.server.fastmcp import FastMCP

mcp = FastMCP("peliqan")

API_BASE = "https://app.eu.peliqan.io"
API_TOKEN = "<your Peliqan API token>"

async def make_peliqan_request(url: str) -> dict[str, Any] | None:
    """Make a request to the Peliqan API"""
    headers = {
        "User-Agent": "peliqan-mcp",
        "Accept": "application/json",
        "Authorization": f"JWT {API_TOKEN}"
    }
    async with httpx.AsyncClient() as client:
        try:
            response = await client.get(url, headers=headers, timeout=30.0)
            response.raise_for_status()
            return response.json()
        except Exception:
            return None

@mcp.tool()
async def get_connections() -> str:
    """Get Connections.
    """
    url = f"{API_BASE}/api/servers/"
    data = await make_peliqan_request(url)

    if not data:
        return "Unable to fetch connections."
    
    response = []
    for item in data:
        response.append(item["name"])

    return "\n".join(response)

@mcp.tool()
async def read_data(tablename: str) -> str:
    """Read data from a table, via a custom API endpoint, defined in Peliqan.
    """
    url = f"https://api.eu.peliqan.io/<your_account_id>/myapi?tablename={tablename}"
    data = await make_peliqan_request(url)

    if not data:
        return "Unable to fetch data."
    
    return str(data)

if __name__ == "__main__":
    mcp.run(transport='stdio')

Custom API endpoint in Peliqan

The above function read_data calls a custom endpoint, defined in your Peliqan account.

Example code for the custom API endpoint:

from urllib.parse import parse_qs

def handler(request):
    query_string = request['query_string']
    query_string_dict = parse_qs(query_string)
    if "tablename" in query_string_dict:
        tablename = query_string_dict['tablename'][0]
      
    dbconn = pq.dbconnect(pq.DW_NAME)
    query = f"SELECT id, name FROM odoo.{tablename} LIMIT 5"
    rows = dbconn.fetch(pq.DW_NAME, query = query)
    return {'rows': rows}

Usage of the custom API endpoint:

GET https://api.eu.peliqan.io/<your_peliqan_account_id>/myapi?tablename=partners
Authorization: JWT <your Peliqan API token>

Use the MCP Server in Claude Desktop

Claude Desktop config

Add your MCP server to claude_desktop_config.json:

{
    "mcpServers": {
        "peliqan": {
            "command": "uv",
            "args": [
                "--directory",
                "FULL_PATH_TO_YOUR_MCP_PROJECT/peliqan-mcp",
                "run",
                "peliqan.py"
            ]
        }
    }
}

Replace “uv” above with the full path to uv. Use which uv to find the full path.

Location on Windows: $env:AppData\Claude\claude_desktop_config.json

Location on Mac: ~/Library/Application\ Support/Claude/claude_desktop_config.json

Test in Claude Desktop

Restart Claude Desktop. Next click on the hammer icon in the right bottom corner to see the installed MCP servers, double check if Peliqan is listed with the tools that you implemented in your MCP Server (e.g. get_connections and read_data).

image
image

Use the MCP Server in VS Code (Copilot)

While Microsoft will soon release native support for MCP Servers, for now (March 2025) we use following extension in VS Code:

https://marketplace.visualstudio.com/items?itemName=AutomataLabs.copilot-mcp

Install the Extension, open the new menu item in the left navigation menu “MCP Servers”, add a new server called “Peliqan” and use e.g. the following command:

/usr/local/bin/python FULL_PATH_TO_YOUR_MCP_SERVER/peliqan.py

Note that we are not using uv and the virtual environment here.

Replace the path to Python with your path, use which python.

You might have to install npm first: https://nodejs.org/en/download

Add the Peliqan MCP Server:

image

After adding the MCP Server, the tools that you defined in the MCP Server should be visible:

image

Open Copilot Chat (top menu View > Chat) and use @mcp to invoke a tool from your MCP Server. Example: @mcp read_data table partners

image