@great-detail/support-mcp 0.3.0 → 0.4.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.
- package/README.md +14 -1
- package/dist/cli.js +5 -5
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -2,7 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://npmjs.com/package/@great-detail/support-mcp)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
```json
|
|
6
|
+
{
|
|
7
|
+
"mcpServers": {
|
|
8
|
+
"support": {
|
|
9
|
+
"command": "npx",
|
|
10
|
+
"args": ["@great-detail/support-mcp"],
|
|
11
|
+
"env": {
|
|
12
|
+
"SUPPORT_KEY_NAME": "...",
|
|
13
|
+
"SUPPORT_KEY_PASSWORD": "..."
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
6
19
|
|
|
7
20
|
## License
|
|
8
21
|
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{McpServer as
|
|
2
|
+
import{McpServer as A}from"@modelcontextprotocol/sdk/server/mcp.js";import $ from"@great-detail/support-sdk";import w from"zod";function i(s){return s}var f=i(function(r,{cache:a,client:n}){r.registerTool("list-messages",{title:"List Support Messages",description:"List the stored Support Messages"},async()=>{let e=await n.message.list().json(),t=[];for(let{message:p}of e.data)p.type==="text"&&t.push({type:"text",text:`${p.messageText.body}`});return{content:t}}),r.registerTool("get-message",{title:"Get a Support Message by ID",description:"Get a stored Support Message with its ID",inputSchema:{id:w.string().describe("the message's id")}},async({id:e})=>{let{data:{message:t}}=await a.wrap(`messages:${e}`,()=>n.message.get(e).json(),{ttl:3e4});return t.type==="email"?{content:[{type:"text",text:`${t.messageEmail.bodyText}`}]}:t.type==="text"?{content:[{type:"text",text:`${t.messageText.body}`}]}:(console.error("Cannot format message into MCP content for type:",t.type),{content:[]})})});import{outdent as h}from"outdent";import m from"zod";var y=i(function(r,{cache:a,client:n}){r.registerTool("list-conversations",{title:"List Support Conversations",description:"List the stored Support Conversations",inputSchema:{filter:m.enum(["unresolved","awaitingContact","awaitingAgent","escalated"]).optional().describe(h`filter the conversations by type, optional
|
|
3
3
|
- unresolved: conversations that haven't been closed or resolved, includes both awaitingContact and awaitingAgent
|
|
4
4
|
- awaitingContact: conversations that are waiting from a response from the contact
|
|
5
5
|
- awaitingAgent: conversations that are waiting from a response from an agent
|
|
6
|
-
- escalated: conversations that have been marked for escalation`),query:
|
|
7
|
-
Searches through titles, contacts, and messages that are linked to the conversation`)}},async({filter:e,query:
|
|
6
|
+
- escalated: conversations that have been marked for escalation`),query:m.string().optional().describe(h`search query for conversations, optional
|
|
7
|
+
Searches through titles, contacts, and messages that are linked to the conversation`)}},async({filter:e,query:t})=>({content:(await n.conversation.list({filter:{filter:e,query:t}}).json()).data.map(({conversation:o})=>({type:"text",text:`${o.name??"Un-named Conversation"} - Opened ${new Date(o.createdAt).toDateString()}${o.createdAt===o.updatedAt?"":`, Last Updated ${new Date(o.updatedAt).toDateString()}`} (${o.status})`}))})),r.registerTool("get-conversation",{title:"Get a Support Conversation by ID",description:"Get a stored Support Conversations with its ID",inputSchema:{id:m.string().describe("the conversation's id")}},async({id:e})=>{let{data:{conversation:t}}=await a.wrap(`conversations:${e}`,()=>n.conversation.get(e).json(),{ttl:3e4});return{content:[{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})`}]}})});import{SupportError as b}from"@great-detail/support-sdk";import{outdent as S}from"outdent";import c from"zod";var v=i(function(r,{cache:a,client:n}){r.registerTool("list-contacts",{title:"List Support Contacts",description:"List the stored Support Contacts",inputSchema:{type:c.enum(["consumer","representative","assistant"]).optional().describe(S`filter the contacts by type, optional
|
|
8
8
|
- consumer: contacts for end users and customers
|
|
9
9
|
- representative: contacts for human support agents
|
|
10
|
-
- assistant: contacts for AI automated support agents`),query:
|
|
10
|
+
- assistant: contacts for AI automated support agents`),query:c.string().optional().describe("search query for contacts, optional")}},async({type:e,query:t})=>({content:(await n.contact.list({filter:{type:e,query:t}}).json()).data.map(({contact:o})=>({type:"text",text:`${o.name??"Un-named Contact"}${o.emailAddress?" - "+o.emailAddress:""} (${o.type==="assistant"?"AI Agent":o.type==="representative"?"Human Agent":"Client/Customer"} Contact)`}))})),r.registerTool("create-contact",{title:"Create a Support Contact",description:S`Create a new support contact.
|
|
11
11
|
Ask the user for a name if they don't provide one.
|
|
12
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:
|
|
13
|
+
Assume that the user wants to create a consumer contact if they don't specify otherwise.`,inputSchema:{type:c.enum(["consumer","assistant","representative"]).optional().default("consumer").describe("the contact's type, consumer if not specified"),name:c.string().min(1).describe("the contact's name, required"),emailAddress:c.string().email().optional().describe("the contact's email address, optional"),telephoneNumber:c.string().optional().describe("the contact's phone number, optional")}},async({type:e,name:t,emailAddress:p,telephoneNumber:o})=>{let d;try{d=await n.contact.create({body:{type:e,name:t,emailAddress:p,telephoneNumber:o}}).json()}catch(l){if(!(l instanceof b))return{content:[{type:"text",text:"Contact could not be created"}]};let g=await l.response.json();return console.error(g),{content:[{type:"text",text:"Contact could not be created: "+g.error.title}]}}return{content:[{type:"text",text:"New contact created with id: "+d.data.contact.id}]}}),r.registerTool("get-contact",{title:"Get a Support Contact by ID",description:"Get a stored Support Contact with its ID",inputSchema:{id:c.string().describe("the contact's id")}},async({id:e})=>{let{data:{contact:t}}=await a.wrap(`contacts:${e}`,()=>n.contact.get(e).json(),{ttl:3e4});return{content:[{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)`}]}})});import G from"keyv";import{createCache as D}from"cache-manager";var x="0.4.0";var C=process.env.npm_package_version??x;function u(){let s=D({stores:[new G]}),r=new $,a=new A({name:"support",title:"Great Detail Support",version:C,capabilities:{resources:{},tools:{}}}),n={client:r,cache:s};return[f,y,v].map(t=>t(a,n)),a}import{StdioServerTransport as I}from"@modelcontextprotocol/sdk/server/stdio.js";try{let s=u(),r=new I;await s.connect(r),console.error("GD Support MCP Server running on stdio")}catch(s){console.error("Fatal error in main():",s),process.exit(1)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@great-detail/support-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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,8 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@great-detail/support-sdk": "",
|
|
26
26
|
"@modelcontextprotocol/sdk": "^1.16.0",
|
|
27
|
+
"cache-manager": "^7.0.1",
|
|
28
|
+
"keyv": "^5.4.0",
|
|
27
29
|
"outdent": "^0.8.0",
|
|
28
30
|
"zod": "^3.25.76"
|
|
29
31
|
},
|
|
@@ -41,7 +43,10 @@
|
|
|
41
43
|
"provenance": false
|
|
42
44
|
},
|
|
43
45
|
"scripts": {
|
|
46
|
+
"prebuild": "pnpm run gen",
|
|
44
47
|
"build": "tsup src/entrypoint/cli.ts --format esm --minify",
|
|
48
|
+
"gen": "pnpm run --parallel /^gen:.*/",
|
|
49
|
+
"gen:static": "tsx gen-static.ts",
|
|
45
50
|
"test": "node --import tsx --test --experimental-test-coverage src/__tests__/**/*.test.ts src/__tests__/*.test.ts",
|
|
46
51
|
"typecheck": "tsc --noEmit"
|
|
47
52
|
}
|