Kayako MCP Server
A Model Context Protocol (MCP) server for interacting with the Kayako API. This server provides tools to fetch Kayako tickets including all posts and conversation history.
Features
- fetch_ticket - Fetch a Kayako ticket by ID with all posts and conversation history
- Configurable output format (JSON or Markdown via environment variable)
- Automatic pagination for posts
- Session-based authentication with CSRF token support
- Filters out "Placing on hold" automated posts for cleaner output
Prerequisites
- Python 3.10 or higher
- Kayako account with API access
- Valid Kayako credentials (email and password)
Installation
- Clone or navigate to this directory:
cd kayakoMCP
- Install dependencies:
pip install -r requirements.txt
- Create a
.envfile in the project root with your Kayako credentials:
KAYAKO_BASE_URL=https://your-domain.kayako.com
KAYAKO_EMAIL=your-email@example.com
KAYAKO_PASSWORD=your-password
OUTPUT_FORMAT=markdown
Configuration
Environment Variables
The server requires the following environment variables:
KAYAKO_BASE_URL- Your Kayako instance URL (e.g., https://example.kayako.com)KAYAKO_EMAIL- Your Kayako account emailKAYAKO_PASSWORD- Your Kayako account passwordOUTPUT_FORMAT- Output format for tickets:markdown(default) orjson
MCP Client Configuration
To use this server with an MCP client (like Claude Desktop), add the following to your MCP settings file:
For Claude Desktop (Windows)
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"kayako": {
"command": "python",
"args": [
"\\path\\to\\kayakoMCP\\kayako_mcp_server.py"
],
"env": {
"KAYAKO_BASE_URL": "https://your-domain.kayako.com",
"KAYAKO_EMAIL": "your-email@example.com",
"KAYAKO_PASSWORD": "your-password",
"OUTPUT_FORMAT": "markdown"
}
}
}
}
For Claude Desktop (macOS/Linux)
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or ~/.config/claude/claude_desktop_config.json (Linux):
{
"mcpServers": {
"kayako": {
"command": "python3",
"args": [
"/path/to/kayakoMCP/kayako_mcp_server.py"
],
"env": {
"KAYAKO_BASE_URL": "https://your-domain.kayako.com",
"KAYAKO_EMAIL": "your-email@example.com",
"KAYAKO_PASSWORD": "your-password",
"OUTPUT_FORMAT": "markdown"
}
}
}
}
Usage
Available Tools
fetch_ticket
Fetch a Kayako ticket by ID, including all posts and conversation history.
Parameters:
ticket_id(string, required) - The ID of the Kayako ticket to fetch
Output Format:
The output format is configured via the OUTPUT_FORMAT environment variable:
"markdown"- Returns markdown-formatted text (default)"json"- Returns structured JSON data
Example usage in Claude Desktop:
Can you fetch Kayako ticket 12345?
Response Format
JSON Format
Returns the complete ticket and posts data as structured JSON:
{
"ticket": {
"status": 200,
"data": {
"id": 12345,
"subject": "Issue with login",
"created_at": "2024-01-15T10:30:00Z",
"state": "OPEN",
"post_count": 5,
...
}
},
"posts": {
"status": 200,
"data": [
{
"id": 67890,
"subject": "Issue with login",
"contents": "I cannot log in to my account...",
"created_at": "2024-01-15T10:30:00Z",
"is_requester": true,
...
},
...
],
"total_count": 5
}
}
Markdown Format
Returns a human-readable markdown document:
# Ticket #12345: Issue with login
**State:** OPEN
**Created:** 2024-01-15T10:30:00Z
**Total Posts:** 5
---
## Original Ticket
**Subject:** Issue with login
**Date:** 2024-01-15T10:30:00Z
**Is Requester:** True
I cannot log in to my account...
---
## Conversation
### Post 1 - Agent (ID: 123)
**Date:** 2024-01-15T11:00:00Z
**Status:** ACTIVE
Thank you for contacting us...
---
Testing
You can test the server directly from the command line:
python kayako_mcp_server.py
Then send MCP protocol messages via stdin, or use an MCP inspector tool.
Authentication
The server uses Kayako's Basic Authentication to obtain a session token:
- Encodes credentials as Base64
- Makes a request to
/api/v1/me.json - Extracts
session_id,requester_id, andX-CSRF-Token - Caches authentication for subsequent requests
- Uses session-based authentication for all API calls
Error Handling
The server handles various error conditions:
- Missing environment variables
- Authentication failures (403, invalid credentials)
- Two-factor authentication requirements (not supported)
- Expired passwords
- Network errors
- Invalid or non-existent ticket IDs
- API errors
All errors are returned as descriptive error messages to help with troubleshooting.
Security Notes
- The server caches authentication tokens for the duration of the session
- Uses HTTPS for all API communications
Limitations
- Two-factor authentication is not currently supported
- Only supports session-based authentication (not API keys)
- Requires valid Kayako user account credentials
Troubleshooting
Authentication fails with 403
- Check that your credentials are correct
- Ensure two-factor authentication is disabled for the account
- Verify your password hasn't expired
Ticket not found
- Verify the ticket ID exists in your Kayako instance
- Ensure your account has permission to view the ticket
Connection errors
- Check that
KAYAKO_BASE_URLis correct and accessible - Verify your network connection
- Check if there are any firewall restrictions
Contributing
This server follows MCP best practices:
- Uses the official
mcpPython SDK - Implements proper tool schemas with descriptions
- Handles errors gracefully
- Returns structured data that's easy to consume
- Supports multiple output formats for flexibility
License
MIT License
Metadata
Release files for kayako-mcp-server 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kayako_mcp_server-0.1.0.tar.gz | 10.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kayako_mcp_server-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.3 kB
Release files / kayako_mcp_server-0.1.0.tar.gz
| Download URL | kayako_mcp_server-0.1.0.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6bccbbfbf5f745c0c6f80b951179a1d50e0540162581df920ccab26243c1709
|
|
BLAKE2b-256 checksum How to use checksums |
70f781447e720ac72fed3484ccf1bdade00687ad0fc43d20f862073571c62535
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.4
|
Release files / kayako_mcp_server-0.1.0-py3-none-any.whl
| Download URL | kayako_mcp_server-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d981b8f33515b111d66a8b174d7638dc6daf9173250f29ba61dfbd4d52db9235
|
|
BLAKE2b-256 checksum How to use checksums |
8d941f26c9e4ad9d618cbeef675d6545a231f6bdb470b44b75bd431b2cb32982
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.4
|