Skip to main content

MCP server for closing running applications by process name

Project description

FastMCP App Closer

MCP 服务器,用于关闭正在运行的应用程序。

功能特性

  • 🔍 智能进程查找 - 支持模糊匹配进程名
  • 🎯 别名支持 - 内置常见应用别名(微信、飞书、钉钉等)
  • 🛡️ 安全保护 - 防止关闭系统关键进程
  • 🌍 跨平台 - 支持 Windows、macOS、Linux

Installation

From PyPI (Recommended)

pip install fastmcp-app-closer

From Source

git clone https://github.com/yourusername/fastmcp-app-closer.git
cd fastmcp_app_closer
pip install -e .

使用方法

启动 MCP 服务器

fastmcp-app-closer

可用工具

1. close_app - 关闭应用

关闭指定名称的应用程序。

参数:

  • appName (string, required) - 应用名称或进程名

示例:

{
  "tool": "close_app",
  "arguments": {
    "appName": "微信"
  }
}

支持的匹配方式:

  • 精确匹配:WeChat.exe
  • 模糊匹配:wechatWeChat
  • 别名匹配:微信weixin

2. list_running_apps - 列出运行的应用

列出所有正在运行的应用程序。

示例:

{
  "tool": "list_running_apps"
}

支持的应用别名

应用名 别名
微信 wechat, weixin, wechat.exe
飞书 lark, feishu, lark.exe
钉钉 dingtalk, dingtalk.exe
QQ qq.exe, qqprotect.exe
QQ音乐 qqmusic, qqmusicexternal
网易云音乐 cloudmusic, neteasecloudmusic
日历 (macOS) calendar
备忘录 (macOS) notes

更多别名请查看 ALIAS_GUIDE.md

故障排除

应用无法识别?

如果遇到 "No matching process found" 错误:

  1. 查看实际进程名

    # Windows
    Get-Process | Select-Object Name
    
    # macOS/Linux
    ps aux | grep -i "app_name"
    
  2. 添加自定义别名

    编辑 src/app_closer_mcp/aliases.py,在 PROCESS_ALIASES 中添加:

    "应用中文名": {"actual_process_name"},
    
  3. 使用实际进程名

    直接使用进程名而不是应用名:

    {"appName": "qqmusic"}  // 而不是 "QQ音乐"
    

详细指南请参考 ALIAS_GUIDE.md

安全限制

以下系统关键进程无法被关闭:

  • Windows: explorer.exe, winlogon.exe, csrss.exe, services.exe, svchost.exe
  • macOS: Finder, WindowServer, loginwindow
  • Linux: systemd, init, Xorg

开发

运行测试

pip install -e ".[dev]"
pytest

代码格式化

black src/
ruff check src/

许可证

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastmcp_app_closer-0.1.2.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastmcp_app_closer-0.1.2-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file fastmcp_app_closer-0.1.2.tar.gz.

File metadata

  • Download URL: fastmcp_app_closer-0.1.2.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for fastmcp_app_closer-0.1.2.tar.gz
Algorithm Hash digest
SHA256 37fa1f89f2174296d1161e440d819ed7ebe4ebbe794aae698e3b2531f5fbeaf0
MD5 6728c73260a456a1e40feb708dd1cb97
BLAKE2b-256 ad0a8c283905b785d54412fd6cf38702255dcebaef0f1d5d01ea48b2de165bcc

See more details on using hashes here.

File details

Details for the file fastmcp_app_closer-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for fastmcp_app_closer-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d07146b9814f9711d20a51e3cd674ae26434b7eb9f65c9730d9d790fa2821a55
MD5 456417f63c262fbd49c5d26d11261ecf
BLAKE2b-256 a6c6a9d128d82f46b12343b8b8cd1a12f86b1e8dd8e839daf57bc3be46fe30df

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page