@great-detail/support-mcp 0.2.0 → 0.2.1

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 +2 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{McpServer as u}from"@modelcontextprotocol/sdk/server/mcp.js";import d,{SDK_VERSION as l,SupportError as f}from"@great-detail/support-sdk";import{z as n}from"zod";var h=new d.BasicAuthentication,a=new d(h),s=new u({name:"support",version:l,capabilities:{resources:{},tools:{}}});s.registerResource("messages","gds://messages",{title:"Support Messages",description:"A list of stored Support Messages",mimeType:"text/plain"},async e=>{let o=await a.message.list().json(),t=[];for(let{message:r}of o.data)r.type==="text"&&t.push({uri:`${e.href}/${r.id}`,text:`${r.messageText.body}`});return{contents:t}});s.registerResource("conversations","gds://conversations",{title:"Support Conversations",description:"A list of stored Support Conversations",mimeType:"text/plain"},async e=>({contents:(await a.conversation.list().json()).data.map(({conversation:t})=>({uri:`${e.href}/${t.id}`,text:`${t.name??"Un-named Conversation"}`}))}));s.registerResource("contacts","gds://contacts",{title:"Support Contacts",description:"A list of stored Support Contacts",mimeType:"text/plain"},async e=>({contents:(await a.contact.list().json()).data.map(({contact:t})=>({uri:`${e.href}/${t.id}`,text:`${t.name??"Un-named Contact"}${t.emailAddress?" - "+t.emailAddress:""}`}))}));s.registerTool("create-contact",{title:"Create a Support Contact",description:`Create a new support contact.
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
3
  Ask the user for a name if they don't provide one.
4
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:n.enum(["consumer","assistant","representative"]).optional().default("consumer").describe("the contact's type, consumer if not specified"),name:n.string().min(1).describe("the contact's name, required"),emailAddress:n.string().email().optional().describe("the contact's email address, optional"),telephoneNumber:n.string().optional().describe("the contact's phone number, optional")}},async({type:e,name:o,emailAddress:t,telephoneNumber:r})=>{let i;try{i=await a.contact.create({body:{type:e,name:o,emailAddress:t,telephoneNumber:r}}).json()}catch(c){if(!(c instanceof f))return{content:[{type:"text",text:"Contact could not be created"}]};let p=await c.response.json();return console.error(p),{content:[{type:"text",text:"Contact could not be created: "+p.error.title}]}}return{content:[{type:"text",text:"New contact created with id: "+i.data.contact.id}]}});var m=s;import{StdioServerTransport as g}from"@modelcontextprotocol/sdk/server/stdio.js";try{let e=new g;await m.connect(e),console.error("GD Support MCP Server running on stdio")}catch(e){console.error("Fatal error in main():",e),process.exit(1)}
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)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-detail/support-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "MCP Server for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",