@authn8/mcp-server 1.0.3 → 1.0.5

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/dist/index.js CHANGED
@@ -83,12 +83,12 @@ async function findAccountByName(name) {
83
83
  const accounts = await listAccounts();
84
84
  const lowerName = name.toLowerCase();
85
85
  const matches = accounts.filter(
86
- (acc) => acc.name.toLowerCase().includes(lowerName) || acc.issuerDomain.toLowerCase().includes(lowerName)
86
+ (acc) => acc.name?.toLowerCase().includes(lowerName) || acc.issuerDomain?.toLowerCase().includes(lowerName)
87
87
  );
88
88
  if (matches.length === 0) {
89
89
  throw new Authn8Error(
90
90
  `No account found matching "${name}". Available accounts:
91
- ${accounts.map((a) => ` - ${a.name} (${a.issuerDomain})`).join("\n")}`
91
+ ${accounts.map((a) => ` - ${a.name} (${a.issuerDomain || "unknown"})`).join("\n")}`
92
92
  );
93
93
  }
94
94
  if (matches.length === 1) {
@@ -119,7 +119,7 @@ var toolDefinitions = {
119
119
  get_otp: {
120
120
  description: "Generates a TOTP code for a specific account. You can provide either the account_id (UUID) or account_name (partial match supported). If multiple accounts match the name, you'll get a list of matches to be more specific.",
121
121
  inputSchema: z.object({
122
- account_id: z.string().uuid().optional().describe("UUID of the account"),
122
+ account_id: z.uuid().optional().describe("UUID of the account"),
123
123
  account_name: z.string().optional().describe("Name to search for (partial match)")
124
124
  })
125
125
  },
@@ -143,7 +143,7 @@ async function handleListAccounts() {
143
143
  const formatted = accounts.map((acc) => ({
144
144
  id: acc.id,
145
145
  name: acc.name,
146
- issuer: acc.issuerDomain
146
+ issuer: acc.issuerDomain || null
147
147
  }));
148
148
  return {
149
149
  content: [
@@ -191,7 +191,7 @@ async function handleGetOtp(args) {
191
191
  {
192
192
  type: "text",
193
193
  text: `Multiple accounts match "${account_name}". Please be more specific:
194
- ${result.matches.map((a) => ` - ${a.name} (${a.issuerDomain}) - ID: ${a.id}`).join("\n")}`
194
+ ${result.matches.map((a) => ` - ${a.name} (${a.issuerDomain || "unknown"}) - ID: ${a.id}`).join("\n")}`
195
195
  }
196
196
  ]
197
197
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authn8/mcp-server",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "MCP server for Authn8 2FA code access",
5
5
  "type": "module",
6
6
  "bin": {
package/src/client.ts CHANGED
@@ -13,7 +13,7 @@ export interface TokenInfo {
13
13
  export interface Account {
14
14
  id: string;
15
15
  name: string;
16
- issuerDomain: string;
16
+ issuerDomain: string | null;
17
17
  }
18
18
 
19
19
  interface AccountsResponse {
@@ -125,13 +125,13 @@ export async function findAccountByName(
125
125
 
126
126
  const matches = accounts.filter(
127
127
  (acc) =>
128
- acc.name.toLowerCase().includes(lowerName) ||
129
- acc.issuerDomain.toLowerCase().includes(lowerName)
128
+ acc.name?.toLowerCase().includes(lowerName) ||
129
+ acc.issuerDomain?.toLowerCase().includes(lowerName)
130
130
  );
131
131
 
132
132
  if (matches.length === 0) {
133
133
  throw new Authn8Error(
134
- `No account found matching "${name}". Available accounts:\n${accounts.map((a) => ` - ${a.name} (${a.issuerDomain})`).join("\n")}`
134
+ `No account found matching "${name}". Available accounts:\n${accounts.map((a) => ` - ${a.name} (${a.issuerDomain || "unknown"})`).join("\n")}`
135
135
  );
136
136
  }
137
137
 
package/src/tools.ts CHANGED
@@ -20,7 +20,6 @@ export const toolDefinitions = {
20
20
  "Generates a TOTP code for a specific account. You can provide either the account_id (UUID) or account_name (partial match supported). If multiple accounts match the name, you'll get a list of matches to be more specific.",
21
21
  inputSchema: z.object({
22
22
  account_id: z
23
- .string()
24
23
  .uuid()
25
24
  .optional()
26
25
  .describe("UUID of the account"),
@@ -56,7 +55,7 @@ export async function handleListAccounts(): Promise<{
56
55
  const formatted = accounts.map((acc) => ({
57
56
  id: acc.id,
58
57
  name: acc.name,
59
- issuer: acc.issuerDomain,
58
+ issuer: acc.issuerDomain || null,
60
59
  }));
61
60
 
62
61
  return {
@@ -114,7 +113,7 @@ export async function handleGetOtp(args: {
114
113
  content: [
115
114
  {
116
115
  type: "text",
117
- text: `Multiple accounts match "${account_name}". Please be more specific:\n${result.matches.map((a) => ` - ${a.name} (${a.issuerDomain}) - ID: ${a.id}`).join("\n")}`,
116
+ text: `Multiple accounts match "${account_name}". Please be more specific:\n${result.matches.map((a) => ` - ${a.name} (${a.issuerDomain || "unknown"}) - ID: ${a.id}`).join("\n")}`,
118
117
  },
119
118
  ],
120
119
  };