Skip to content

Commit 2e7e0f8

Browse files
committed
Add support for domain api's
1 parent 5bf14a0 commit 2e7e0f8

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

.changeset/violet-apples-appear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@usegrant/mcp': minor
3+
---
4+
5+
Add support for domain api's

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introdu
1212
- **create_client**: Create a new client for a provider
1313
- **get_client**: Get client details by provider and client ID
1414
- **delete_client**: Delete a client from a provider
15+
- **list_domains**: List all domains for a provider
16+
- **add_domain**: Add a domain to a provider
17+
- **get_domain**: Get a domain by provider and domain ID
18+
- **delete_domain**: Delete a domain from a provider
19+
- **verify_domain**: Verify a domain for a provider
1520
- **create_access_token**: Create a new access token for a client
1621
- **list_tenants**: List all tenants
1722
- **create_tenant**: Create a new tenant

src/index.ts

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,80 @@ server.tool(
120120
},
121121
);
122122

123+
server.tool(
124+
'list_domains',
125+
'List all domains for a provider',
126+
{
127+
providerId: UgSchema.ProviderIdSchema,
128+
},
129+
async ({ providerId }) => {
130+
const domains = await usegrant.getDomains(providerId);
131+
return {
132+
content: [{ type: 'text', text: JSON.stringify(domains, null, 2) }],
133+
};
134+
},
135+
);
136+
137+
server.tool(
138+
'add_domain',
139+
'Add a domain to a provider',
140+
{
141+
providerId: UgSchema.ProviderIdSchema,
142+
domain: UgSchema.DomainSchema.shape.domain,
143+
},
144+
async ({ providerId, domain }) => {
145+
const domainEntity = await usegrant.addDomain(providerId, { domain });
146+
return {
147+
content: [{ type: 'text', text: JSON.stringify(domainEntity, null, 2) }],
148+
};
149+
},
150+
);
151+
152+
server.tool(
153+
'get_domain',
154+
'Get a domain by provider and domain ID',
155+
{
156+
providerId: UgSchema.ProviderIdSchema,
157+
domainId: UgSchema.DomainIdSchema,
158+
},
159+
async ({ providerId, domainId }) => {
160+
const domain = await usegrant.getDomain(providerId, domainId);
161+
return {
162+
content: [{ type: 'text', text: JSON.stringify(domain, null, 2) }],
163+
};
164+
},
165+
);
166+
167+
server.tool(
168+
'delete_domain',
169+
'Delete a domain from a provider',
170+
{
171+
providerId: UgSchema.ProviderIdSchema,
172+
domainId: UgSchema.DomainIdSchema,
173+
},
174+
async ({ providerId, domainId }) => {
175+
await usegrant.deleteDomain(providerId, domainId);
176+
return {
177+
content: [{ type: 'text', text: `Domain ${domainId} deleted` }],
178+
};
179+
},
180+
);
181+
182+
server.tool(
183+
'verify_domain',
184+
'Verify a domain for a provider',
185+
{
186+
providerId: UgSchema.ProviderIdSchema,
187+
domainId: UgSchema.DomainIdSchema,
188+
},
189+
async ({ providerId, domainId }) => {
190+
const domain = await usegrant.verifyDomain(providerId, domainId);
191+
return {
192+
content: [{ type: 'text', text: JSON.stringify(domain, null, 2) }],
193+
};
194+
},
195+
);
196+
123197
server.tool(
124198
'create_access_token',
125199
'Create a new access token for a client',

0 commit comments

Comments
 (0)