@telos.ready/mcp 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/index.js +83 -1
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -3,6 +3,8 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
4
  import { z } from "zod";
5
5
  import axios from "axios";
6
+ import * as fs from "fs";
7
+ import * as path from "path";
6
8
  // Configuration
7
9
  const DEFAULT_TELOS_BASE_URL = "https://go.telosready.com";
8
10
  // Create server instance
@@ -625,6 +627,86 @@ server.tool("raise-ticket", "Creates a new ticket and returns information that m
625
627
  };
626
628
  }
627
629
  });
630
+ // Helper function to get MIME type from file extension
631
+ function getMimeType(filename) {
632
+ const ext = path.extname(filename).toLowerCase();
633
+ const mimeTypes = {
634
+ ".png": "image/png",
635
+ ".jpg": "image/jpeg",
636
+ ".jpeg": "image/jpeg",
637
+ ".gif": "image/gif",
638
+ ".webp": "image/webp",
639
+ ".bmp": "image/bmp",
640
+ ".svg": "image/svg+xml",
641
+ ".pdf": "application/pdf",
642
+ ".txt": "text/plain",
643
+ ".html": "text/html",
644
+ ".css": "text/css",
645
+ ".js": "application/javascript",
646
+ ".json": "application/json",
647
+ ".xml": "application/xml",
648
+ ".zip": "application/zip",
649
+ };
650
+ return mimeTypes[ext] || "application/octet-stream";
651
+ }
652
+ // Tool 15: Attach Screenshot to Ticket
653
+ server.tool("attach-screenshot", "Attaches a screenshot or image file from the local filesystem to a ticket. The tool reads the file from the provided path, encodes it, and uploads it as an attachment to the specified ticket. Supports common image formats (PNG, JPG, GIF, WebP).", {
654
+ ticketReference: z
655
+ .string()
656
+ .describe('The ticket reference for the ticket to attach the screenshot to, which is an uppercase alphabetical code followed by a number, such as "TEL037".'),
657
+ filename: z
658
+ .string()
659
+ .describe("The path to the screenshot file on the local filesystem. This should be an absolute path or a path relative to the current working directory."),
660
+ }, async ({ ticketReference, filename }) => {
661
+ try {
662
+ // Validate that the file exists
663
+ if (!fs.existsSync(filename)) {
664
+ return {
665
+ content: [
666
+ {
667
+ type: "text",
668
+ text: `Error: File not found at path: ${filename}`,
669
+ },
670
+ ],
671
+ };
672
+ }
673
+ // Read the file from the local filesystem
674
+ const fileBuffer = fs.readFileSync(filename);
675
+ // Encode file content as base64
676
+ const base64Content = fileBuffer.toString("base64");
677
+ // Get the filename without path for display
678
+ const displayFilename = path.basename(filename);
679
+ // Detect content type from file extension
680
+ const contentType = getMimeType(filename);
681
+ // Send to MCPController
682
+ const result = await telosClient.post("/mcp/attach-screenshot", {
683
+ ticketReference,
684
+ base64Content,
685
+ filename: displayFilename,
686
+ contentType,
687
+ });
688
+ if (result.success) {
689
+ return {
690
+ content: [{ type: "text", text: result.result }],
691
+ };
692
+ }
693
+ else {
694
+ return {
695
+ content: [{ type: "text", text: `Error: ${result.error}` }],
696
+ };
697
+ }
698
+ }
699
+ catch (error) {
700
+ return {
701
+ content: [
702
+ {
703
+ type: "text",
704
+ text: `Error attaching screenshot to ticket ${ticketReference}: ${error.message}`,
705
+ },
706
+ ],
707
+ };
708
+ }
709
+ });
628
710
  async function main() {
629
711
  try {
630
712
  // Initialize transport first
@@ -637,7 +719,7 @@ async function main() {
637
719
  await server.connect(transport);
638
720
  // Log success message
639
721
  console.error("✅ Telos MCP Server running on stdio");
640
- console.error("Available tools: ask-question, search-documentation, add-ticket-comment, add-documentation, get-ticket-details, start-ticket, get-next-task, get-git-branch-for-ticket, mark-ticket-as-blocked, update-action-item, get-resource-list, get-resource-details, answer-question, raise-ticket");
722
+ console.error("Available tools: ask-question, search-documentation, add-ticket-comment, add-documentation, get-ticket-details, start-ticket, get-next-task, get-git-branch-for-ticket, mark-ticket-as-blocked, update-action-item, get-resource-list, get-resource-details, answer-question, raise-ticket, attach-screenshot");
641
723
  // Test connection in background without blocking or exiting
642
724
  // This is non-critical and should not cause the server to exit
643
725
  setImmediate(async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telos.ready/mcp",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Telos MCP server for managing tickets and project tasks",
5
5
  "main": "build/index.js",
6
6
  "type": "module",