mcp-elicitation-proxy

mcp-elicitation-proxy

Let existing MCP servers ask for missing required tool arguments through MCP elicitation, without changing the upstream server.

Category
访问服务器

README

mcp-elicitation-proxy

PyPI version Python versions License: MIT

A transparent MCP proxy that adds elicitation for missing required tool arguments while preserving upstream tool discovery and schemas.

mcp-elicitation-proxy is a standalone Python MCP proxy built on FastMCP. It preserves native upstream tool discovery while adding tool-call middleware for required-field elicitation and sensitive required-field blocking.

The core architectural rule is strict: upstream discovery stays native. The proxy must preserve upstream tools/list output instead of replacing it with a synthetic wrapper such as call_upstream_tool.

Install

Run directly with uvx:

uvx mcp-elicitation-proxy --config config.yaml

For development from a local checkout, use the development setup steps below.

Development Setup

uv sync

Run tests:

uv run pytest -q

Optional lint:

uv run ruff check .

Build artifacts can be produced with uv build. Local outputs under dist/ are not intended to be committed.

Configuration

Example config.yaml with an HTTP upstream:

proxy:
  name: "mcp-elicitation-proxy"

upstream:
  url: "http://localhost:8001/mcp"

elicitation:
  enabled: true
  fallback_on_unsupported: "structured_error"

policies:
  schema_required:
    enabled: true
  sensitive_required:
    enabled: true

tools:
  search_docs:
    required:
      - query
      - project
    elicit:
      message: "Provide the missing search details."
      fields:
        project:
          type: "string"
          description: "Project or scope to search."

Example config.yaml with a command-based upstream:

proxy:
  name: "mcp-elicitation-proxy"

upstream:
  command: "npx"
  args:
    - -y
    - "@modelcontextprotocol/server-everything"

upstream.url and upstream.command are mutually exclusive. Exactly one must be configured. upstream.args defaults to an empty list and is valid only with upstream.command. Command-based upstreams may also provide string environment variables with upstream.env.

Run the proxy:

uv run mcp-elicitation-proxy --config config.yaml

You can also provide the config path via MCP_ELICITATION_PROXY_CONFIG.

MCP Client Configuration

When configuring an MCP client, use mcp-elicitation-proxy as the package and CLI command. The local MCP client server alias can be shorter; the recommended alias is elicitation-proxy.

{
  "mcpServers": {
    "elicitation-proxy": {
      "command": "uvx",
      "args": [
        "mcp-elicitation-proxy",
        "--config",
        "/path/to/config.yaml"
      ]
    }
  }
}

In this example, elicitation-proxy is only the client-local server alias. mcp-elicitation-proxy remains the PyPI package name and CLI command. These names do not need to match. If desired, the proxy's own MCP server name can also be set separately in YAML:

proxy:
  name: "elicitation-proxy"

Discovery Invariants

  • Upstream tools remain visible in native tools/list.
  • The proxy does not register a generic call_upstream_tool.
  • Tool names are not prefixed with values such as upstream_.
  • Tool names, descriptions, and input schemas remain the upstream values unless an explicit future discovery feature changes that contract.

The upstream server is delegated to FastMCP native proxying via fastmcp.server.create_proxy(...).

Required Fields And Elicitation

schema_required uses native upstream JSON Schema required fields. Per-tool tools.<tool_name>.required entries are added at runtime for tools/call validation only. Schema-required fields keep their original order, then configured fields are appended without duplicates.

When elicitation.enabled is true, missing non-sensitive required fields may be requested with the client's MCP elicitation capability and merged into the original arguments before forwarding upstream. If elicitation is disabled, unsupported, declined, cancelled, or fails, the proxy returns a structured result instead of calling the upstream tool.

The sensitive_required policy runs before normal required-field elicitation. If a missing required field appears to be a credential or secret, the proxy blocks form-mode elicitation and returns a structured tool_call_blocked result. Complete explicit input is still forwarded.

ambiguous_if and confirm_if settings are parsed for forward-compatible configuration, but advanced ambiguity, confirmation, and LLM-based policies are not implemented in v0.1.0.

Manual Smoke Test With MCP Inspector

A repeatable manual test is available with MCP Inspector and the official @modelcontextprotocol/server-everything reference server.

npx @modelcontextprotocol/inspector -- uv run mcp-elicitation-proxy --config examples/manual-everything.config.yaml

This test verifies command-based upstream startup, native upstream tool discovery, forwarding, elicitation for missing required fields, sensitive-required blocking, and upstream.env propagation.

Expected high-level checks:

  • echo is visible as an upstream tool;
  • call_upstream_tool is not present;
  • tool names are not prefixed with upstream_;
  • calling echo with a complete message is forwarded;
  • calling echo without message triggers elicitation;
  • configured elicitation copy from examples/manual-everything.config.yaml is used;
  • marking a missing required field as sensitive blocks elicitation;
  • the configured environment variable is visible to the upstream environment tool.

See docs/manual-inspector-test.md for details.

Status

v0.1.0 is the first public-ready baseline. It includes a single-upstream FastMCP proxy, native discovery preservation, required-field elicitation, sensitive required-field blocking, command-based upstream startup, YAML configuration, and automated coverage for the main proxy invariants.

推荐服务器

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

官方
精选