Skip to content

Commit 7f9e2be

Browse files
stephendolanclaude
andauthored
chore(release): v2.4.0 (#17)
Add search_tools capability to MCP server for dynamic tool discovery. Tools can now be searched by name or description using regex patterns. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 32c0a16 commit 7f9e2be

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stephendolan/ynab-cli",
3-
"version": "2.3.0",
3+
"version": "2.4.0",
44
"description": "A command-line interface for You Need a Budget (YNAB)",
55
"type": "module",
66
"main": "./dist/cli.js",

src/mcp/server.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ import { client } from '../lib/api-client.js';
55
import { auth } from '../lib/auth.js';
66
import { convertMilliunitsToAmounts } from '../lib/utils.js';
77

8+
const toolRegistry = [
9+
{ name: 'list_budgets', description: 'List all budgets in the YNAB account' },
10+
{ name: 'get_budget', description: 'Get detailed information about a specific budget' },
11+
{ name: 'list_accounts', description: 'List all accounts in a budget' },
12+
{ name: 'get_account', description: 'Get detailed information about a specific account' },
13+
{ name: 'list_categories', description: 'List all category groups and categories in a budget' },
14+
{ name: 'get_category', description: 'Get detailed information about a specific category' },
15+
{ name: 'list_transactions', description: 'List transactions with optional filtering' },
16+
{ name: 'get_transaction', description: 'Get detailed information about a specific transaction' },
17+
{ name: 'list_transactions_by_account', description: 'List transactions for a specific account' },
18+
{ name: 'list_transactions_by_category', description: 'List transactions for a specific category' },
19+
{ name: 'list_payees', description: 'List all payees in a budget' },
20+
{ name: 'get_budget_month', description: 'Get budget details for a specific month' },
21+
{ name: 'list_scheduled_transactions', description: 'List all scheduled transactions in a budget' },
22+
{ name: 'get_user', description: 'Get information about the authenticated user' },
23+
{ name: 'check_auth', description: 'Check if YNAB authentication is configured' },
24+
];
25+
826
const server = new McpServer({
927
name: 'ynab',
1028
version: '1.0.0',
@@ -150,6 +168,23 @@ server.tool(
150168
async () => jsonResponse({ authenticated: await auth.isAuthenticated() })
151169
);
152170

171+
server.tool(
172+
'search_tools',
173+
'Search for available tools by name or description using regex. Returns matching tool names.',
174+
{
175+
query: z.string().describe('Regex pattern to match against tool names and descriptions (case-insensitive)'),
176+
},
177+
async ({ query }) => {
178+
try {
179+
const pattern = new RegExp(query, 'i');
180+
const matches = toolRegistry.filter((t) => pattern.test(t.name) || pattern.test(t.description));
181+
return jsonResponse({ tools: matches });
182+
} catch {
183+
return jsonResponse({ error: 'Invalid regex pattern' });
184+
}
185+
}
186+
);
187+
153188
export async function runMcpServer() {
154189
const transport = new StdioServerTransport();
155190
await server.connect(transport);

0 commit comments

Comments
 (0)