@great-detail/support-mcp 0.2.1 → 0.3.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/dist/cli.js +12 -4
  2. package/package.json +2 -1
package/dist/cli.js CHANGED
@@ -1,5 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import{McpServer as m}from"@modelcontextprotocol/sdk/server/mcp.js";import p,{SDK_VERSION as l,SupportError as h}from"@great-detail/support-sdk";import{z as s}from"zod";var y=new p.BasicAuthentication,r=new p(y),o=new m({name:"support",version:l,capabilities:{resources:{},tools:{}}});o.registerTool("list-messages",{title:"List Support Messages",description:"List the stored Support Messages"},async()=>{let e=await r.message.list().json(),t=[];for(let{message:n}of e.data)n.type==="text"&&t.push({type:"text",text:`${n.messageText.body}`});return{content:t}});o.registerTool("list-conversations",{title:"List Support Conversations",description:"List the stored Support Conversations"},async()=>({content:(await r.conversation.list().json()).data.map(({conversation:t})=>({type:"text",text:`${t.name??"Un-named Conversation"}`}))}));o.registerTool("list-contacts",{title:"List Support Contacts",description:"List the stored Support Contacts"},async()=>({content:(await r.contact.list().json()).data.map(({contact:t})=>({type:"text",text:`${t.name??"Un-named Contact"}${t.emailAddress?" - "+t.emailAddress:""}`}))}));o.registerTool("create-contact",{title:"Create a Support Contact",description:`Create a new support contact.
3
- Ask the user for a name if they don't provide one.
4
- Suggest that the user adds contact details if they provide none.
5
- Assume that the user wants to create a consumer contact if they don't specify otherwise.`,inputSchema:{type:s.enum(["consumer","assistant","representative"]).optional().default("consumer").describe("the contact's type, consumer if not specified"),name:s.string().min(1).describe("the contact's name, required"),emailAddress:s.string().email().optional().describe("the contact's email address, optional"),telephoneNumber:s.string().optional().describe("the contact's phone number, optional")}},async({type:e,name:t,emailAddress:n,telephoneNumber:u})=>{let a;try{a=await r.contact.create({body:{type:e,name:t,emailAddress:n,telephoneNumber:u}}).json()}catch(i){if(!(i instanceof h))return{content:[{type:"text",text:"Contact could not be created"}]};let c=await i.response.json();return console.error(c),{content:[{type:"text",text:"Contact could not be created: "+c.error.title}]}}return{content:[{type:"text",text:"New contact created with id: "+a.data.contact.id}]}});var d=o;import{StdioServerTransport as f}from"@modelcontextprotocol/sdk/server/stdio.js";try{let e=new f;await d.connect(e),console.error("GD Support MCP Server running on stdio")}catch(e){console.error("Fatal error in main():",e),process.exit(1)}
2
+ import{McpServer as m}from"@modelcontextprotocol/sdk/server/mcp.js";import u,{SDK_VERSION as h,SupportError as g}from"@great-detail/support-sdk";import{z as o}from"zod";import{outdent as r}from"outdent";var f=new u.BasicAuthentication,i=new u(f),a=new m({name:"support",version:h,capabilities:{resources:{},tools:{}}});a.registerTool("list-messages",{title:"List Support Messages",description:"List the stored Support Messages"},async()=>{let e=await i.message.list().json(),n=[];for(let{message:s}of e.data)s.type==="text"&&n.push({type:"text",text:`${s.messageText.body}`});return{content:n}});a.registerTool("list-conversations",{title:"List Support Conversations",description:"List the stored Support Conversations",inputSchema:{filter:o.enum(["unresolved","awaitingContact","awaitingAgent","escalated"]).optional().describe(r`filter the conversations by type, optional
3
+ - unresolved: conversations that haven't been closed or resolved, includes both awaitingContact and awaitingAgent
4
+ - awaitingContact: conversations that are waiting from a response from the contact
5
+ - awaitingAgent: conversations that are waiting from a response from an agent
6
+ - escalated: conversations that have been marked for escalation`),query:o.string().optional().describe(r`search query for conversations, optional
7
+ Searches through titles, contacts, and messages that are linked to the conversation`)}},async({filter:e,query:n})=>({content:(await i.conversation.list({filter:{filter:e,query:n}}).json()).data.map(({conversation:t})=>({type:"text",text:`${t.name??"Un-named Conversation"} - Opened ${new Date(t.createdAt).toDateString()}${t.createdAt===t.updatedAt?"":`, Last Updated ${new Date(t.updatedAt).toDateString()}`} (${t.status})`}))}));a.registerTool("list-contacts",{title:"List Support Contacts",description:"List the stored Support Contacts",inputSchema:{type:o.enum(["consumer","representative","assistant"]).optional().describe(r`filter the contacts by type, optional
8
+ - consumer: contacts for end users and customers
9
+ - representative: contacts for human support agents
10
+ - assistant: contacts for AI automated support agents`),query:o.string().optional().describe("search query for contacts, optional")}},async({type:e,query:n})=>({content:(await i.contact.list({filter:{type:e,query:n}}).json()).data.map(({contact:t})=>({type:"text",text:`${t.name??"Un-named Contact"}${t.emailAddress?" - "+t.emailAddress:""} (${t.type==="assistant"?"AI Agent":t.type==="representative"?"Human Agent":"Client/Customer"} Contact)`}))}));a.registerTool("create-contact",{title:"Create a Support Contact",description:r`Create a new support contact.
11
+ Ask the user for a name if they don't provide one.
12
+ Suggest that the user adds contact details if they provide none.
13
+ Assume that the user wants to create a consumer contact if they don't specify otherwise.`,inputSchema:{type:o.enum(["consumer","assistant","representative"]).optional().default("consumer").describe("the contact's type, consumer if not specified"),name:o.string().min(1).describe("the contact's name, required"),emailAddress:o.string().email().optional().describe("the contact's email address, optional"),telephoneNumber:o.string().optional().describe("the contact's phone number, optional")}},async({type:e,name:n,emailAddress:s,telephoneNumber:t})=>{let c;try{c=await i.contact.create({body:{type:e,name:n,emailAddress:s,telephoneNumber:t}}).json()}catch(p){if(!(p instanceof g))return{content:[{type:"text",text:"Contact could not be created"}]};let d=await p.response.json();return console.error(d),{content:[{type:"text",text:"Contact could not be created: "+d.error.title}]}}return{content:[{type:"text",text:"New contact created with id: "+c.data.contact.id}]}});var l=a;import{StdioServerTransport as y}from"@modelcontextprotocol/sdk/server/stdio.js";try{let e=new y;await l.connect(e),console.error("GD Support MCP Server running on stdio")}catch(e){console.error("Fatal error in main():",e),process.exit(1)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-detail/support-mcp",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "MCP Server for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",
@@ -24,6 +24,7 @@
24
24
  "dependencies": {
25
25
  "@great-detail/support-sdk": "",
26
26
  "@modelcontextprotocol/sdk": "^1.16.0",
27
+ "outdent": "^0.8.0",
27
28
  "zod": "^3.25.76"
28
29
  },
29
30
  "devDependencies": {