MCP Support Agent
Enables ticket management through a REST API and support document search via a local vector database, powered by Ollama and LanceDB.
README
MCP Support Agent
This repo started as a small Express ticket API. I used it to learn how an existing API can be exposed through MCP, then added an Ollama-based agent and document search with local embeddings and LanceDB.
The code covers two use cases:
- ticket tools backed by a REST API
- support-document search backed by a local vector database
How it works
User question
↓
Ollama model
↓ requests a tool
TypeScript MCP client
↓ stdio
MCP server
├── ticket tools → Express REST API
└── document search → EmbeddingGemma → LanceDB
The model sees the available tools through MCP listTools(). When it requests a tool, the TypeScript client calls the MCP server and sends the result back to the model.
MCP tools
| Tool | Description |
|---|---|
get_tickets |
Get all tickets from the REST API |
get_ticket |
Get one ticket by ID |
create_ticket |
Create a ticket after user approval |
search_documents |
Search support articles by meaning and optional category |
Document search
Support articles are split into sentences and embedded with embeddinggemma:300m-qat-q4_0. The indexing script stores the chunks and their vectors in LanceDB.
At query time, only the question is embedded. LanceDB applies the tenant and category filters, performs a cosine-distance search, and returns up to two matches within the configured distance threshold.
Indexing and querying use the same embedding model. If the model or source articles change, rebuild the index.
Setup
Requirements:
- Node.js 20 or newer
- Ollama running locally
Install the project and download the local models:
npm install
ollama pull embeddinggemma:300m-qat-q4_0
ollama pull qwen3:1.7b
Build the vector database:
npm run index:documents
LanceDB writes its files to data/, which is ignored by Git.
Run the local agent
npm run agent:local
The included prompt asks for printer help. The agent calls search_documents and prints the sources collected from the MCP result below the model's answer.
Run the ticket API
npm run dev
Available routes:
GET /tickets
GET /tickets/:id
POST /tickets
Tickets are kept in memory, so created tickets are cleared when the server restarts.
Run the cloud agent
The cloud example needs an Ollama API key. Copy .env.example to .env and set the key, then run the API and agent in separate terminals:
npm run start
npm run agent:cloud
The example prompt creates a ticket and fetches another one. Write tools require confirmation before they run.
Retrieval checks
npm run evaluate:retrieval
The current test set contains three queries with expected articles and one query that should return no result:
Evaluation accuracy: 4/4 (100%)
This is only a check against the small set of articles in this repo, not a general embedding benchmark.
Tenant filtering
Documents for two sample companies are stored in the same LanceDB table. The MCP server uses a fixed company-a tenant to stand in for an authenticated session.
The tool schema does not accept tenantId. A client can send that extra field, but it cannot override the tenant used by the server. A real application would take this value from a verified session or token instead of a constant.
Commands
| Command | Description |
|---|---|
npm run typecheck |
Check TypeScript |
npm run build |
Compile the project |
npm run index:documents |
Rebuild the LanceDB table |
npm run evaluate:retrieval |
Run retrieval checks |
npm run test:mcp |
List MCP tools and call document search directly |
npm run agent:local |
Run the local Ollama example |
npm run agent:cloud |
Run the Ollama Cloud example |
npm run documents:upsert |
Insert or replace the sample Wi-Fi article |
npm run documents:delete |
Delete the sample Wi-Fi article |
Project layout
src/ API, MCP server, agents, and document search
scripts/ Indexing, document updates, and retrieval checks
examples/ Small examples built while learning each piece
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.