Infra MCP logo

Infra MCP

Community
raintear94

Infra MCP 是一个独立运行的MCP Server,解决想让AI查询数据库,又怕AI删库,想让AI运维服务器,又怕AI乱删文件,不想暴露数据库/服务器Ip 账号密码给大模型的问题

Publisherraintear94
RepositoryInfraMCP
LanguageJavaScript
Forks
1
Stars
10
Available tools
0
Transport typestdio
Categories
Links
  • Connect tools to AI workflows

    Infra MCP exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    10 stars and 1 forks from the linked repository.

Infra MCP

Infra MCP 是一个独立运行的 HTTP MCP Server,用于让 AI 按项目隔离访问服务端配置的 MySQL、Redis 和部署环境 Linux 命令行。

真实连接信息只保存在用户空间目录 ~/.infra-mcp/infra-mcp.server.config.json 中。安装或首次启动时会自动生成 ~/.infra-mcp/infra-mcp.client.config.json 模板,业务项目根目录只需要复制并维护自己的 infra-mcp.client.config.json。客户端配置可以是多环境数组,也可以是单环境对象;每个环境里用 projectName 命名环境,并保存对应 projectKey 和给 Agent 工具看的 prompt;prompt 用于提供额外自然语言说明,不要保存数据库、Redis 或 SSH 密码。

功能说明

  • mysql_list_databases:列出当前 MySQL 账号可见数据库,最多返回 400 条。
  • mysql_list_tables:列出指定数据库的表,最多返回 400 条。
  • mysql_select:只允许执行单条 SELECT 查询,返回记录最多 400 条。
  • redis_query:只允许执行 Redis 只读命令白名单。
  • linux_exec:通过 SSH 执行结构化部署环境 Linux 命令;单命令传 program、args、cwd、explanation,多命令传 commands 数组,不要用 bash -lc 或 sh -c 包装多条命令。只读诊断命令命中白名单会直接执行,有副作用或未知命令会在网页控制台触发人工确认。
  • 网页控制台:访问 http://127.0.0.1:3120/console 查看 MySQL、Redis、Linux 三类输入输出,维护 Linux 风险类型审批策略,并通过动态表单编辑保存 ~/.infra-mcp/infra-mcp.server.config.json。

使用方式

  1. 安装 Node.js 20 或更高版本。

  2. 全局安装运行版包:

    powershell
    npm install -g infra-mcp-runtime
  3. 直接启动服务端:

    powershell
    infra

    infra 等同于 infra start,默认会在后台守护进程中运行,启动成功后终端可以关闭。安装完成后会自动执行初始化;首次启动时如果 ~/.infra-mcp 不存在模板文件,也会自动创建默认模板。

    服务管理命令:

    powershell
    infra start
    infra stop
    infra restart
    infra status
    infra log
    infra help

    其中 infra stop 用于停止后台服务,infra status 用于查看运行状态和进程 PID,infra restart 用于重启服务,infra log 用于查看最近日志,infra help 用于查看命令帮助。

    如果需要前台运行,可以使用:

    powershell
    infra --foreground

    前台运行时需要保持当前终端窗口打开;停止服务时按 Ctrl+C,或关闭当前终端窗口。

  4. 配置文件会保存在用户空间目录 ~/.infra-mcp 下。

    Windows 默认路径示例:

    text
    %USERPROFILE%\.infra-mcp\infra-mcp.server.config.json

    macOS / Linux 默认路径示例:

    text
    ~/.infra-mcp/infra-mcp.server.config.json

    客户端模板路径与它位于同一目录:

    text
    ~/.infra-mcp/infra-mcp.client.config.json
  5. 打开网页控制台配置服务端:

    text
    http://127.0.0.1:3120/console

    网页控制台的“配置”页会通过动态表单保存 ~/.infra-mcp/infra-mcp.server.config.json。这里配置 http 监听参数、projects、MySQL、Redis 和 Linux SSH 连接即可,不需要手动编辑服务端配置文件。

  6. 首次安装或启动后,会在 ~/.infra-mcp/infra-mcp.client.config.json 生成客户端模板。把它复制到需要使用 MCP 的业务项目根目录,再按项目和环境实际情况修改。多环境写成数组:

    json
    [
      {
        "projectName": "开发环境",
        "projectKey": "order-service-dev",
        "prompt": "这是给 Agent 工具使用的额外自然语言说明:当前环境用于开发调试,常用数据库为 order_dev,Redis key 通常以 order:dev: 开头;查询前先确认表含义,不要填写账号密码、token 等敏感信息。"
      },
      {
        "projectName": "生产环境",
        "projectKey": "order-service-prod",
        "prompt": "这是给 Agent 工具使用的额外自然语言说明:当前环境为生产环境,只做必要的只读排查;执行查询前说明目的并控制范围,不要填写账号密码、token 等敏感信息。"
      }
    ]

    只有一个环境时,也可以直接写成对象:

    json
    {
      "projectName": "生产环境",
      "projectKey": "order-service-prod",
      "prompt": "这是给 Agent 工具使用的额外自然语言说明:当前环境为生产环境,只做必要的只读排查;执行查询前说明目的并控制范围,不要填写账号密码、token 等敏感信息。"
    }
  7. 在 MCP 客户端中使用下面的 HTTP 地址连接本服务:

    text
    http://127.0.0.1:3120/mcp
  8. 使用工具前,Agent 应先读取当前业务项目根目录的 infra-mcp.client.config.json;如果配置是数组,则根据目标环境的 projectName 选择配置,如果配置是对象则直接使用;随后遵循所选配置的 prompt,再把 projectKey 传给 MCP 工具。prompt 是为了给 Agent 工具提供额外的自然语言说明,例如库表含义、Redis key 前缀、查询边界和环境注意事项。网页控制台的“配置”页只编辑服务端配置,不会替代业务项目根目录里的客户端配置。

Codex 配置方式

在 Codex 的用户配置文件中添加 Infra MCP 服务配置。Windows 默认路径为:

text
%USERPROFILE%\.codex\config.toml

示例:

toml
[mcp_servers.infra-mcp]
type = "streamable_http"
url = "http://127.0.0.1:3120/mcp"
startup_timeout_ms = 20000
tool_timeout_sec = 60
enabled = true

如果 ~/.infra-mcp/infra-mcp.server.config.json 中修改过 http.port 或 http.path,需要同步修改上面 url 的端口或路径。保存后重启 Codex,或在 Codex 中重新加载 MCP Server。使用前只需要保持 infra 启动的服务进程正在运行。

Codex 配置文件只写 MCP 服务地址,不写数据库、Redis 或 SSH 账号密码。每个业务项目仍需要在项目根目录放置 infra-mcp.client.config.json,其中每个配置项的 projectKey 必须和服务端 projects 中的 projectKey 一致。

安全说明

  • MySQL 只开放数据库列表、表列表和单条 SELECT 查询,不允许写入或 DDL。
  • Redis 只开放白名单内的只读命令。
  • Linux 自动执行只允许结构化命令格式化后的简单命令或只读白名单命令组成的管道。
  • Linux 命令包含 sudo、多语句、重定向、后台执行、命令替换、未知命令或疑似副作用操作时,会在网页控制台等待人工确认。
  • Linux 审批弹窗会按列表显示待执行命令和 Agent 提供的 explanation,触发审批的命令会用红色强调。
  • Linux 审批按风险类型控制,策略保存在用户空间目录的 ~/.infra-mcp/infra-mcp.approval-policy.json。在网页取消某个风险类型的“需要审批”后,同类型命令后续会按策略免审批执行。
  • 不要把 HTTP 服务监听到不可信网络。

Installation

TypingMind
{
  "mcpServers": {
    "inframcp": {
      "command": "infra",
      "args": []
    }
  }
}

Use Infra MCP MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Infra MCP is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Infra MCP as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Infra MCP MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "inframcp": {
      "command": "npx",
      "args": [
        "-y",
        "infra-mcp-runtime"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Infra MCP MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Infra MCP MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Infra MCP to help me with this task?
Infra MCP
Sure. I read it.
Here is what I found using Infra MCP.

Frequently asked questions

What is the Infra MCP MCP server used for?

Infra MCP is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Infra MCP MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Infra MCP with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Infra MCP MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Infra MCP connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Infra MCP MCP to TypingMind?

Infra MCP runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Infra MCP MCP provide in TypingMind?

Infra MCP exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Infra MCP MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Infra MCP requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇