Token导航 LogoToken导航TokenDH.com
Mcpo Enhanced logo
AI代理stdio官方级别未说明来源级核验

Mcpo Enhanced

MCP Server

MCP转OpenAPI代理增强版是一款提供配置分析、智能路由和性能基准测试的工具,用于将模型上下文协议服务器桥接到REST API端点。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
PythonAPI集成AI代理

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Rlin1027

提供方

Rlin1027

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -e . # Install original mcpo

详细介绍

mcpo增强

增强版 mcpo (3.9k星)-MCP-to-OpenAPI代理服务器,将模型上下文协议服务器桥接到REST API端点。

此包添加 配置分析, 智能路由,以及 性能基准测试 工具,同时保持所有原始mcpo文件不变。

最新动态

1.配置分析(analysis.py)

通过安全审计对mcpo服务器配置进行深入检查。

from mcpo_enhanced import ConfigAnalyzer, SecurityAnalyzer, ToolSchemaAnalyzer

config = {
    "mcpServers": {
        "filesystem": {
            "command": "npx",
            "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
        },
        "web": {
            "type": "sse",
            "url": "http://localhost:8080/sse"
        }
    }
}

# Analyze configuration structure
analyzer = ConfigAnalyzer(config)
print(analyzer.server_count())        # 2
print(analyzer.transport_types())     # {'stdio': 1, 'sse': 1}
print(analyzer.list_server_names())   # ['filesystem', 'web']

# Security audit
security = SecurityAnalyzer(config)
report = security.full_audit()
print(report["risk_score"])           # 0-10 risk rating
print(report["api_key_analysis"])     # Key strength assessment

# Tool schema analysis
tools = [{"name": "read_file", "inputSchema": {"type": "object", "properties": {"path": {"type": "string"}}}}]
schema_analyzer = ToolSchemaAnalyzer(tools)
print(schema_analyzer.complexity_scores())     # Per-tool complexity 0-10
print(schema_analyzer.detect_dangerous_tools()) # Flags risky operations

课程: ServerConfig, ConfigAnalyzer, ToolSchemaAnalyzer, SecurityAnalyzer, ConnectionAnalyzer

2.智能路由(routing.py)

智能工具过滤、服务器路由和配置生成。

from mcpo_enhanced import ToolFilter, ServerRouter, ConfigGenerator

tools = [
    {"name": "read_file", "inputSchema": {"type": "object", "properties": {"path": {"type": "string"}}}},
    {"name": "execute_sql", "inputSchema": {"type": "object", "properties": {"query": {"type": "string"}, "db": {"type": "string"}}}},
    {"name": "list_dir", "inputSchema": {"type": "object", "properties": {}}},
]

# Filter tools by criteria
tf = ToolFilter(tools)
safe_tools = tf.exclude_dangerous()          # Remove risky tools
simple = tf.filter_by_max_params(1)          # Tools with  "fs"

# Generate optimized configurations
gen = ConfigGenerator(config)
minimal = gen.generate_minimal()         # Strip optional fields
secured = gen.with_api_key("my-key")     # Add authentication

课程: ToolFilter, ServerRouter, ConfigGenerator, EndpointOptimizer, RoutingAnalyzer

3.绩效基准(benchmark.py)

估算代理开销,比较配置,并计划容量。

from mcpo_enhanced import SchemaComplexityMetrics, TransportBenchmark, CapacityEstimator

tools = [
    {"name": "simple_tool", "inputSchema": {"type": "object", "properties": {"x": {"type": "string"}}}},
    {"name": "complex_tool", "inputSchema": {"type": "object", "properties": {
        "query": {"type": "string"}, "filters": {"type": "object"},
        "options": {"type": "array", "items": {"type": "string"}}
    }}}
]

# Measure schema complexity
metrics = SchemaComplexityMetrics(tools)
scores = metrics.complexity_scores()          # Per-tool 0-10
print(metrics.histogram(bins=5))              # Distribution
print(metrics.rank_by_complexity()[:3])        # Top 3 complex tools

# Compare transport performance
bench = TransportBenchmark()
comparison = bench.compare_transports()       # stdio vs sse vs http
print(bench.recommend_transport(tool_count=50, concurrent_users=10))

# Estimate capacity
config = {"mcpServers": {"a": {"command": "a"}, "b": {"type": "sse", "url": "http://x"}}}
estimator = CapacityEstimator(config, tools)
print(estimator.estimate_memory_mb())         # Memory estimate
print(estimator.estimate_endpoints())         # Endpoint count
print(estimator.scaling_recommendations(target_rps=100))

课程: SchemaComplexityMetrics, TransportBenchmark, CapacityEstimator, ConfigComparator, ProxyOverheadEstimator

安装

git clone https://github.com/Rlin1027/mcpo-enhanced.git
cd mcpo-enhanced
pip install -e .     # Install original mcpo

测试

python3 -m pytest tests/ -v

3个模块共159个测试:

  • test_analysis.py --44次测试
  • test_routing.py --52次测试
  • test_benchmark.py --63测试

项目结构

mcpo-enhanced/
  src/mcpo/              # Original mcpo source (untouched)
  mcpo_enhanced/         # New enhancement package
    __init__.py          # 15 public classes
    analysis.py          # Configuration & security analysis
    routing.py           # Tool filtering & server routing
    benchmark.py         # Performance benchmarking
  tests/
    test_analysis.py     # 44 tests
    test_routing.py      # 52 tests
    test_benchmark.py    # 63 tests

许可证

MIT许可证(与原始mcpo相同)

目录标签

目录标签

PythonAPI集成AI代理配置分析本地部署智能路由性能基准测试RESTAPI模型上下文协议

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP