Koncile MCP服务器
一 MCP(模型上下文协议) 包装Koncile公共API的服务器,允许AI助手与Koncile本地交互-上传文档、检查提取状态、管理文件夹/模板/字段等。
适用于任何兼容MCP的客户端:Claude Code、Claude Desktop、Cursor、Windsurf、Cline等。
快速入门
无需安装-使用API密钥直接连接到托管服务器:
# Claude Code
claude mcp add --transport http koncile https://mcp.koncile.ai/mcp \
--header "Authorization: Bearer your-api-key"对于其他MCP客户端,请使用URL https://mcp.koncile.ai/mcp 在 Authorization 头球
本地安装
# From source
git clone https://github.com/Koncile/koncile-mcp.git
cd koncile-mcp
pip install -e .
# Or directly
pip install koncile-mcp配置
服务器需要一个 KONCILE_API_KEY 以通过Koncile API进行身份验证。您可以通过两种方式提供它:
选项1:配置文件(推荐)
创建 ~/.config/koncile/config:
mkdir -p ~/.config/koncile
echo "KONCILE_API_KEY=your-api-key" > ~/.config/koncile/config
chmod 600 ~/.config/koncile/config选项2:环境变量
export KONCILE_API_KEY=your-api-key环境变量优先于配置文件。
克劳德代码
claude mcp add --transport stdio koncile -- koncile-mcp如果使用环境变量方法而不是配置文件:
claude mcp add --transport stdio -e KONCILE_API_KEY=your-api-key koncile -- koncile-mcp克劳德桌面版
添加到您的Claude桌面配置(~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"koncile": {
"command": "koncile-mcp"
}
}
}如果使用环境变量方法而不是配置文件:
{
"mcpServers": {
"koncile": {
"command": "koncile-mcp",
"env": {
"KONCILE_API_KEY": "your-api-key"
}
}
}
}可用工具(共24个)
核心文档工作流程
| 工具 | 说明 |
|---|---|
upload_file | 上传一个文件(通过本地路径或base64)进行提取。返回任务ID。 |
get_task_status | 轮询上载任务的处理状态。 |
list_documents | 列出文档ID,可选择按日期范围筛选。 |
get_document_data | 获取文档的提取字段和行项目。 |
list_folders | 列出所有文件夹及其模板。 |
文件夹管理
| 工具 | 说明 |
|---|---|
get_folder | 获取文件夹详细信息和模板。 |
create_folder | 创建一个新文件夹。 |
update_folder | 更新文件夹名称/描述。 |
delete_folder | 删除文件夹。 |
模板管理
| 工具 | 说明 |
|---|---|
get_template | 获取模板详细信息、字段ID、指令ID。 |
create_template | 创建新模板(可选择从现有模板复制)。 |
update_template | 更新模板名称/描述。 |
delete_template | 删除模板。 |
田间管理
| 工具 | 说明 |
|---|---|
get_field | 获取字段详细信息。 |
create_field | 创建一个字段(类型:“常规字段”或“行字段”)。 |
update_field | 更新字段属性。 |
delete_field | 删除字段。 |
指令管理
| 工具 | 说明 |
|---|---|
get_instruction | 获取指令详细信息。 |
create_instruction | 为模板创建指令。 |
update_instruction | 更新指令内容/类型。 |
delete_instruction | 删除指令。 |
公用事业
| 工具 | 说明 |
|---|---|
check_api_key | 验证API密钥的有效性。 |
download_file | 下载原始文件(返回base64)。 |
delete_document | 删除文档。 |
工作流示例
典型的文档提取工作流程:
- 上传:使用
upload_file具有本地文件路径(或base64编码内容)→ gettask_id - 投票:呼叫
get_task_status随着task_id直到状态为DONE - 阅读:使用
get_document_data检索提取的字段和行项目
User: Upload this invoice and extract the data
Claude: [calls upload_file with file_path="/path/to/invoice.pdf"] → task_id: "abc-123"
Claude: [calls get_task_status] → status: "PROCESSING"
Claude: [calls get_task_status] → status: "DONE", document_id: 42
Claude: [calls get_document_data] → General_fields: {vendor: "Acme", total: "1,234.56"}, Line_fields: [...]自足执行
您可以将MCP服务器作为自己的HTTP服务运行:
# Run the HTTP server (default: 0.0.0.0:8080)
koncile-mcp-server
# Custom host/port
HOST=127.0.0.1 PORT=3000 koncile-mcp-server
# Or via Docker
docker build -t koncile-mcp .
docker run -p 8080:8080 -e KONCILE_API_URL=https://api.koncile.ai koncile-mcp客户端使用其Koncile API密钥作为承载令牌进行身份验证:
claude mcp add --transport http koncile https://your-host:8080/mcp \
--header "Authorization: Bearer your-api-key"发展
pip install -e ".[dev]"
pytestMCP检验员测试
KONCILE_API_KEY=your-key \
npx @modelcontextprotocol/inspector koncile-mcp
# Or against local dev API:
KONCILE_API_URL=http://localhost:8000 KONCILE_API_KEY=your-key \
npx @modelcontextprotocol/inspector koncile-mcp许可证
麻省理工学院
