MCP-SERVER

MCP-SERVER

A TypeScript + Express skeleton for MCP services, currently only providing a health check endpoint, with planned MySQL metadata and Alibaba Cloud log MCP services.

Category
Visit Server

README

MCP-SERVER

这是一个 TypeScript + Express 项目骨架,用来承载后续的 MCP 服务。

当前只实现健康检查,不实现具体 MCP 功能。

服务规划

  • MySQL 元数据 MCP 服务:后续用于告诉大模型某个 MySQL 实例有哪些表、表结构是什么、字段含义是什么,以及是否需要补充索引等建议。
  • 阿里云日志 MCP 服务:后续用于封装阿里云日志相关能力。

本地启动

npm install
npm run dev

默认端口是 3000,可以通过 .env 修改:

cp .env.example .env

健康检查

curl http://localhost:3000/health

预期返回:

{
  "status": "ok",
  "service": "mcp-server"
}

阿里云日志调试接口

当前先接入阿里云日志服务的 ListProject API,不接 MCP。

先复制本地环境变量文件:

cp .env.example .env.local

然后填写:

ALIYUN_LOG_ACCESS_KEY_ID=
ALIYUN_LOG_ACCESS_KEY_SECRET=
ALIYUN_LOG_REGION=cn-hangzhou
ALIYUN_LOG_DEFAULT_PROJECT_NAME=

.env.example 是提交到 Git 的模板,不放真实密钥。.env.local 是本机真实配置,已经被 .gitignore 忽略,不会上传到 GitHub。

启动服务:

npm run dev

查询当前账号在指定区域下能访问的 Project:

curl "http://localhost:3000/aliyun-log/projects"

如果请求里不传 projectName,接口会默认使用 ALIYUN_LOG_DEFAULT_PROJECT_NAME。例如你配置了 k8s-dev,上面的请求等价于按 k8s-dev 模糊过滤。

按 Project 名称模糊过滤:

curl "http://localhost:3000/aliyun-log/projects?projectName=k8s"

常用命令

npm run typecheck
npm test
npm run build
npm start

代码结构

  • src/server.ts:进程入口,负责监听端口。
  • src/app.ts:Express 应用组装入口。
  • src/config/env.ts:环境变量读取和校验。
  • src/routes/health.ts:健康检查路由。
  • src/mcp-services/mysql-metadata:MySQL 元数据 MCP 服务预留目录。
  • src/mcp-services/aliyun-log:阿里云日志 API 接入模块,当前先实现 ListProject

Review TS 代码的建议流程

你对 TypeScript 还不熟,所以每次看 AI 生成的 TS 代码,建议按下面顺序 review:

  1. 先看 package.json:确认新增依赖是不是必要,脚本命令是否清楚。
  2. 再看入口文件:本项目先看 src/server.ts,确认服务从哪里启动、监听哪个端口。
  3. 再看应用组装:看 src/app.ts,确认中间件、路由注册、返回结构是否符合预期。
  4. 再看配置读取:看 src/config/env.ts,确认环境变量有没有默认值、有没有基本校验。
  5. 再看具体路由:看 src/routes/health.ts,确认接口路径、状态码、返回 JSON。
  6. 最后看测试:看 tests/health.test.ts,确认测试覆盖了健康检查返回体;HTTP 路径可以启动服务后用 curl http://localhost:3000/health 手动确认。
  7. 跑一遍命令:npm run typechecknpm testnpm run build

如果你不确定某段 TS,可以重点问三个问题:

  • 这个文件对外暴露了什么?
  • 这个函数接收什么输入,返回什么输出?
  • 这里失败时会发生什么?

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured