MCP-Server

MCP-Server

A production-ready MCP server with file management, HTTP requests, system info, and environment variable tools, plus a management UI and dual transport for Claude Desktop and Claude.ai.

Category
访问服务器

README

MCP Server with Management UI

A production-ready Model Context Protocol server built with TypeScript, featuring:

  • 6 built-in tools – file read/write/list, HTTP fetch, system info, and env variable reader
  • Dual transport – stdio (Claude Desktop) and SSE/HTTP (Claude.ai)
  • Management Dashboard – live tool list, interactive tool tester, and request log
  • Extensible – add new tools in minutes

Prerequisites


Quick Start

1 · Install dependencies

npm run install:all

Installs both server and UI packages.

2 · Configure environment

# Windows
copy .env.example .env

# macOS / Linux
cp .env.example .env

Edit .env to set PORT, SERVER_NAME, or any API keys you need.

3 · Development mode (hot-reload)

Open two terminals:

# Terminal 1 – backend server with hot-reload
npm run dev

# Terminal 2 – UI dev server (proxies API calls to the backend)
cd ui && npm run dev
  • Backend API + SSE: http://localhost:3000
  • Management UI (dev): http://localhost:5173/ui

4 · Production build

npm run build   # compiles TypeScript + builds React UI
npm start       # starts everything on :3000

Open http://localhost:3000/ui in your browser.


Connecting to Claude Desktop (stdio)

Claude Desktop launches the server as a child process automatically — no running server needed.

Step 1 — Build the server

npm run build

Step 2 — Find the correct config file location

The location depends on how Claude Desktop was installed:

Installation type Config path
Windows Store / MSIX %LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json
Windows direct installer %APPDATA%\Claude\claude_desktop_config.json
macOS ~/Library/Application Support/Claude/claude_desktop_config.json

Tip (Windows): Run this in PowerShell to find the right file automatically:

Get-ChildItem "$env:LOCALAPPDATA" -Recurse -Filter "claude_desktop_config.json" -ErrorAction SilentlyContinue
Get-ChildItem "$env:APPDATA"      -Recurse -Filter "claude_desktop_config.json" -ErrorAction SilentlyContinue

Step 3 — Write the config

Replace YOU and C:/path/to with your actual username and project path.

{
  "mcpServers": {
    "mcp-server": {
      "command": "node",
      "args": ["C:/Users/YOU/Projects/mcp-server/dist/index.js", "--stdio"]
    }
  }
}

Windows tip: If node isn't found by Claude Desktop, use the full path instead:

(Get-Command node).Source   # prints e.g. C:\Program Files\nodejs\node.exe

Then set "command": "C:/Program Files/nodejs/node.exe".

Step 4 — Restart Claude Desktop

  • Fully quit Claude Desktop (right-click tray icon → Quit, don't just close the window)
  • Reopen it from the Start Menu / Applications
  • Open a new chat and ask: "What tools do you have available?"

Claude will list all 6 tools automatically — no connect button required.


Connecting to Claude.ai (SSE)

Claude.ai's custom connector requires a publicly accessible HTTPS URL.

Step 1 — Start the server

npm start

Step 2 — Expose it with a tunnel

# Using ngrok (https://ngrok.com)
ngrok http 3000
# Copy the https://xxxx.ngrok-free.app URL

Alternatives: Cloudflare Tunnel, localtunnel

Step 3 — Add the connector in Claude.ai

In Claude Desktop or Claude.ai:

  • Click + → Connectors → Add custom connector
  • Name: mcp-server
  • URL: https://xxxx.ngrok-free.app/sse

Available Tools

Tool Description
read_file Read a file's contents (utf-8 or base64)
write_file Write / append text to a file
list_directory List files in a directory (optionally recursive)
fetch_url Make HTTP requests (GET, POST, PUT, DELETE, PATCH)
get_system_info OS, CPU, memory, network, and process details
get_environment_variable Read environment variables from the server process

Adding New Tools

All tools live in src/tools/. Create a new file, export a register*Tools function, and call it from src/server.ts.

Example – add a calculator tool:

// src/tools/calculator.ts
import { z } from 'zod';
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { registerTool } from './registry.js';

export function registerCalculatorTools(server: McpServer): void {
  registerTool(
    server,
    'calculate',
    'Evaluate a simple arithmetic expression and return the result.',
    {
      expression: z.string().describe('Arithmetic expression, e.g. "2 + 2 * 10"'),
    },
    async ({ expression }) => {
      const result = Function(`"use strict"; return (${expression})`)();
      return { content: [{ type: 'text' as const, text: String(result) }] };
    },
  );
}

Then in src/server.ts:

import { registerCalculatorTools } from './tools/calculator.js';
// inside createMcpServer():
registerCalculatorTools(server);

The new tool appears in the Management UI and is immediately available to Claude.


Project Structure

mcp-server/
├── src/
│   ├── index.ts          # Entry point – detects --stdio vs HTTP mode
│   ├── server.ts         # McpServer factory, registers all tools
│   ├── web.ts            # Express server (SSE transport + REST API for UI)
│   ├── logger.ts         # Circular in-memory request log (200 entries)
│   ├── types.ts          # Shared TypeScript types
│   └── tools/
│       ├── registry.ts   # registerTool() wrapper + direct invocation map
│       ├── file.ts       # read_file, write_file, list_directory
│       ├── fetch.ts      # fetch_url
│       └── system.ts     # get_system_info, get_environment_variable
├── ui/
│   ├── src/
│   │   ├── App.tsx       # Tabbed layout (Tools / Tester / Logs)
│   │   ├── api.ts        # REST client for the management API
│   │   └── components/
│   │       ├── ServerStatus.tsx   # Live uptime, port, request count
│   │       ├── ToolList.tsx       # Expandable list with JSON schemas
│   │       ├── ToolTester.tsx     # Select tool → edit JSON → invoke
│   │       └── RequestLog.tsx     # Auto-refreshing log with expand
│   └── vite.config.ts
├── dist/                 # Compiled server output (after npm run build)
├── .env                  # Local config – not committed
├── .env.example          # Template for .env
├── claude_desktop_config.json   # Example config snippet
├── package.json
└── tsconfig.json

Scripts

Command Description
npm run dev Run server with hot-reload (tsx watch)
npm run dev:stdio Run in stdio mode for Claude Desktop testing
npm run build Compile TypeScript + build React UI
npm start Run compiled server (HTTP/SSE + UI mode)
npm run start:stdio Run compiled server in stdio mode
npm run install:all Install all dependencies (server + UI)
npm run setup Full first-time setup: install + build

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选