@@ -5,6 +5,24 @@ import { client } from '../lib/api-client.js';
55import { auth } from '../lib/auth.js' ;
66import { 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+
826const 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+
153188export async function runMcpServer ( ) {
154189 const transport = new StdioServerTransport ( ) ;
155190 await server . connect ( transport ) ;
0 commit comments