证据报告生成服务

一个提供AI助手工具以帮助用户创建证据报告和仪表板的MCP服务器。

  • by jaho5
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 jaho5/evidence-mcp

使用说明

证据MCP服务器

MCP(模型上下文协议)服务器,为AI助手提供工具,帮助用户创建证据报告和仪表板。

安装

# Clone and install
git clone https://github.com/jaho5/evidence-mcp.git
cd evidence-mcp
uv sync

用法

# Run the MCP server
uv run evidence-mcp

# With custom Evidence project path
EVIDENCE_MCP_EVIDENCE_PROJECT_PATH=/path/to/project uv run evidence-mcp

配置

环境变量:

变量 默认值 描述
EVIDENCE_MCP_EVIDENCE_DEV_URL http://localhost:3000 证据开发服务器URL
EVIDENCE_MCP_EVIDENCE_PROJECT_PATH - 证据之路项目
EVIDENCE_MCP_TRANSPORT stdio 运输方式:stdio、sse

工具

获取元数据

从Evidence的DuckDB连接返回数据库架构。

read_docs

使用层次查找检索证据文档。

edit_page

建议更改当前的证据标记页面。

debug_code

分析验证错误并提出修复建议。


Claude代码设置

添加到您的Claude Code MCP设置中(~/.claude.json):

{
  "mcpServers": {
    "evidence-mcp": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/evidence-mcp", "evidence-mcp"],
      "env": {
        "EVIDENCE_MCP_EVIDENCE_PROJECT_PATH": "/path/to/your/evidence/project"
      }
    }
  }
}

或者通过CLI添加:

claude mcp add evidence-mcp -- uv run --directory /path/to/evidence-mcp evidence-mcp

要验证安装:

claude mcp list

Claude桌面设置

添加到Claude桌面配置(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS或 %APPDATA%\Claude\claude_desktop_config.json 在Windows上):

{
  "mcpServers": {
    "evidence-mcp": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/evidence-mcp", "evidence-mcp"],
      "env": {
        "EVIDENCE_MCP_EVIDENCE_PROJECT_PATH": "/path/to/your/evidence/project"
      }
    }
  }
}

程序化使用(MCP客户端)

import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

async def main():
    server_params = StdioServerParameters(
        command="uv",
        args=["run", "--directory", "/path/to/evidence-mcp", "evidence-mcp"],
        env={
            "EVIDENCE_MCP_EVIDENCE_PROJECT_PATH": "/path/to/your/evidence/project"
        }
    )

    async with stdio_client(server_params) as (read, write):
        async with ClientSession(read, write) as session:
            # Initialize the connection
            await session.initialize()

            # List available tools
            tools = await session.list_tools()
            print("Available tools:", [t.name for t in tools.tools])

            # Call get_metadata
            result = await session.call_tool("get_metadata", arguments={})
            print("Metadata:", result.content)

            # Call read_docs
            result = await session.call_tool("read_docs", arguments={
                "doc_type": "charts",
                "component": "LineChart"
            })
            print("Docs:", result.content)

asyncio.run(main())

使用OpenAI代理SDK

首先,在SSE模式下运行服务器:

EVIDENCE_MCP_TRANSPORT=sse \
EVIDENCE_MCP_EVIDENCE_PROJECT_PATH=/path/to/your/evidence/project \
uv run evidence-mcp

然后使用 HostedMCPTool 要连接:

from agents import Agent, HostedMCPTool

agent = Agent(
    name="Evidence Assistant",
    instructions="Help users create Evidence reports and dashboards.",
    tools=[
        HostedMCPTool(
            tool_config={
                "type": "mcp",
                "server_label": "evidence",
                "server_url": "http://localhost:8000/sse",
                "require_approval": "never",
            }
        )
    ],
)

发展

# Install with dev dependencies
uv sync --extra dev

# Run tests
uv run pytest

# Run tests with coverage
uv run pytest --cov=evidence_mcp

# Lint
uv run ruff check

# Format
uv run ruff format