Skip to main content
Glama

MCP 服务器

一个使用 FastAPI 构建的模块化模型上下文协议 (MCP) 服务器,为 LLM 交互提供工具。

功能特性

  • 模块化架构 - 每个工具都易于维护

  • 文件操作 - 读取、写入、追加、替换和插入文件中的文本

  • 网络搜索 - 使用 DDGS 进行实时网络搜索

  • URL 获取 - 抓取并总结网页内容

  • 命令执行 - 在沙箱环境中运行 shell 命令

  • 严格隔离 - 使用 Bubblewrap 沙箱和一次性 /tmp 目录

Related MCP server: mcp-toolkit

工具

工具

描述

today

获取今天的日期和时间

add

将两个数字相加

web_search

搜索实时网络信息

fetch_content

抓取 URL 并提取内容

list_files

列出文件和目录

read_file

使用基于行的窗口读取文件

write_file

将文本写入文件

append_to_file

将文本追加到现有文件

replace_in_file

在文件中查找并替换文本

insert_after_marker

在标记行后插入文本

run_command

在沙箱中执行 shell 命令

安装

# Clone the repository
git clone <repository-url>
cd mcp_server

# Install dependencies using uv
uv sync

使用方法

# Start the server
python main.py

服务器将在 http://0.0.0.0:8000 启动。

架构

mcp_server/
├── main.py              # FastAPI application entry point
├── tools.json           # Tool definitions (JSON schema)
└── tools/               # Tool implementations
    ├── __init__.py      # Exports all handlers
    ├── add.py           # Math operations
    ├── today.py         # Date/time
    ├── web_search.py    # Web search
    ├── fetch_content.py # URL scraping
    ├── files.py         # All file operations
    └── run_command.py   # Shell command execution

沙箱配置

run_command 工具使用 bubblewrap 进行隔离:

  • 只读根文件系统 (--ro-bind / /)

  • 一次性临时目录 (--tmpfs /tmp)

  • 可写资源目录 (--bind resources resources)

  • 启用 DNS 解析 (无 /etc 限制)

免责声明

本项目是在阿里巴巴集团通义实验室的大型语言模型 Qwen 3.6 的协助下开发的。虽然 AI 协助了代码生成、文档编写和重构,但所有技术决策和最终实现均由人类开发者审查和验证。

许可证

MIT 许可证

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      A general-purpose MCP server providing web search, persistent memory storage, and secure code execution capabilities. It enables AI agents to search the web, store and retrieve data, and run Python/JavaScript code in sandboxed environments.
      8
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A comprehensive MCP server enabling LLMs to execute commands, manage files, interact with Figma, search the web, generate images, and more, extending their capabilities beyond text generation.
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      A secure, production-grade MCP server that provides filesystem operations, AST math evaluation, and system diagnostics for LLM agents.
      MIT