ProjectBuild a Permission-Aware Knowledge Hub as an MCP Server: the explanation · Module 10: Permission filtering before ranking · part 12 of 22
Part 12 · Module 10: Permission filtering before ranking

Module 10: Permission filtering before ranking

24 min read·
About 55 minutes · Needs: Module 7 (groups and visibility), Module 9 (the ranked lists and fusion) · Code: server/wayfinder/search.py, server/wayfinder/knowledge.py, server/wayfinder/index/indexer.py, server/tests/retrieval/test_security_acl.py

Where this fits

WHERE THIS FITS Wayfinder this module AI CLIENTS the model writes the answer CONSOLE React, nginx WAYFINDER SERVER Starlette, mcp 2.3 RETRIEVAL permission filter before ranking INDEXING fastembed DATA Postgres 17 OPERATIONS evals, Docker, Cloud Run Claude Code HTTP + OAuth Cursor HTTP + OAuth Claude Desktop stdio bridge or connector MCP Inspector debugging, quick OAuth Web console React: search, audit, connect nginx one URL: /mcp, OAuth, /api MCP layer tools, resources Elicitation confirm create_issue OAuth 2.1 auth server, PKCE Tokens, sessions wf_pat_, cookie Console API /api REST Audit log every call, redacted stdio bridge wayfinder-stdio Guards proxy secret, limits Access rules groups per team Hybrid search pgvector + full text Fusion, boosts RRF, freshness, ADRs Knowledge decisions, owners Indexer loader, chunker bge-small-en fastembed, CPU PostgreSQL pgvector, full text Seed company Tidewater Freight Evaluation retrieval, 0 leaks Containers Docker Compose Deploy Cloud Run, Cloud SQL CI/CD GitHub Actions, WIF
This module (blue): the access rules, the searches and fusion they filter, the knowledge functions behind the other tools, and PostgreSQL, where the filter runs.

This is the idea the whole project is built around. Every other part (the tools, the console, the OAuth sign-in) exists to deliver passages to a person's AI client; this module is about making sure those passages are only ones that person may read, and that nothing about the others slips out on the side. The highlighted parts are the access rules, the two searches and the fusion, the knowledge functions behind the other tools, and PostgreSQL, where the filter actually runs.

The rest of this project is yours to keep

This project is bought on its own, once, and stays readable afterwards, including the parts added to it later.

Or open everything with a plan