Typesense Plan — Phase 2: MCP Server
This phase builds the MCP server for agents. It depends on the Typesense instance and indexed data from Phase 1.
Prerequisites
- Phase 1 complete: Typesense running on Railway,
uvilocollection populated - Search-only API key created in Typesense
Tasks
-
Create search-only API key in Typesense
- Use the admin key to create a scoped key:
POST /keyswithactions: ["documents:search"],collections: ["uvilo"] - Store the key as
TYPESENSE_SEARCH_KEYin Railway env vars on the MCP service
- Use the admin key to create a scoped key:
-
Build the MCP server (
typesense-mcp)- Initialize Node.js project with
@modelcontextprotocol/sdk - Implement
search_knowledgetool- Parameters:
query(string, required),department(optional string),project(optional string),type(optional string),source(optional string:repoorwebsite),status(optional string),visibility(optional string),owner(optional string),limit(optional number, default 5) - Uses Typesense
multi_searchAPI with hybrid search (keyword + semantic) - Builds
filter_bystring from optional params - Returns array of
{path, title, summary, snippet, score}
- Parameters:
- Implement
get_file_summarytool- Parameters:
path(string, required) - Queries Typesense by
pathfield and returns thesummaryfield - No filesystem access needed — summary is stored in Typesense at index time
- Parameters:
- Transport: SSE (streamable HTTP) on port 3000
- Add error handling for Typesense connection failures
- Add input validation for query parameters
- Initialize Node.js project with
-
Deploy MCP server to Railway
- Write
Dockerfilefor the MCP server (Node.js runtime) - Deploy as a Railway service in the same project
- Set environment variables:
TYPESENSE_HOST,TYPESENSE_SEARCH_KEY,TYPESENSE_PORT - Enable internal networking (no public domain)
- Verify health:
curl http://typesense-mcp.railway.internal:3000/health
- Write
-
Add MCP server to LibreChat config
- Add
typesense-mcpentry toForge/Configs/LibreChat_Service/librechat.yamlundermcpServers - Use SSE transport with Railway internal URL
- Add server instructions describing the two tools
- Deploy config via
/deploy-configskill - Start a new conversation and verify
search_knowledgeandget_file_summaryappear in tool list
- Add
-
Add Knowledge doc for Typesense
- Create
Forge/Knowledge/Tools/Typesense.mdwith connection details, API usage, quirks
- Create
-
Add sidebar entries for Phase 2 Plan page
- Add to
.internal/astro.config.mjs
- Add to
-
Commit and push to
dev
Verification
- MCP server responds to health check
-
search_knowledgetool returns relevant results for “memory architecture” -
search_knowledgewithdepartment=Forgefilters correctly -
search_knowledgewithproject=TypeSensefilters correctly -
get_file_summaryreturns AI-generated summary for a known file - LibreChat conversation shows both tools available