MCP Support Agent

MCP Support Agent

Enables ticket management through a REST API and support document search via a local vector database, powered by Ollama and LanceDB.

Category
访问服务器

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选