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/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "mcp-prqx-pricer",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "mcp-prqx-pricer": "build/index.js"
8
+ },
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ },
12
+ "keywords": [],
13
+ "author": "",
14
+ "license": "ISC",
15
+ "dependencies": {
16
+ "@modelcontextprotocol/sdk": "^1.9.0",
17
+ "axios": "^1.8.4"
18
+ },
19
+ "devDependencies": {
20
+ "@types/node": "^22.14.1",
21
+ "typescript": "^5.8.3"
22
+ }
23
+ }
package/src/index.ts ADDED
@@ -0,0 +1,149 @@
1
+ #!/usr/bin/env node
2
+ import {Server} from "@modelcontextprotocol/sdk/server/index.js";
3
+ import {StdioServerTransport} from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import {
5
+ CallToolRequestSchema,
6
+ ErrorCode,
7
+ ListToolsRequestSchema,
8
+ McpError,
9
+ } from '@modelcontextprotocol/sdk/types.js';
10
+ import axios from 'axios';
11
+ import { PagedProductionResponseDto } from "./types/production";
12
+
13
+ class PrqxMcpServer{
14
+ private server: Server;
15
+ private axiosInstance;
16
+
17
+ constructor() {
18
+ console.error('[Setup] Initializing MCP server...');
19
+ this.server = new Server({
20
+ name: 'PrqxMcpServer',
21
+ version: '1.0.0',
22
+ },
23
+ {
24
+ capabilities: {
25
+ tools:{}
26
+ }
27
+ });
28
+
29
+ this.axiosInstance = axios.create({
30
+ baseURL: 'https://pricer-svc.dev.pricerqx.com/',
31
+ headers: {
32
+ 'Content-Type': 'application/json',
33
+ 'Authorization': 'Bearer ' + process.env.TOKEN
34
+ },
35
+ });
36
+
37
+ this.setupToolHandlers();
38
+
39
+ this.server.onerror = (error) => {
40
+ console.error('[Error] MCP server error:', error);
41
+ };
42
+
43
+ process.on('SIGINT', async () => {
44
+ console.error('[Info] MCP server shutting down...');
45
+ await this.server.close();
46
+ process.exit(0);
47
+ });
48
+ }
49
+
50
+ private setupToolHandlers() {
51
+ this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
52
+ tools: [
53
+ {
54
+ name: 'Get Productions',
55
+ description: 'Get productions by production name, venue, performer, city. Within a range of dates (StartDate, EndDate). Only retrieves a maximum of 10 items',
56
+ inputSchema: {
57
+ type: 'object',
58
+ properties: {
59
+ filter: {
60
+ type: 'string',
61
+ description: 'Filter to be applied to the production search (Name, Venue, Performer or City) separated by spaces'
62
+ },
63
+ startDate: {
64
+ type: 'string',
65
+ description: 'Start date of the production search (YYYY-MM-DD)'
66
+ },
67
+ endDate: {
68
+ type: 'string',
69
+ description: 'End date of the production search (YYYY-MM-DD)'
70
+ }
71
+ }
72
+ }
73
+ }
74
+ ]
75
+ }));
76
+
77
+ this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
78
+ try{
79
+ if(!['Get Productions'].includes(request.params.name)){
80
+ throw new McpError(ErrorCode.MethodNotFound, `Tool name ${request.params.name} is not supported`);
81
+ }
82
+ const args = request.params.arguments as {
83
+ filter?: string;
84
+ startDate?: string;
85
+ endDate?: string;
86
+ pageSize?: number;
87
+ pageNumber?: number;
88
+ };
89
+
90
+ args.pageSize = 10;
91
+ args.pageNumber = 1;
92
+
93
+ console.error('[API] Get Productions with arguments:', args);
94
+ const response = await this.axiosInstance.get<PagedProductionResponseDto>('/v2/client/production', {params: args});
95
+
96
+ if (response.status !== 200) {
97
+ throw new Error(`API error: ${response.statusText}`);
98
+ }
99
+
100
+ if(response.data.totalFilteredRecords === 0) {
101
+ return {result: []};
102
+ }
103
+
104
+ return {
105
+ toolResult: response.data.data?.map(p => ({
106
+ eventName: p.eventName,
107
+ productionId: p.productionId,
108
+ productionLocalTime: p.productionLocalTime,
109
+ productionDateTimeStatus: p.productionDateTimeStatus,
110
+ myListing: p.myListing,
111
+ marketList: p.marketList,
112
+ myAvgPrice: p.myAvgPrice,
113
+ marketAveragePrice: p.marketAveragePrice,
114
+ sold: p.sold,
115
+ myAverageSoldPrice: p.myAverageSoldPrice,
116
+ lastSoldPrice: p.lastSoldPrice,
117
+ ceiling: p.ceiling,
118
+ floor: p.floor,
119
+ noPrice: p.noPrice,
120
+ noComps: p.noComps,
121
+ pricer: p.pricer,
122
+ marketplace: p.marketplace,
123
+ productionDate: p.productionDate,
124
+ venueCity: p.venueCity,
125
+ venueState: p.venueState,
126
+ venueName: p.venueName,
127
+ venueId: p.venueId,
128
+ lastModifiedOn: p.lastModifiedOn,
129
+ ivcProductionKey: p.ivcProductionKey
130
+ }))
131
+ };
132
+ } catch (error) {
133
+ if(error instanceof Error) {
134
+ console.error('Error in Get Productions:', error);
135
+ throw new McpError(ErrorCode.InternalError, `Failed to fetch data: ${error.message}`);
136
+ }
137
+ throw error;
138
+ }
139
+ });
140
+ }
141
+
142
+ async run() {
143
+ const transport = new StdioServerTransport();
144
+ await this.server.connect(transport);
145
+ console.error('[Info] MCP server started !!');
146
+ }
147
+ }
148
+
149
+ new PrqxMcpServer().run();
@@ -0,0 +1,81 @@
1
+ // Auto-generated interfaces for /v2/client/production request and response
2
+ // Based on OpenAPI definition in pricer.json
3
+
4
+ // Query parameters for GET /v2/client/production
5
+ export interface GetProductionsQuery {
6
+ ProductionId?: number;
7
+ Pricer?: string[];
8
+ NoPricer?: boolean;
9
+ ShowParking?: boolean;
10
+ ShowSpeculation?: boolean;
11
+ ProductionStatus?: string[]; // enum: ProductionStatus
12
+ DayOfWeek?: string[]; // enum: IsoDayOfWeek
13
+ InventoryTags?: string[];
14
+ Filter?: string;
15
+ StartDate?: string; // YYYY-MM-DD
16
+ EndDate?: string; // YYYY-MM-DD
17
+ IsFloorHit?: boolean;
18
+ IsCeilingHit?: boolean;
19
+ NoComparables?: boolean;
20
+ NoPricingGroup?: boolean;
21
+ ShowAvailableTicketGroups?: boolean;
22
+ MappingStatus?: string[];
23
+ PageNumber?: number;
24
+ PageSize?: number;
25
+ IsWithin90Days?: boolean;
26
+ SortColumn?: string; // enum: ProductionRequestSortColumn
27
+ SortOrder?: string; // enum: SortDirection
28
+ MasterVenueId?: number;
29
+ HasPricingGroup?: boolean;
30
+ HasAutoPricingGroup?: boolean;
31
+ }
32
+
33
+ // Response DTOs
34
+ export interface PagedProductionResponseDto {
35
+ pageSize?: number;
36
+ totalRecords: number;
37
+ totalPages: number;
38
+ totalFilteredRecords: number;
39
+ pageNumber: number;
40
+ data?: ProductionResponseDto[];
41
+ }
42
+
43
+ export interface ProductionResponseDto {
44
+ eventName?: string;
45
+ productionId: number;
46
+ productionLocalTime?: string;
47
+ productionDateTimeStatus?: string;
48
+ myListing: number;
49
+ marketList: number;
50
+ myAvgPrice: number;
51
+ marketAveragePrice: number;
52
+ sold: number;
53
+ myAverageSoldPrice: number;
54
+ lastSoldPrice: number;
55
+ ceiling: number;
56
+ floor: number;
57
+ noPrice: number;
58
+ noComps: number;
59
+ pricer?: string;
60
+ marketplace: Source;
61
+ productionDate?: string;
62
+ venueCity?: string;
63
+ venueState?: string;
64
+ venueName?: string;
65
+ venueId?: number;
66
+ lastModifiedOn?: string;
67
+ ivcProductionKey?: string;
68
+ }
69
+
70
+ // Placeholder for Source type (expand as needed)
71
+ export enum Source {
72
+ VSSkybox,
73
+ TicketEvolution,
74
+ TicketNetworkDirect,
75
+ ShowsOnSale,
76
+ SeetGeek,
77
+ TradeDesk,
78
+ TicketmasterResale,
79
+ Ticketmaster,
80
+ Axs
81
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "Node16",
5
+ "moduleResolution": "Node16",
6
+ "outDir": "./build",
7
+ "rootDir": "./src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true
12
+ },
13
+ "include": ["src/**/*"],
14
+ "exclude": ["node_modules"]
15
+ }