mcpbridge

mcpbridge

Turns a YAML config file into an MCP server, enabling database queries, REST API calls, and knowledge base access without coding.

Category
访问服务器

README

mcpbridge

One YAML file. Any data source. Instant MCP server.

npm version License: MIT CI

mcpbridge turns a YAML config file into a working MCP server — no code required.

Point it at a database, a REST API, or a folder of Markdown files. Claude (or any MCP client) can query them immediately.


What It Does

  • db_query — run parameterized SQL queries against PostgreSQL, SQLite, or MySQL
  • get_endpoint — call any REST GET endpoint and expose the result as an MCP tool
  • knowledge_base — serve .md files or directories as MCP resources

All three can live in a single config.yaml. Swap the YAML, restart — done.


5-Minute Quickstart

With npx (no install)

# 1. Create a config file
cat > config.yaml << 'EOF'
server:
  name: weather-mcp
  version: 1.0.0
  transport: stdio

sources:
  - type: get_endpoint
    name: get_weather
    description: >
      Returns current weather for a location given latitude and longitude.
      Use when the user asks about weather or temperature.
    url: https://api.open-meteo.com/v1/forecast
    query_params:
      - name: latitude
        type: float
        required: true
      - name: longitude
        type: float
        required: true
    response_field: current_weather
EOF

# 2. Validate it
npx mcpbridge validate config.yaml

# 3. Add to Claude Desktop (see below) and ask: "What's the weather in Amsterdam?"

With Docker

docker run \
  -v ./config.yaml:/app/config.yaml \
  --env-file .env \
  mcpbridge/mcpbridge

Claude Desktop Setup

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "my-server": {
      "command": "npx",
      "args": ["mcpbridge", "run", "/absolute/path/to/config.yaml"],
      "env": {
        "DATABASE_URL": "postgresql://user:pass@localhost/mydb"
      }
    }
  }
}

YAML Reference

db_query — SQL query as MCP tool

- type: db_query
  name: get_orders               # snake_case, becomes tool name
  description: >                 # LLM reads this — be specific about when to use it
    Returns all orders for a specific user.
    Use when asked about order history or purchases.
  query: >
    SELECT id, product, amount, status
    FROM orders
    WHERE user_id = :user_id
  params:
    - name: user_id
      type: integer              # string | integer | boolean | float
      required: true
  connection: "${DATABASE_URL}"  # always an env var — never hardcode
  allow_write: false             # default: false — set true only for explicit write tools

Supported databases: PostgreSQL (postgresql://), MySQL (mysql://), SQLite (sqlite://./path.db)

Read-only by default. INSERT/UPDATE/DELETE/DROP are blocked unless allow_write: true. DDL (DROP/ALTER/CREATE) is always blocked.


get_endpoint — REST GET as MCP tool

- type: get_endpoint
  name: get_weather
  description: >
    Returns current weather forecast for a given latitude and longitude.
    Use when the user asks about weather or temperature.
  url: https://api.open-meteo.com/v1/forecast
  query_params:
    - name: latitude
      type: float
      required: true
    - name: longitude
      type: float
      required: true
  headers:
    Authorization: "Bearer ${API_KEY}"   # env var substitution in headers too
  response_field: current_weather        # optional: extract nested field (dot notation)
  timeout: 30                            # seconds, default: 30

knowledge_base — Markdown files as MCP resources

- type: knowledge_base
  name: company_faq
  description: >
    Internal company FAQ and policies.
    Use when the user asks about company procedures or rules.
  path: ./kb/                    # file or directory (recursive)
  strategy: chunk                # full | chunk
  chunk_size: 800                # chars per chunk (default: 800)
  chunk_overlap: 100             # overlap between chunks (default: 100)

Hidden files (.hidden.md) and directories (.git/) are skipped automatically.


Full Example Config

server:
  name: my-company-mcp
  version: 1.0.0
  transport: stdio

sources:
  - type: get_endpoint
    name: get_weather
    description: >
      Returns current weather for a location.
      Use when the user asks about weather.
    url: https://api.open-meteo.com/v1/forecast
    query_params:
      - name: latitude
        type: float
        required: true
      - name: longitude
        type: float
        required: true
    response_field: current_weather

  - type: db_query
    name: get_orders
    description: >
      Returns orders for a specific user.
      Use when the user asks about their order history.
    query: "SELECT id, product, amount, status FROM orders WHERE user_id = :user_id"
    params:
      - name: user_id
        type: integer
        required: true
    connection: "${DATABASE_URL}"

  - type: knowledge_base
    name: company_faq
    description: >
      Company FAQ and internal policies.
      Use when the user asks about company procedures.
    path: ./kb/
    strategy: chunk
    chunk_size: 800

Running Locally

# Install
npm install -g mcpbridge
# or without installing:
npx mcpbridge

# Validate a config
mcpbridge validate config.yaml

# Run the server
DATABASE_URL=sqlite://./dev.db mcpbridge run config.yaml

Running with Docker

# Build locally
docker build -t mcpbridge .

# Run with a config
docker run \
  -v ./config.yaml:/app/config.yaml \
  -v ./kb:/app/kb \
  --env-file .env \
  mcpbridge

# Or with docker-compose (includes PostgreSQL)
docker compose up

Security Notes

  • Secrets always via env vars. The YAML schema rejects connection strings not using ${ENV_VAR} syntax.
  • Read-only DB by default. Set allow_write: true explicitly per source to enable mutations.
  • DDL is never allowed. DROP/ALTER/CREATE/TRUNCATE are blocked regardless of allow_write.
  • No auth on the MCP server in v0.1 — run behind a firewall or VPN. Auth is on the v0.2 roadmap.

Let Claude Configure It For You

  1. Share your CLAUDE.md with Claude (or just point Claude at this repo)
  2. Say: "Configure mcpbridge for my [restaurant / e-commerce store / SaaS app]. Here's what it does: ..."
  3. Claude generates a complete config.yaml and .env.example
  4. Run mcpbridge validate config.yaml to verify, then deploy

Contributing

See CONTRIBUTING.md.

Roadmap

See ROADMAP.md.

License

MIT — see LICENSE.

推荐服务器

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

官方
精选