Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A Model Context Protocol (MCP) server for Genesys Cloud's Platform API.
| [Search Voice Conversation](/docs/tools.md#search-voice-conversations) | Searches voice conversations by optional criteria |
| [Conversation Transcript](/docs/tools.md#conversation-transcript) | Retrieves conversation transcript |
| [OAuth Clients](/docs/tools.md#oauth-clients) | Retrieves a list of all the OAuth clients |
| [OAuth Client Usage](/docs/tools.md#oauth-client-usage) | Retrieves usage of an OAuth client |
| [OAuth Client Usage](/docs/tools.md#oauth-client-usage) | Retrieves OAuth client usage for given period |

## Usage with Claude Desktop

Expand Down
2 changes: 1 addition & 1 deletion docs/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ Platform API endpoints used:

**Tool name:** `oauth_client_usage`

Retrieves the usage of an OAuth Client for a given period. It returns the total number of requests and a breakdown of requests per organization.
Retrieves the usage of an OAuth Client for a given period. It returns the total number of requests and a breakdown of Platform API endpoints used by the client.

[Source file](/src/tools/oauthClientUsage/oauthClientUsage.ts).

Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": "0.2",
"name": "Genesys Cloud MCP Server",
"version": "1.0.2",
"version": "1.0.3",
"description": "Interact with Genesys Cloud's Platform API",
"long_description": "This extension allows Claude to connect to Genesys Cloud's Platform API via a local MCP server. It provides tools for querying queue volumes, retrieving conversation samples, analyzing sentiment and voice quality, accessing transcripts, and more.\n\nThis project is not affiliated with Genesys.",
"author": {
Expand Down Expand Up @@ -62,7 +62,7 @@
},
{
"name": "oauth_client_usage",
"description": "Retrieves the usage of an OAuth Client for a given period. It returns the total number of requests and a breakdown of requests per organization."
"description": "Retrieves the usage of an OAuth Client for a given period. It returns the total number of requests and a breakdown of Platform API endpoints used by the client."
}
],
"user_config": {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@makingchatbots/genesys-cloud-mcp-server",
"version": "1.0.2",
"version": "1.0.3",
"description": "A Model Context Protocol (MCP) server exposing Genesys Cloud tools for LLMs, including sentiment analysis, conversation search, topic detection and more.",
"bin": "./dist/cli.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const withAuth = OAuthClientCredentialsWrapper(

const server: McpServer = new McpServer({
name: "Genesys Cloud",
version: "1.0.2", // Same version as version in package.json
version: "1.0.3", // Same version as version in package.json
});

const cache = new LRUCache<string, OAuthClientUsageResponse>({
Expand Down
19 changes: 10 additions & 9 deletions src/tools/oauthClientUsage/oauthClientUsage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe("OAuth Client Usage", () => {
postOauthClientUsageQuery: vi.fn(),
getOauthClientUsageQueryResult: vi.fn(),
},
cache: undefined,
};
const toolDefinition = oauthClientUsage(toolDeps);
toolName = toolDefinition.schema.name;
Expand Down Expand Up @@ -48,7 +49,7 @@ describe("OAuth Client Usage", () => {
_meta: undefined,
annotations: { title: "OAuth Client Usage" },
description:
"Retrieves the usage of an OAuth Client for a given period. It returns the total number of requests and a breakdown of requests per organization.",
"Retrieves the usage of an OAuth Client for a given period. It returns the total number of requests and a breakdown of Platform API endpoints used by the client.",
inputSchema: {
properties: {
oauthClientId: {
Expand Down Expand Up @@ -141,8 +142,6 @@ describe("OAuth Client Usage", () => {
test("OAuth Client usage returned for date range", async () => {
const oauthClientId = randomUUID();
const executionId = randomUUID();
const organisationOneId = randomUUID();
const organisationTwoId = randomUUID();

toolDeps.oauthApi.postOauthClientUsageQuery.mockResolvedValue({
executionId,
Expand All @@ -152,11 +151,13 @@ describe("OAuth Client Usage", () => {
toolDeps.oauthApi.getOauthClientUsageQueryResult.mockResolvedValue({
results: [
{
organizationId: organisationOneId,
templateUri: "api/v2/authorization/divisions",
httpMethod: "GET",
requests: 5,
},
{
organizationId: organisationTwoId,
templateUri: "api/v2/authorization/roles",
httpMethod: "GET",
requests: 10,
},
],
Expand All @@ -181,14 +182,14 @@ describe("OAuth Client Usage", () => {
text: JSON.stringify({
startDate,
endDate,
totalRequest: 15,
requestsPerOrganisation: [
totalRequests: 15,
requestsPerEndpoint: [
{
organisationId: organisationOneId,
endpoint: "GET api/v2/authorization/divisions",
requests: 5,
},
{
organisationId: organisationTwoId,
endpoint: "GET api/v2/authorization/roles",
requests: 10,
},
],
Expand Down
19 changes: 10 additions & 9 deletions src/tools/oauthClientUsage/oauthClientUsage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import { isUnauthorisedError } from "../utils/genesys/isUnauthorisedError.js";
import { waitFor } from "../utils/waitFor.js";

const MAX_ATTEMPTS = 10;
const TOOL_CACHE_KEY = "oauthClientUsage";
const TOOL_CACHE_KEY = "oauth-client-usage";

export interface OAuthClientUsageResponse {
startDate: string;
endDate: string;
totalRequest: number;
requestsPerOrganisation: {
organisationId?: string;
totalRequests: number;
requestsPerEndpoint: {
endpoint?: string;
requests?: number;
}[];
}
Expand Down Expand Up @@ -55,7 +55,7 @@ export const oauthClientUsage: ToolFactory<
name: "oauth_client_usage",
annotations: { title: "OAuth Client Usage" },
description:
"Retrieves the usage of an OAuth Client for a given period. It returns the total number of requests and a breakdown of requests per organization.",
"Retrieves the usage of an OAuth Client for a given period. It returns the total number of requests and a breakdown of Platform API endpoints used by the client.",
paramsSchema,
},
call: async ({ oauthClientId, startDate, endDate }) => {
Expand Down Expand Up @@ -91,7 +91,7 @@ export const oauthClientUsage: ToolFactory<
result = await oauthApi.postOauthClientUsageQuery(oauthClientId, {
interval: `${from.toISOString()}/${to.toISOString()}`,
metrics: ["Requests"],
groupBy: ["OrganizationId"],
groupBy: ["TemplateUri", "HttpMethod"],
});
} catch (error: unknown) {
const errorMessage = isUnauthorisedError(error)
Expand Down Expand Up @@ -147,13 +147,14 @@ export const oauthClientUsage: ToolFactory<
const toolResult: OAuthClientUsageResponse = {
startDate,
endDate,
totalRequest: (apiUsageQueryResult?.results ?? []).reduce(
totalRequests: (apiUsageQueryResult?.results ?? []).reduce(
(acc, curr) => acc + (curr.requests ?? 0),
0,
),
requestsPerOrganisation: (apiUsageQueryResult?.results ?? []).map(
requestsPerEndpoint: (apiUsageQueryResult?.results ?? []).map(
(result) => ({
organisationId: result.organizationId,
endpoint:
[result.httpMethod, result.templateUri].join(" ") || undefined,
requests: result.requests,
}),
),
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/serverRuns.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe("Server Runs", () => {

client = new Client({
name: "test-client",
version: "1.0.2",
version: "1.0.3",
});

await client.connect(transport);
Expand Down