MCP server for interacting with Kayako API
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kayako_mcp_server-0.1.0.tar.gz.
File metadata
- Download URL: kayako_mcp_server-0.1.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6bccbbfbf5f745c0c6f80b951179a1d50e0540162581df920ccab26243c1709
|
|
| MD5 |
0d197ba7c8b23dd85511ee1d79c4dbb2
|
|
| BLAKE2b-256 |
70f781447e720ac72fed3484ccf1bdade00687ad0fc43d20f862073571c62535
|
File details
Details for the file kayako_mcp_server-0.1.0-py3-none-any.whl.
File metadata
- Download URL: kayako_mcp_server-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d981b8f33515b111d66a8b174d7638dc6daf9173250f29ba61dfbd4d52db9235
|
|
| MD5 |
62871282089d5244044c944ec63470d4
|
|
| BLAKE2b-256 |
8d941f26c9e4ad9d618cbeef675d6545a231f6bdb470b44b75bd431b2cb32982
|