mcp server

Local 2025-08-31 23:26:03 0
Developer Tools @usegranthq/mcp-server

A Model Context Protocol server that provides tools for managing providers, clients, tenants, and access tokens through the UseGrant platform.


This is a Model Context Protocol (MCP) server for interacting with the UseGrant API. It provides a set of tools for managing providers, clients, tenants, and access tokens through the UseGrant platform.

Tools

  • list_providers: List all providers
  • create_provider: Create a new provider
  • get_provider: Get a provider by ID
  • delete_provider: Delete a provider
  • list_clients: List all clients for a provider
  • create_client: Create a new client for a provider
  • get_client: Get client details by provider and client ID
  • delete_client: Delete a client from a provider
  • list_domains: List all domains for a provider
  • add_domain: Add a domain to a provider
  • get_domain: Get a domain by provider and domain ID
  • delete_domain: Delete a domain from a provider
  • verify_domain: Verify a domain for a provider
  • create_access_token: Create a new access token for a client
  • list_tenants: List all tenants
  • create_tenant: Create a new tenant
  • get_tenant: Get a tenant by ID
  • delete_tenant: Delete a tenant
  • list_tenant_providers: List all providers for a tenant
  • create_tenant_provider: Create a new provider for a tenant
  • get_tenant_provider: Get a provider for a tenant
  • delete_tenant_provider: Delete a provider for a tenant
  • list_tenant_provider_policies: List all policies for a tenant provider
  • create_tenant_provider_policy: Create a new policy for a tenant provider
  • get_tenant_provider_policy: Get a policy for a tenant provider
  • delete_tenant_provider_policy: Delete a policy for a tenant provider
  • validate_access_token: Validate an access token for a tenant

Requirements

  • Node.js 16 or higher
  • A valid UseGrant API key. Refer here for more details.

Using with Claude desktop

Add the following config to your claude_desktop_config file:

{
  "mcpServers": {
    "usegrant": {
      "command": "npx",
      "args": ["-y", "@usegrant/mcp-server"],
      "env": {
        "USEGRANT_API_KEY": "your_api_key_here"
      }
    }
  }
}

Testing

To test the MCP server, we can use mcp inspector.

Copy the .env.example file to .env and set the USEGRANT_API_KEY environment variable.

npx @modelcontextprotocol/inspector -e USEGRANT_API_KEY=$USEGRANT_API_KEY npx tsx src/index.ts

To watch and build the project:

npm run dev

License

This project is licensed under the MIT License. See the LICENSE file for details.

[
  {
    "description": "List all providers",
    "inputSchema": {
      "type": "object"
    },
    "name": "list_providers"
  },
  {
    "description": "Create a new provider",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "description": {
          "description": "The description of the provider",
          "maxLength": 100,
          "minLength": 1,
          "type": "string"
        },
        "name": {
          "description": "The name of the provider",
          "maxLength": 50,
          "minLength": 3,
          "type": "string"
        }
      },
      "required": [
        "name",
        "description"
      ],
      "type": "object"
    },
    "name": "create_provider"
  },
  {
    "description": "Get a provider by ID",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "id": {
          "description": "The ID of the provider",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "id"
      ],
      "type": "object"
    },
    "name": "get_provider"
  },
  {
    "description": "Delete a provider",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "id": {
          "description": "The ID of the provider",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "id"
      ],
      "type": "object"
    },
    "name": "delete_provider"
  },
  {
    "description": "List all clients",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "providerId": {
          "description": "The ID of the provider",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "providerId"
      ],
      "type": "object"
    },
    "name": "list_clients"
  },
  {
    "description": "Create a new client for a provider",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "audience": {
          "description": "The audience of the client",
          "maxLength": 100,
          "minLength": 3,
          "type": "string"
        },
        "name": {
          "description": "The name of the client",
          "maxLength": 50,
          "minLength": 3,
          "type": "string"
        },
        "providerId": {
          "description": "The ID of the provider",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "providerId",
        "name",
        "audience"
      ],
      "type": "object"
    },
    "name": "create_client"
  },
  {
    "description": "Get client details by provider and client ID",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "clientId": {
          "description": "The ID of the client",
          "minLength": 1,
          "type": "string"
        },
        "providerId": {
          "description": "The ID of the provider",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "providerId",
        "clientId"
      ],
      "type": "object"
    },
    "name": "get_client"
  },
  {
    "description": "Delete a client from a provider",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "clientId": {
          "description": "The ID of the client",
          "minLength": 1,
          "type": "string"
        },
        "providerId": {
          "description": "The ID of the provider",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "providerId",
        "clientId"
      ],
      "type": "object"
    },
    "name": "delete_client"
  },
  {
    "description": "List all domains for a provider",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "providerId": {
          "description": "The ID of the provider",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "providerId"
      ],
      "type": "object"
    },
    "name": "list_domains"
  },
  {
    "description": "Add a domain to a provider",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "domain": {
          "description": "The domain of the domain",
          "type": "string"
        },
        "providerId": {
          "description": "The ID of the provider",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "providerId",
        "domain"
      ],
      "type": "object"
    },
    "name": "add_domain"
  },
  {
    "description": "Get a domain by provider and domain ID",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "domainId": {
          "description": "The ID of the domain",
          "minLength": 1,
          "type": "string"
        },
        "providerId": {
          "description": "The ID of the provider",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "providerId",
        "domainId"
      ],
      "type": "object"
    },
    "name": "get_domain"
  },
  {
    "description": "Delete a domain from a provider",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "domainId": {
          "description": "The ID of the domain",
          "minLength": 1,
          "type": "string"
        },
        "providerId": {
          "description": "The ID of the provider",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "providerId",
        "domainId"
      ],
      "type": "object"
    },
    "name": "delete_domain"
  },
  {
    "description": "Verify a domain for a provider",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "domainId": {
          "description": "The ID of the domain",
          "minLength": 1,
          "type": "string"
        },
        "providerId": {
          "description": "The ID of the provider",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "providerId",
        "domainId"
      ],
      "type": "object"
    },
    "name": "verify_domain"
  },
  {
    "description": "Create a new access token for a client",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "audienceAsArray": {
          "description": "Whether to use an array of audiences",
          "type": "boolean"
        },
        "clientId": {
          "description": "The ID of the client",
          "minLength": 1,
          "type": "string"
        },
        "expiresIn": {
          "description": "The number of seconds the token will be valid for",
          "maximum": 172800000,
          "type": "number"
        },
        "forceDefaultDomain": {
          "description": "Whether to force the default domain",
          "type": "boolean"
        },
        "providerId": {
          "description": "The ID of the provider",
          "minLength": 1,
          "type": "string"
        },
        "useJwtType": {
          "description": "Whether to use at+jwt token type in the header",
          "type": "boolean"
        }
      },
      "required": [
        "providerId",
        "clientId"
      ],
      "type": "object"
    },
    "name": "create_access_token"
  },
  {
    "description": "List all tenants",
    "inputSchema": {
      "type": "object"
    },
    "name": "list_tenants"
  },
  {
    "description": "Create a new tenant",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "description": {
          "description": "The description of the tenant",
          "maxLength": 100,
          "minLength": 1,
          "type": "string"
        },
        "name": {
          "description": "The name of the tenant",
          "minLength": 3,
          "type": "string"
        }
      },
      "required": [
        "name",
        "description"
      ],
      "type": "object"
    },
    "name": "create_tenant"
  },
  {
    "description": "Get a tenant by ID",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "id": {
          "description": "The ID of the tenant",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "id"
      ],
      "type": "object"
    },
    "name": "get_tenant"
  },
  {
    "description": "Delete a tenant",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "id": {
          "description": "The ID of the tenant",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "id"
      ],
      "type": "object"
    },
    "name": "delete_tenant"
  },
  {
    "description": "List all providers for a tenant",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "tenantId": {
          "description": "The ID of the tenant",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "tenantId"
      ],
      "type": "object"
    },
    "name": "list_tenant_providers"
  },
  {
    "description": "Create a new provider for a tenant",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "audience": {
          "description": "The audience of the provider",
          "maxLength": 100,
          "minLength": 3,
          "type": "string"
        },
        "earliestIssuanceTimeAllowed": {
          "description": "The earliest issuance time allowed in hours",
          "maximum": 12,
          "minimum": 0,
          "type": "number"
        },
        "fingerprints": {
          "items": {
            "description": "The fingerprint of the provider",
            "maxLength": 64,
            "minLength": 32,
            "type": "string"
          },
          "maxItems": 5,
          "minItems": 1,
          "type": "array"
        },
        "tenantId": {
          "description": "The ID of the tenant",
          "minLength": 1,
          "type": "string"
        },
        "url": {
          "description": "The URL of the provider",
          "format": "uri",
          "type": "string"
        }
      },
      "required": [
        "tenantId",
        "url",
        "fingerprints",
        "audience",
        "earliestIssuanceTimeAllowed"
      ],
      "type": "object"
    },
    "name": "create_tenant_provider"
  },
  {
    "description": "Get a provider for a tenant",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "providerId": {
          "description": "The ID of the tenant provider",
          "minLength": 1,
          "type": "string"
        },
        "tenantId": {
          "description": "The ID of the tenant",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "tenantId",
        "providerId"
      ],
      "type": "object"
    },
    "name": "get_tenant_provider"
  },
  {
    "description": "Delete a provider for a tenant",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "providerId": {
          "description": "The ID of the tenant provider",
          "minLength": 1,
          "type": "string"
        },
        "tenantId": {
          "description": "The ID of the tenant",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "tenantId",
        "providerId"
      ],
      "type": "object"
    },
    "name": "delete_tenant_provider"
  },
  {
    "description": "List all policies for a tenant provider",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "providerId": {
          "description": "The ID of the tenant provider",
          "minLength": 1,
          "type": "string"
        },
        "tenantId": {
          "description": "The ID of the tenant",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "tenantId",
        "providerId"
      ],
      "type": "object"
    },
    "name": "list_tenant_provider_policies"
  },
  {
    "description": "Create a new policy for a tenant provider",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "audience": {
          "description": "The audience of the tenant provider policy",
          "maxLength": 100,
          "minLength": 3,
          "type": "string"
        },
        "conditions": {
          "description": "The conditions of the tenant provider policy",
          "items": {
            "additionalProperties": false,
            "properties": {
              "key": {
                "description": "The key of the condition",
                "maxLength": 10,
                "minLength": 1,
                "type": "string"
              },
              "operator": {
                "description": "The operator of the condition",
                "enum": [
                  "stringEquals",
                  "stringLike",
                  "stringNotEquals",
                  "stringNotLike"
                ],
                "type": "string"
              },
              "value": {
                "description": "The value of the condition",
                "maxLength": 100,
                "minLength": 1,
                "type": "string"
              }
            },
            "required": [
              "key",
              "operator",
              "value"
            ],
            "type": "object"
          },
          "maxItems": 5,
          "minItems": 1,
          "type": "array"
        },
        "description": {
          "description": "The description of the tenant provider policy",
          "maxLength": 100,
          "minLength": 10,
          "type": "string"
        },
        "name": {
          "description": "The name of the tenant provider policy",
          "minLength": 3,
          "type": "string"
        },
        "providerId": {
          "description": "The ID of the tenant provider",
          "minLength": 1,
          "type": "string"
        },
        "tenantId": {
          "description": "The ID of the tenant",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "tenantId",
        "providerId",
        "name",
        "description",
        "audience",
        "conditions"
      ],
      "type": "object"
    },
    "name": "create_tenant_provider_policy"
  },
  {
    "description": "Get a policy for a tenant provider",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "policyId": {
          "description": "The ID of the tenant provider policy",
          "minLength": 1,
          "type": "string"
        },
        "providerId": {
          "description": "The ID of the tenant provider",
          "minLength": 1,
          "type": "string"
        },
        "tenantId": {
          "description": "The ID of the tenant",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "tenantId",
        "providerId",
        "policyId"
      ],
      "type": "object"
    },
    "name": "get_tenant_provider_policy"
  },
  {
    "description": "Delete a policy for a tenant provider",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "policyId": {
          "description": "The ID of the tenant provider policy",
          "minLength": 1,
          "type": "string"
        },
        "providerId": {
          "description": "The ID of the tenant provider",
          "minLength": 1,
          "type": "string"
        },
        "tenantId": {
          "description": "The ID of the tenant",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "tenantId",
        "providerId",
        "policyId"
      ],
      "type": "object"
    },
    "name": "delete_tenant_provider_policy"
  }
]