@agentdomain/mcp-server 0.7.0 → 0.8.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/README.md CHANGED
@@ -2,51 +2,43 @@
2
2
 
3
3
  [Model Context Protocol](https://modelcontextprotocol.io) server for AgentDomain.
4
4
 
5
- Lets any MCP-compatible LLM client (Claude Desktop, ChatGPT desktop apps, custom agents) register and manage agent identities through natural language.
6
-
7
- The default API base, `https://agentdomain.app/api/v1`, also returns machine-readable discovery
8
- metadata when requested directly.
9
-
10
- ## Tools exposed
11
-
12
- - `check_domain_availability` - is a domain available?
13
- - `quote_registration` - price a registration
14
- - `register_agent_identity` - register a complete identity (requires wallet)
15
- - `lookup_agent` - find an agent by wallet
16
- - `search_agents` - search the public registry
17
- - `send_agent_email` - send an email from an agent's address
18
- - `send_agent_email_batch` - queue up to 100 email objects in one API request
19
- - `list_agent_email` - read agent inbox/outbox messages
20
- - `get_agent_email_usage` - inspect combined monthly sent and received usage
21
- - `configure_email_webhook` - configure a signed inbound email webhook
22
- - `update_primary_email` - change the included primary email username
23
- - `create_email_alias` - create a Starter/Pro/Enterprise receive-and-send email alias
24
- - `delete_email_alias` - delete an active email alias
25
- - `list_dns_records` - list DNS records for an agent domain
26
- - `create_dns_record` - create a user-managed DNS record
27
- - `update_dns_record` - update a user-managed DNS record
28
- - `delete_dns_record` - delete a user-managed DNS record
29
- - `get_dns_capabilities` - discover all 13 Spaceship-supported types and validation constraints
30
- - `change_dns_records` - preview or apply a revision-protected merge/replace batch
31
- - `import_dns_zone` - preview or apply a standard BIND zone import
32
- - `export_dns_zone` - export user-managed or permitted complete-zone records as BIND
33
- - `reconfigure_ssl` - rebuild Cloudflare SaaS SSL and DNS validation records
34
- - `fund_renewal_vault` - top up an agent's renewal vault
35
- - `withdraw_renewal_vault` - build an owner-signed vault withdrawal transaction
36
- - `get_renewal_status` - check renewal date, amount, vault balance, and auto-renew state
37
- - `enable_auto_renew` - enable on-chain auto-renew with the AgentID NFT owner wallet
38
- - `get_service_plan` - inspect per-agent Included/Starter/Pro/Enterprise limits
39
- - `purchase_service_plan` - upgrade to Starter, Pro, or Enterprise with x402 USDC
40
-
41
- ## Install
5
+ It lets MCP-compatible clients discover and manage agent identities through the
6
+ [AgentDomain API](https://api.agentdomain.app/api/v1).
7
+
8
+ The server requires Node.js 20 or newer and communicates over standard input
9
+ and output. It does not open a public listener.
10
+
11
+ ## Run
12
+
13
+ ```bash
14
+ npx -y @agentdomain/mcp-server
15
+ ```
16
+
17
+ For a persistent installation:
42
18
 
43
19
  ```bash
44
20
  npm install -g @agentdomain/mcp-server
21
+ agentdomain-mcp
45
22
  ```
46
23
 
47
- ## Configure (Claude Desktop example)
24
+ ## Default tools
25
+
26
+ The server starts in read-only mode. It advertises only tools that inspect public
27
+ or authorized account state:
28
+
29
+ - `check_domain_availability` and `quote_registration`
30
+ - `lookup_agent`, `get_agent`, and `search_agents`
31
+ - `list_agent_email` and `get_agent_email_usage`
32
+ - `get_dns_capabilities`, `list_dns_records`, and `export_dns_zone`
33
+ - `get_renewal_status` and `get_service_plan`
48
34
 
49
- `~/Library/Application Support/Claude/claude_desktop_config.json`:
35
+ An API key may authorize additional reads, but merely supplying one never enables
36
+ mutation tools.
37
+
38
+ ## Read-only configuration
39
+
40
+ Start without a signing credential for discovery, lookup, search, and other
41
+ read-only operations. For example:
50
42
 
51
43
  ```json
52
44
  {
@@ -55,56 +47,70 @@ npm install -g @agentdomain/mcp-server
55
47
  "command": "npx",
56
48
  "args": ["-y", "@agentdomain/mcp-server"],
57
49
  "env": {
58
- "AGENTDOMAIN_API_URL": "https://agentdomain.app/api/v1",
59
- "AGENT_PRIVATE_KEY": "0x...",
60
- "AGENTDOMAIN_NETWORK": "base",
61
- "AGENTDOMAIN_BUILDER_CODE": "your_builder_code",
62
- "RENEWAL_VAULT_ADDRESS": "0x..."
50
+ "AGENTDOMAIN_API_URL": "https://api.agentdomain.app/api/v1"
63
51
  }
64
52
  }
65
53
  }
66
54
  }
67
55
  ```
68
56
 
69
- For `enable_auto_renew`, `AGENT_PRIVATE_KEY` must be the AgentID NFT owner wallet. Funding can come
70
- from any wallet, but the RenewalVault contract only accepts auto-renew changes from the owner.
57
+ This remains read-only even if the MCP process receives an ambient API key or
58
+ wallet credential.
59
+
60
+ ## Enabling write tools
61
+
62
+ Write tools are omitted from discovery and blocked at dispatch unless
63
+ `AGENTDOMAIN_ENABLE_WRITE_TOOLS` is set to the exact value `true`. Unset or exact
64
+ `false` keeps read-only mode. Empty, mixed-case, numeric, whitespace-padded, or
65
+ otherwise malformed values stop startup rather than guessing intent.
71
66
 
72
- `AGENTDOMAIN_BUILDER_CODE` is the public ERC-8021 app identifier used to attribute direct Base
73
- transactions created through MCP. It must contain 1-32 lowercase letters, numbers, or underscores.
74
- It is required only by `enable_auto_renew` and `withdraw_renewal_vault`; the server validates it when
75
- one of those tools is called, so read-only, API-managed, and x402 payment tools continue to work
76
- without it. x402 v2 payments use AgentDomain's resource-server attribution instead.
67
+ The opt-in exposes registration, email sending/configuration, email deletion,
68
+ DNS mutations, SSL reconfiguration, renewal funding/withdrawal/automation, plan
69
+ purchases/scheduling, and registry-visibility changes. Configure the nonsecret
70
+ opt-in in the MCP process environment, then inject only the narrowly scoped API
71
+ or signing credential required by the selected operation through a trusted
72
+ secret-aware launcher. Do not place either credential in MCP client JSON.
77
73
 
78
- ## Pricing flags
74
+ ## Signing credentials
79
75
 
80
- Registration pricing includes the live domain price plus the annual AgentDomain
81
- platform fee. Email setup, SSL certification, DNS orchestration, and AgentID NFT
82
- mint/orchestration are included in that platform fee.
76
+ Supply `AGENT_PRIVATE_KEY` only when an enabled operation requires a wallet
77
+ signature. Inject it through a trusted external secret store or secret-aware
78
+ launcher; never paste it into client JSON, source code, shell history, logs, or a
79
+ repository. Use a dedicated wallet with only the authority and funds required
80
+ for the intended operation.
83
81
 
84
- Optional onchain services charge only when enabled:
82
+ Owner-authorized renewal changes require the AgentID NFT owner wallet. Paid plan
83
+ purchases likewise require an authorized wallet with sufficient USDC. An
84
+ agent-scoped API key can call its permitted endpoints but cannot sign wallet
85
+ transactions.
85
86
 
86
- - `registerBasename: false` skips Basename and Basename cost.
87
- - `registerEns: false` skips ENS and ENS cost.
88
- - `emailEnabled` is still accepted for old clients but is deprecated and ignored.
89
- - `emailUsername` customizes the primary inbox local-part; omit it for `agent@domain`.
90
- - `premiumPlan: "included" | "starter" | "pro" | "enterprise"` selects the per-agent plan at registration.
87
+ `AGENTDOMAIN_BUILDER_CODE` is the public ERC-8021 application identifier used to
88
+ attribute supported Base transactions. It accepts 1-32 lowercase letters,
89
+ numbers, or underscores and is needed only by tools that explicitly require it.
91
90
 
92
- Use `quote_registration` first so the agent sees `platformFeeUsdc`, included
93
- email/SSL metadata, optional component costs, and `totalUsdc` before it signs
94
- the x402 payment.
91
+ ## Pricing options
95
92
 
96
- For renewals, `get_renewal_status` returns the exact next renewal amount and the
97
- shortfall to fund before the keeper can reserve and complete the renewal.
93
+ Registration pricing includes the live domain price and the AgentDomain platform
94
+ fee. Email setup, SSL certification, DNS orchestration, and AgentID NFT
95
+ orchestration are included unless the API response states otherwise.
98
96
 
99
- For Premium Plans, `purchase_service_plan` upgrades coverage through the
100
- agent's current expiry. Future Premium Plan renewal is charged together with the
101
- identity renewal quote in RenewalVault.
97
+ Optional settings include:
102
98
 
103
- Autonomous Premium Plan purchase requires `AGENT_PRIVATE_KEY` for the owner or a
104
- delegated wallet on Base with enough USDC. An agent-scoped API key can operate
105
- its own allowed endpoints, but it cannot sign x402 paid purchases by itself.
99
+ - `registerBasename: false` to skip Basename
100
+ - `registerEns: false` to skip ENS
101
+ - `emailUsername` to customize the primary inbox local part
102
+ - `premiumPlan: "included" | "starter" | "pro" | "enterprise"` to select a plan
103
+
104
+ Use `quote_registration` before signing a payment. Treat the returned quote,
105
+ limits, expiry, and renewal amount as authoritative for that request.
106
106
 
107
107
  ## License
108
108
 
109
- Public package releases are licensed under Apache-2.0. Private AgentDomain
110
- platform code is not included in this package.
109
+ Published package releases are licensed under Apache-2.0.
110
+
111
+ ## Links
112
+
113
+ - [MCP guide](https://docs.agentdomain.app/sdk/mcp)
114
+ - [API discovery](https://api.agentdomain.app/api/v1)
115
+ - [Source](https://github.com/0xmdrakib/AgentDomain/tree/main/packages/mcp-server)
116
+ - [Security policy](https://github.com/0xmdrakib/AgentDomain/security/policy)
package/dist/index.d.ts CHANGED
@@ -14,12 +14,13 @@
14
14
  * "command": "npx",
15
15
  * "args": ["-y", "@agentdomain/mcp-server"],
16
16
  * "env": {
17
- * "AGENTDOMAIN_API_URL": "https://agentdomain.app/api/v1",
18
- * "AGENT_PRIVATE_KEY": "0x...",
19
- * "AGENTDOMAIN_BUILDER_CODE": "your_builder_code"
17
+ * "AGENTDOMAIN_API_URL": "https://api.agentdomain.app/api/v1"
20
18
  * }
21
19
  * }
22
20
  * }
23
21
  * }
22
+ *
23
+ * Inject optional signing credentials through a trusted external secret source,
24
+ * and only when a signing operation is explicitly enabled.
24
25
  */
25
26
  export {};
package/dist/index.js CHANGED
@@ -14,17 +14,18 @@
14
14
  * "command": "npx",
15
15
  * "args": ["-y", "@agentdomain/mcp-server"],
16
16
  * "env": {
17
- * "AGENTDOMAIN_API_URL": "https://agentdomain.app/api/v1",
18
- * "AGENT_PRIVATE_KEY": "0x...",
19
- * "AGENTDOMAIN_BUILDER_CODE": "your_builder_code"
17
+ * "AGENTDOMAIN_API_URL": "https://api.agentdomain.app/api/v1"
20
18
  * }
21
19
  * }
22
20
  * }
23
21
  * }
22
+ *
23
+ * Inject optional signing credentials through a trusted external secret source,
24
+ * and only when a signing operation is explicitly enabled.
24
25
  */
25
26
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
26
27
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
27
- import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
28
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
28
29
  import { z } from 'zod';
29
30
  import { AgentDomain, validateBuilderCode } from '@agentdomain/sdk';
30
31
  import { DNS_RECORD_TYPES, dnsRecordSchema, dnsRecordObjectSchema, } from '@agentdomain/shared';
@@ -38,6 +39,8 @@ const AGENT_PRIVATE_KEY = process.env.AGENT_PRIVATE_KEY;
38
39
  const AGENTDOMAIN_API_KEY = process.env.AGENTDOMAIN_API_KEY;
39
40
  const AGENTDOMAIN_BUILDER_CODE = process.env.AGENTDOMAIN_BUILDER_CODE;
40
41
  const RENEWAL_VAULT_ADDRESS = process.env.RENEWAL_VAULT_ADDRESS;
42
+ const WRITE_TOOLS_ENV = 'AGENTDOMAIN_ENABLE_WRITE_TOOLS';
43
+ const WRITE_TOOLS_ENABLED = parseWriteToolsEnabled(process.env[WRITE_TOOLS_ENV]);
41
44
  function getClient() {
42
45
  const config = {
43
46
  apiUrl: API_URL,
@@ -61,7 +64,7 @@ const server = new Server({ name: 'agentdomain-mcp', version: '0.2.1' }, { capab
61
64
  // ----------------------------------------------------------------------
62
65
  // TOOL DEFINITIONS
63
66
  // ----------------------------------------------------------------------
64
- const TOOLS = [
67
+ const TOOL_DEFINITIONS = [
65
68
  {
66
69
  name: 'check_domain_availability',
67
70
  description: 'Check whether an agent domain (name + tld) is available for registration. Returns availability status and pricing.',
@@ -341,7 +344,7 @@ const TOOLS = [
341
344
  },
342
345
  {
343
346
  name: 'get_dns_capabilities',
344
- description: 'Get the machine-readable Spaceship DNS types, fields, limits, and safety warnings supported by AgentDomain.',
347
+ description: 'Get the machine-readable DNS types, fields, limits, and safety warnings supported by AgentDomain.',
345
348
  inputSchema: {
346
349
  type: 'object',
347
350
  properties: { agentId: { type: 'string', description: 'AgentDomain agent ID (UUID)' } },
@@ -350,7 +353,7 @@ const TOOLS = [
350
353
  },
351
354
  {
352
355
  name: 'list_dns_records',
353
- description: 'List Spaceship-backed DNS records for an agent domain.',
356
+ description: 'List DNS records for an agent domain.',
354
357
  inputSchema: {
355
358
  type: 'object',
356
359
  properties: {
@@ -361,7 +364,7 @@ const TOOLS = [
361
364
  },
362
365
  {
363
366
  name: 'create_dns_record',
364
- description: 'Create a user-managed DNS record and sync the full DNS state to Spaceship.',
367
+ description: 'Create a user-managed DNS record and apply the resulting DNS state.',
365
368
  inputSchema: {
366
369
  type: 'object',
367
370
  properties: {
@@ -378,7 +381,7 @@ const TOOLS = [
378
381
  },
379
382
  {
380
383
  name: 'update_dns_record',
381
- description: 'Update a user-managed DNS record and sync the DNS state to Spaceship.',
384
+ description: 'Update a user-managed DNS record and apply the resulting DNS state.',
382
385
  inputSchema: {
383
386
  type: 'object',
384
387
  properties: {
@@ -396,7 +399,7 @@ const TOOLS = [
396
399
  },
397
400
  {
398
401
  name: 'delete_dns_record',
399
- description: 'Delete a user-managed DNS record and sync the DNS state to Spaceship.',
402
+ description: 'Delete a user-managed DNS record and apply the resulting DNS state.',
400
403
  inputSchema: {
401
404
  type: 'object',
402
405
  properties: {
@@ -450,7 +453,7 @@ const TOOLS = [
450
453
  },
451
454
  {
452
455
  name: 'reconfigure_ssl',
453
- description: 'Rebuild the Cloudflare SaaS SSL hostname and sync required DNS validation records.',
456
+ description: 'Rebuild the managed SSL hostname and sync required DNS validation records.',
454
457
  inputSchema: {
455
458
  type: 'object',
456
459
  properties: {
@@ -564,16 +567,59 @@ const TOOLS = [
564
567
  },
565
568
  },
566
569
  ];
570
+ const READ_ONLY_TOOL_NAMES = new Set([
571
+ 'check_domain_availability',
572
+ 'quote_registration',
573
+ 'lookup_agent',
574
+ 'get_agent',
575
+ 'search_agents',
576
+ 'get_agent_email_usage',
577
+ 'list_agent_email',
578
+ 'get_dns_capabilities',
579
+ 'list_dns_records',
580
+ 'export_dns_zone',
581
+ 'get_renewal_status',
582
+ 'get_service_plan',
583
+ ]);
584
+ const ADDITIVE_WRITE_TOOL_NAMES = new Set([
585
+ 'send_agent_email',
586
+ 'send_agent_email_batch',
587
+ 'create_email_alias',
588
+ 'create_dns_record',
589
+ ]);
590
+ function annotationsForTool(name) {
591
+ const readOnly = READ_ONLY_TOOL_NAMES.has(name);
592
+ return {
593
+ readOnlyHint: readOnly,
594
+ destructiveHint: readOnly ? false : !ADDITIVE_WRITE_TOOL_NAMES.has(name),
595
+ idempotentHint: readOnly,
596
+ openWorldHint: true,
597
+ };
598
+ }
599
+ const TOOLS = TOOL_DEFINITIONS.map((tool) => ({
600
+ ...tool,
601
+ annotations: annotationsForTool(tool.name),
602
+ }));
603
+ const ENABLED_TOOLS = WRITE_TOOLS_ENABLED
604
+ ? TOOLS
605
+ : TOOLS.filter((tool) => READ_ONLY_TOOL_NAMES.has(tool.name));
606
+ const ENABLED_TOOL_NAMES = new Set(ENABLED_TOOLS.map((tool) => tool.name));
567
607
  // ----------------------------------------------------------------------
568
608
  // HANDLERS
569
609
  // ----------------------------------------------------------------------
570
610
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
571
- tools: TOOLS,
611
+ tools: ENABLED_TOOLS,
572
612
  }));
573
613
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
574
614
  const { name, arguments: args } = request.params;
575
- const client = getClient();
576
615
  try {
616
+ if (!ENABLED_TOOL_NAMES.has(name)) {
617
+ return {
618
+ isError: true,
619
+ content: [{ type: 'text', text: `Unknown or disabled tool: ${name}` }],
620
+ };
621
+ }
622
+ const client = getClient();
577
623
  switch (name) {
578
624
  case 'check_domain_availability': {
579
625
  const a = z
@@ -947,6 +993,13 @@ function requireDnsRevision(value) {
947
993
  throw new Error('Apply requires baseRevision from a fresh DNS dry-run preview.');
948
994
  return value;
949
995
  }
996
+ function parseWriteToolsEnabled(value) {
997
+ if (value === undefined || value === 'false')
998
+ return false;
999
+ if (value === 'true')
1000
+ return true;
1001
+ throw new Error(`${WRITE_TOOLS_ENV} must be exactly "true" or "false" when set.`);
1002
+ }
950
1003
  function requireDirectBaseWriteBuilderCode(toolName) {
951
1004
  if (!AGENTDOMAIN_BUILDER_CODE) {
952
1005
  throw new Error(`${toolName} requires AGENTDOMAIN_BUILDER_CODE so its direct Base transaction includes ERC-8021 attribution.`);
package/package.json CHANGED
@@ -1,12 +1,30 @@
1
1
  {
2
2
  "name": "@agentdomain/mcp-server",
3
- "version": "0.7.0",
4
- "description": "MCP server exposing AgentDomain registration and management tools to any LLM",
3
+ "version": "0.8.0",
4
+ "description": "Secure-by-default MCP server for AgentDomain identity, DNS, email, and renewal workflows",
5
+ "keywords": [
6
+ "agentdomain",
7
+ "ai-agents",
8
+ "mcp",
9
+ "model-context-protocol",
10
+ "identity",
11
+ "x402",
12
+ "base"
13
+ ],
5
14
  "license": "Apache-2.0",
6
- "repository": "https://github.com/0xmdrakib/AgentDomain.git",
7
- "homepage": "https://agentdomain.app/docs",
8
- "bugs": "https://github.com/0xmdrakib/AgentDomain/issues",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/0xmdrakib/AgentDomain.git",
18
+ "directory": "packages/mcp-server"
19
+ },
20
+ "homepage": "https://docs.agentdomain.app/sdk/mcp",
21
+ "bugs": {
22
+ "url": "https://github.com/0xmdrakib/AgentDomain/issues"
23
+ },
9
24
  "type": "module",
25
+ "engines": {
26
+ "node": ">=20"
27
+ },
10
28
  "main": "./dist/index.js",
11
29
  "types": "./dist/index.d.ts",
12
30
  "bin": {
@@ -26,8 +44,8 @@
26
44
  "@modelcontextprotocol/sdk": "^1.0.4",
27
45
  "viem": "^2.55.2",
28
46
  "zod": "^3.24.1",
29
- "@agentdomain/sdk": "^0.7.0",
30
- "@agentdomain/shared": "^0.7.0"
47
+ "@agentdomain/sdk": "^0.8.0",
48
+ "@agentdomain/shared": "^0.8.0"
31
49
  },
32
50
  "devDependencies": {
33
51
  "@types/node": "^22.10.5",