4.1 KiB
This project is for creating a simple library and MCP server for handling Redmine, particularly for when Redmine is being used for customer service/support.
This is a private project for now, as it pertains to an installation of Redmine 3.4.4-stable used by LDR, which also uses some outdated plugins. Notably, the outdated pluggins in use are both from Redmine Up (contacts, helpdesk/crm).
This is about creating the basic tools that an agent would need in order to interact with and automate LDR's redmine communications. Some of the functionality will extend beyond Redmine.
Notable issues to be aware of
Projects which have the modules "contacts" or "contacts_helpdesk" enabled have the Helpdesk plugins enabled. That means a few things:
The regular API call to fetch an issue will not necessarily return the helpdesk information. Instead, it may claim that the issue's author or journals were created by "anonymous". When getting these issues, we need to use a different way to handle it.
The project in /home/iadnah/redmine/ is related to this problem.
Client shape
RedMCP\RedmineClient wraps the normal Redmine REST client and composes
Helpdesk context in application logic instead of modifying Redmine's core issue
API.
$client = RedMCP\RedmineClient::fromCredentials('http://192.168.50.170', $apiKey);
$context = $client->issueWithHelpdesk(39858);
The returned array has:
issue: the normal/issues/:id.jsonresponsehelpdesk.ticket: metadata from/helpdesk_search/issues/:id/ticket, ornullhelpdesk.journal_messages: metadata from/helpdesk_search/issues/:id/messages
Basic issue CRUD is exposed on the same wrapper:
$issues = $client->issues(['project_id' => 'customer-service', 'status_id' => 'open', 'limit' => 10]);
$filtered = $client->filterIssues(['query_id' => 12, 'limit' => 25]);
$issue = $client->issue(39858);
$created = $client->createIssue([
'project_id' => 78,
'subject' => 'Example issue from redMCP',
'description' => 'Created through the Redmine REST API wrapper.',
]);
$client->updateIssue((int) $created['id'], ['notes' => 'Follow-up note']);
$client->deleteIssue((int) $created['id']);
Native Redmine search is exposed separately from issue filtering. Use
filterIssues() or issues() when you already know the structured filters.
Use search() or searchIssues() when you want Redmine's built-in text search:
$results = $client->search('power supply', [
'all_words' => '1',
'limit' => 10,
]);
$issueResults = $client->searchIssues('power supply', [
'project_id' => 'customer-service',
'open_issues' => '1',
'limit' => 10,
]);
updateIssue() is intentionally safe by default: on Helpdesk-backed issues, a
normal Redmine note does not send an email to the customer. To send through
the Helpdesk plugin, opt in explicitly:
$client->updateIssue(39858, [
'notes' => 'Customer-visible response.',
], [
'send_helpdesk_email' => true,
]);
// Equivalent explicit form:
$client->sendHelpdeskIssueResponse(39858, 'Customer-visible response.');
Use the default non-email update for internal notes, status/category/assignee changes, and automation cleanup. Use the Helpdesk email path only when the caller deliberately wants the customer to receive mail.
MCP server
redMCP can also run as a stdio MCP server. It reads Redmine credentials from
environment variables or redMCP/.env:
redMCP/bin/redmcp-server.php
Example client configuration:
{
"mcpServers": {
"redmcp": {
"command": "/home/iadnah/redmine/redMCP/bin/redmcp-server.php"
}
}
}
The server exposes tools for native Redmine filtering/search, issue CRUD,
Helpdesk-aware issue reads, and explicit Helpdesk email responses. Tools that
can send customer-visible mail require an explicit tool call such as
redmine_send_helpdesk_response or redmine_update_issue with
send_helpdesk_email=true.
Test instance
A working test copy of Redmine is available on the LAN at 192.168.50.170.
The related Redmine plugin forks, helper scripts, and operational docs live in
the parent repository.