diff --git a/.gitignore b/.gitignore index d6fb771..23b6066 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,9 @@ # misc .DS_Store *.pem +/.idea/ +AGENTS.md +CLAUDE.md # debug npm-debug.log* diff --git a/app/api/resources/route.ts b/app/api/resources/route.ts new file mode 100644 index 0000000..22d766b --- /dev/null +++ b/app/api/resources/route.ts @@ -0,0 +1,12 @@ +import { resourceSearch } from "../../../lib/mcp-operations"; + +export async function GET(request: Request) { + const searchParams = new URL(request.url).searchParams; + return Response.json( + await resourceSearch({ + query: searchParams.get("q") ?? "", + limit: Number(searchParams.get("limit")) || 50, + offset: Number(searchParams.get("offset")) || 0, + }), + ); +} diff --git a/lib/mcp-operations.ts b/lib/mcp-operations.ts index 7deca3f..8998247 100644 --- a/lib/mcp-operations.ts +++ b/lib/mcp-operations.ts @@ -362,7 +362,7 @@ function resourceWhere(input: ResourceFilters) { const bindings: unknown[] = []; if (input.query?.trim()) { conditions.push( - "(a.nickname LIKE ? ESCAPE '\\' OR a.public_account_id LIKE ? ESCAPE '\\' OR a.current_contact LIKE ? ESCAPE '\\' OR a.tags LIKE ? ESCAPE '\\' OR a.bio LIKE ? ESCAPE '\\')", + "(a.nickname LIKE ? ESCAPE '\\\\' OR a.public_account_id LIKE ? ESCAPE '\\\\' OR a.current_contact LIKE ? ESCAPE '\\\\' OR a.tags LIKE ? ESCAPE '\\\\' OR a.bio LIKE ? ESCAPE '\\\\')", ); const pattern = like(input.query.trim()); bindings.push(pattern, pattern, pattern, pattern, pattern);