Dixa MCP Server

Dixa MCP 服务器

Dixa API 的 FastMCP 服务器实现,提供用于管理对话和标签的资源和工具。

特征

  • 资源
    • 搜索对话
    • 获取对话详细信息
    • 获取对话记录
    • 获取对话消息
    • 获取可用标签
  • 工具
    • 为对话添加标签
    • 从对话中删除标签

项目结构

/src ├── dixa.ts # Main server setup ├── config.ts # Configuration and environment settings ├── types.ts # Shared types and error handling ├── resources/ # Resource implementations ├── schemas/ # Zod schemas for validation └── tools/ # Tool implementations

配置

服务器需要以下环境变量:

  • DIXA_API_KEY :您的 Dixa API 密钥
  • DIXA_API_BASE_URL (可选):覆盖默认 API URL(默认为“ https://dev.dixa.io/v1 ”)

用法

  1. 设置环境变量:
export DIXA_API_KEY='your-api-key'
  1. 启动服务器:
    npm start
## Running Your Server ### Test with `mcp-cli` The fastest way to test and debug your server is with `fastmcp dev`: ```bash npx fastmcp dev server.js npx fastmcp dev server.ts

这将使用mcp-cli运行您的服务器,以便在终端中测试和调试您的 MCP 服务器。

使用MCP Inspector进行检查

另一种方法是使用官方MCP Inspector通过 Web UI 检查您的服务器:

npx fastmcp inspect server.ts

常问问题

如何与 Claude Desktop 一起使用?

按照指南https://modelcontextprotocol.io/quickstart/user并添加以下配置:

{ "mcpServers": { "my-mcp-server": { "command": "npx", "args": [ "tsx", "/PATH/TO/YOUR_PROJECT/src/index.ts" ], "env": { "YOUR_ENV_VAR": "value" } } } }

发展

添加新资源

  1. src/schemas/中创建一个模式
  2. src/resources/中创建资源
  3. 将资源添加到src/dixa.ts

示例资源:

export const myResource = { uri: "dixa://my-resource", name: "My Resource", description: "Description", load: async (args: MyArgs, apiKey: string) => { // Implementation } };

添加新工具

  1. src/tools/中创建工具
  2. 将工具添加到src/dixa.ts

示例工具:

export const myTool = { name: "My Tool", description: "Description", execute: async (args: MyArgs, apiKey: string) => { // Implementation } };

错误处理

该项目使用自定义错误类:

  • DixaError :API 错误的基本错误类
  • DixaValidationError :响应验证失败

展示

[!笔记]

如果您使用 FastMCP 开发了服务器,请提交 PR来在此处展示它!

致谢

贡献

  1. 遵循现有的资源和工具模式
  2. 添加适当的 JSDoc 文档
  3. 使用types.tsconfig.ts中的共享实用程序
  4. 如果添加新功能,请更新 README
-
security - not tested
A
license - permissive license
-
quality - not tested

Dixa API 的 FastMCP 服务器实现,使 AI 助手能够搜索、检索和管理客户对话数据和标签。

  1. Features
    1. Project Structure
      1. Configuration
        1. Usage
          1. Inspect with MCP Inspector
        2. FAQ
          1. How to use with Claude Desktop?
        3. Development
          1. Adding a New Resource
          2. Adding a New Tool
        4. Error Handling
          1. Showcase
            1. Acknowledgements
              1. Contributing
                ID: pag7zu8nb8