使用说明
JMAP-MCP服务器
一种基于Python的服务器,将模型上下文协议(MCP)与JMAP(JSON邮件访问协议)连接起来,通过MCP客户端实现基本的电子邮件操作。
我为个人使用而构建了这个,但欢迎其他人尝试。
设置
确保你有 紫外线 以及JMAP服务器的有效API令牌。
1.设置回购
克隆仓库并运行
uv pip install pyproject.toml
2.将MCP服务器配置添加到您的客户端。
{
"mcpServers": {
"emails": {
"env": {
"JMAP_API_TOKEN": "your-api-token"
},
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/.../jmap-mcp",
"uv",
"run",
"jmap-mcp-server"
]
}
}
}
调试
错误发生了。您可以将MCP配置为写入调试日志以帮助解决问题。
{
"mcpServers": {
"emails": {
"env": {
"JMAP_API_TOKEN": "your-api-token",
"LOG_LEVEL": "DEBUG",
"LOG_FILE": "/path/to/log/jmap-mcp-debug.log"
},
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/.../jmap-mcp",
"uv",
"run",
"jmap-mcp-server",
]
}
}
}
测试
该项目包括支持单元测试和集成测试的测试。
单元测试
运行使用模拟响应的单元测试:
# Using pytest directly
pytest tests/ -m "not integration"
# Using the test runner script
python run_tests.py unit