@great-detail/support-mcp 0.1.2 → 0.1.3
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.
- package/dist/cli.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{McpServer as
|
|
2
|
+
import{McpServer as d}from"@modelcontextprotocol/sdk/server/mcp.js";import s,{SDK_VERSION as m,SupportError as u}from"@great-detail/support-sdk";import{z as a}from"zod";var l=new s.BasicAuthentication,i=new s(l),o=new d({name:"support",version:m,capabilities:{resources:{},tools:{}}});o.tool("get_contacts","Get a list of contacts",{},async()=>{let t=await i.contact.list().json();return t.data.length<=0?{content:[{type:"text",text:"No contacts could be found"}]}:{content:t.data.map(({contact:e})=>({type:"text",text:`${e.name??"Un-named Contact"}${e.emailAddress?" - "+e.emailAddress:""}`}))}});o.tool("create_contact","Create a new contact",{type:a.enum(["consumer","assistant","representative"]).optional().default("consumer").describe("the contact's type, consumer if not specified"),name:a.string().min(1).describe("the contact's name, required")},async({type:t,name:e})=>{let n;try{n=await i.contact.create({body:{type:t,name:e}}).json()}catch(r){if(!(r instanceof u))return{content:[{type:"text",text:"Contact could not be created"}]};let c=await r.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: "+n.data.contact.id}]}});var p=o;import{StdioServerTransport as f}from"@modelcontextprotocol/sdk/server/stdio.js";try{let t=new f;await p.connect(t),console.error("GD Support MCP Server running on stdio")}catch(t){console.error("Fatal error in main():",t),process.exit(1)}
|