mcp-prqx-pricer 1.0.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/build/index.js +127 -0
- package/build/types/production.js +18 -0
- package/openapi/pricer.json +7208 -0
- package/package.json +23 -0
- package/src/index.ts +149 -0
- package/src/types/production.ts +81 -0
- package/tsconfig.json +15 -0
package/build/index.js
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
"use strict";
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
5
|
+
};
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
7
|
+
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
8
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
9
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
10
|
+
const axios_1 = __importDefault(require("axios"));
|
11
|
+
class PrqxMcpServer {
|
12
|
+
server;
|
13
|
+
axiosInstance;
|
14
|
+
constructor() {
|
15
|
+
console.error('[Setup] Initializing MCP server...');
|
16
|
+
this.server = new index_js_1.Server({
|
17
|
+
name: 'PrqxMcpServer',
|
18
|
+
version: '1.0.0',
|
19
|
+
}, {
|
20
|
+
capabilities: {
|
21
|
+
tools: {}
|
22
|
+
}
|
23
|
+
});
|
24
|
+
this.axiosInstance = axios_1.default.create({
|
25
|
+
baseURL: 'https://pricer-svc.dev.pricerqx.com/',
|
26
|
+
headers: {
|
27
|
+
'Content-Type': 'application/json',
|
28
|
+
'Authorization': 'Bearer ' + process.env.TOKEN
|
29
|
+
},
|
30
|
+
});
|
31
|
+
this.setupToolHandlers();
|
32
|
+
this.server.onerror = (error) => {
|
33
|
+
console.error('[Error] MCP server error:', error);
|
34
|
+
};
|
35
|
+
process.on('SIGINT', async () => {
|
36
|
+
console.error('[Info] MCP server shutting down...');
|
37
|
+
await this.server.close();
|
38
|
+
process.exit(0);
|
39
|
+
});
|
40
|
+
}
|
41
|
+
setupToolHandlers() {
|
42
|
+
this.server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
|
43
|
+
tools: [
|
44
|
+
{
|
45
|
+
name: 'Get Productions',
|
46
|
+
description: 'Get productions by production name, venue, performer, city. Within a range of dates (StartDate, EndDate). Only retrieves a maximum of 10 items',
|
47
|
+
inputSchema: {
|
48
|
+
type: 'object',
|
49
|
+
properties: {
|
50
|
+
filter: {
|
51
|
+
type: 'string',
|
52
|
+
description: 'Filter to be applied to the production search (Name, Venue, Performer or City) separated by spaces'
|
53
|
+
},
|
54
|
+
startDate: {
|
55
|
+
type: 'string',
|
56
|
+
description: 'Start date of the production search (YYYY-MM-DD)'
|
57
|
+
},
|
58
|
+
endDate: {
|
59
|
+
type: 'string',
|
60
|
+
description: 'End date of the production search (YYYY-MM-DD)'
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
]
|
66
|
+
}));
|
67
|
+
this.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
68
|
+
try {
|
69
|
+
if (!['Get Productions'].includes(request.params.name)) {
|
70
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.MethodNotFound, `Tool name ${request.params.name} is not supported`);
|
71
|
+
}
|
72
|
+
const args = request.params.arguments;
|
73
|
+
args.pageSize = 10;
|
74
|
+
args.pageNumber = 1;
|
75
|
+
console.error('[API] Get Productions with arguments:', args);
|
76
|
+
const response = await this.axiosInstance.get('/v2/client/production', { params: args });
|
77
|
+
if (response.status !== 200) {
|
78
|
+
throw new Error(`API error: ${response.statusText}`);
|
79
|
+
}
|
80
|
+
if (response.data.totalFilteredRecords === 0) {
|
81
|
+
return { result: [] };
|
82
|
+
}
|
83
|
+
return {
|
84
|
+
toolResult: response.data.data?.map(p => ({
|
85
|
+
eventName: p.eventName,
|
86
|
+
productionId: p.productionId,
|
87
|
+
productionLocalTime: p.productionLocalTime,
|
88
|
+
productionDateTimeStatus: p.productionDateTimeStatus,
|
89
|
+
myListing: p.myListing,
|
90
|
+
marketList: p.marketList,
|
91
|
+
myAvgPrice: p.myAvgPrice,
|
92
|
+
marketAveragePrice: p.marketAveragePrice,
|
93
|
+
sold: p.sold,
|
94
|
+
myAverageSoldPrice: p.myAverageSoldPrice,
|
95
|
+
lastSoldPrice: p.lastSoldPrice,
|
96
|
+
ceiling: p.ceiling,
|
97
|
+
floor: p.floor,
|
98
|
+
noPrice: p.noPrice,
|
99
|
+
noComps: p.noComps,
|
100
|
+
pricer: p.pricer,
|
101
|
+
marketplace: p.marketplace,
|
102
|
+
productionDate: p.productionDate,
|
103
|
+
venueCity: p.venueCity,
|
104
|
+
venueState: p.venueState,
|
105
|
+
venueName: p.venueName,
|
106
|
+
venueId: p.venueId,
|
107
|
+
lastModifiedOn: p.lastModifiedOn,
|
108
|
+
ivcProductionKey: p.ivcProductionKey
|
109
|
+
}))
|
110
|
+
};
|
111
|
+
}
|
112
|
+
catch (error) {
|
113
|
+
if (error instanceof Error) {
|
114
|
+
console.error('Error in Get Productions:', error);
|
115
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to fetch data: ${error.message}`);
|
116
|
+
}
|
117
|
+
throw error;
|
118
|
+
}
|
119
|
+
});
|
120
|
+
}
|
121
|
+
async run() {
|
122
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
123
|
+
await this.server.connect(transport);
|
124
|
+
console.error('[Info] MCP server started !!');
|
125
|
+
}
|
126
|
+
}
|
127
|
+
new PrqxMcpServer().run();
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
// Auto-generated interfaces for /v2/client/production request and response
|
3
|
+
// Based on OpenAPI definition in pricer.json
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
+
exports.Source = void 0;
|
6
|
+
// Placeholder for Source type (expand as needed)
|
7
|
+
var Source;
|
8
|
+
(function (Source) {
|
9
|
+
Source[Source["VSSkybox"] = 0] = "VSSkybox";
|
10
|
+
Source[Source["TicketEvolution"] = 1] = "TicketEvolution";
|
11
|
+
Source[Source["TicketNetworkDirect"] = 2] = "TicketNetworkDirect";
|
12
|
+
Source[Source["ShowsOnSale"] = 3] = "ShowsOnSale";
|
13
|
+
Source[Source["SeetGeek"] = 4] = "SeetGeek";
|
14
|
+
Source[Source["TradeDesk"] = 5] = "TradeDesk";
|
15
|
+
Source[Source["TicketmasterResale"] = 6] = "TicketmasterResale";
|
16
|
+
Source[Source["Ticketmaster"] = 7] = "Ticketmaster";
|
17
|
+
Source[Source["Axs"] = 8] = "Axs";
|
18
|
+
})(Source || (exports.Source = Source = {}));
|