Mcp_server

by hfhfn

5 stars
118 downloads
Not rated
GitHub

About

Mcpserver is a MCP (Model Context Protocol) server configuration reference that demonstrates how to run MCP services using uv/uvx and connect clients via stdio, SSE, or streamable HTTP transports. It provides example configurations for multiple MCP tools such as math, weather…

Details

Author
hfhfn
GitHub stars
5
Downloads
118
Categories
Other

- Supports uv/uvx for Python environment management
- Offers SSE and streamable HTTP URL modes
- Provides configuration examples for multiple MCP tools
- Supports stdio, SSE, and streamable HTTP transports
- Includes environment variable configuration for excel-mcp-server
- Uses Bearer token authentication for remote MCP services

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Mcp_server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Run the MCP service with uv run --with mcp[cli] mcp run path/to/mcp.py or uvx --with pillow --with mcp[cli] fastmcp run path/to/mcp.py. The service listens on port 8000 by default, offering SSE at /sse and streamable HTTP at /mcp. Configure your MCP client with one of the three transport modes (stdio, SSE, streamable HTTP) and the appropriate URL or command/args.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp_server": {
            "mcp-server-hfhfn": {
                "command": "uv",
                "args": [
                    "run",
                    "--with",
                    "mcp[cli]",
                    "mcp",
                    "run",
                    "path/to/mcp.py"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-server-hfhfn": {
        "command": "uv",
        "args": [
            "run",
            "--with",
            "mcp[cli]",
            "mcp",
            "run",
            "path/to/mcp.py"
        ]
    }
}

使用uv管理python环境

- uv启动mcp服务的python脚本

uv run --with mcp[cli] mcp run path/to/mcp.py

- uvx启动mcp服务的python脚本

uvx --with pillow --with mcp[cli] fastmcp run path/to/mcp.py

启动单个mcp服务 sse和streamable-http两种模式的URL路径

# sse 模式
http://127.0.0.1:8000/sse  # 默认8000端口
http://host.docker.internal:8000/sse  # docker容器内访问

streamable-http 模式

http://127.0.0.1:8000/mcp # 默认8000端口 http://host.docker.internal:8000/mcp # docker容器内访问

使用mcp工具的多种基本配置示例参考:

// 涉及3种模式:stdio,sse,streamable_http
{
  // streamable_http模式
  "mcpServers": {
    "math": {
      "transport": "streamable_http",
      "url": "http://127.0.0.1:8000/mcp"
    },
    // sse模式
    "weather": {
      "transport": "sse",
      "url": "http://127.0.0.1:8000/sse"
    },
    "12306-mcp": {
      "type": "sse",
      "url": "https://mcp.api-inference.modelscope.cn/sse/76ee2dbba8d74f"
    },
    "sequentialthinking": {
      "headers": {
        "Accept": "application/json, text/event-stream",
        "Authorization": "Bearer 0e51a8cd-e77f-072ec3f3d161"
      },
      "url": "https://mcp.api-inference.modelscope.cn/sse/bb19488b5bc049"
    },
    // 本地服务 stdio模式
    "quickchart-server": {
      "isActive": true,
      "command": "cmd",
      "args": [
        "/c",
        "npx",
        "-y",
        "@gongrzhe/quickchart-mcp-server"
      ],
      "name": "quickchart-server"
    },
    "excel-mcp-server": {
      "isActive": true,
      "command": "cmd",
      "args": [
        "/c",
        "npx",
        "--yes",
        "@zhiweixu/excel-mcp-server"
      ],
      "env": {
        "LOG_PATH": "C:\\Users\\username\\Desktop\\temp",
        "CACHE_MAX_AGE": "1",
        "CACHE_CLEANUP_INTERVAL": "4",
        "LOG_RETENTION_DAYS": "7",
        "LOG_CLEANUP_INTERVAL": "24"
      },
      "name": "excel-mcp-server"
    }
  }
}
---

STDIO 模式启动说明

如果需要在客户端以 stdio 模式启动本项目:

1. 环境准备
在项目根目录下运行以下命令,安装 MCP 命令行工具:

uv add "mcp[cli]"

2. 启动配置
在配置客户端时,使用 uv 作为命令,并配合 --directory 参数指定项目路径。
- 命令: uv
- 参数: ["--directory", "/Users/hfhfn/charmProjects/mcp_server/", "run", "main.py"]

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.