MCP ExplorerExplorer

Typescript Ai Deepseek Mcp Demo

@freewind-demoson 10 months ago
1 MIT
FreeCommunity
AI Systems
A TypeScript demo using MCP protocol for AI programming tasks with DeepSeek.

Overview

What is Typescript Ai Deepseek Mcp Demo

typescript-ai-deepseek-mcp-demo is a TypeScript example project that demonstrates how to use the DeepSeek’s MCP (Model-Controlled Programming) protocol. MCP allows AI assistants to better control and execute programming tasks by understanding user requirements, planning solutions, executing code operations, and validating results.

Use cases

Use cases for typescript-ai-deepseek-mcp-demo include automating code review processes, providing intelligent suggestions for code improvements, and assisting developers in understanding complex programming requirements through AI-driven insights.

How to use

To run this project, you need a DeepSeek API key. First, install the required packages using ‘npm install’. Then, set your API key with ‘export DEEPSEEK_API_KEY=your-api-key’ and start the project with ‘npm start’. The example code illustrates how to create an MCP client, send code review requests, receive responses from the AI assistant, and execute suggested actions.

Key features

Key features of typescript-ai-deepseek-mcp-demo include the ability to define MCP requests and responses, manage context information, and handle various types of actions suggested by the AI assistant. It showcases a structured approach to integrating AI into programming tasks.

Where to use

typescript-ai-deepseek-mcp-demo can be used in software development environments where AI assistance is needed for code reviews, debugging, and automating programming tasks. It is suitable for developers looking to enhance their productivity with AI tools.

Content

AI DeepSeek MCP Demo

这是一个演示如何使用DeepSeek的MCP(Model-Controlled Programming)协议的TypeScript示例项目。

什么是MCP?

MCP(Model-Controlled Programming)是一种让AI助手能够更好地控制和执行编程任务的协议。它允许AI助手:

  1. 理解用户的编程需求
  2. 规划解决方案
  3. 执行必要的代码操作
  4. 验证执行结果

虽然这个示例使用DeepSeek作为实现,但MCP协议的思想是通用的,可以应用于其他AI模型。

项目结构

.
├── src/
│   ├── types.ts       # MCP相关的类型定义
│   ├── mcp-client.ts  # MCP客户端实现
│   └── index.ts       # 示例代码
├── package.json
├── tsconfig.json
└── README.md

安装

npm install

使用方法

要运行这个项目,你需要有DeepSeek的API密钥:

export DEEPSEEK_API_KEY=your-api-key
npm start

示例说明

示例代码展示了如何:

  1. 创建MCP客户端
  2. 发送代码审查请求
  3. 接收AI助手的响应
  4. 执行AI助手建议的操作

API说明

MCPRequest

interface MCPRequest {
  type: string;      // 请求类型
  content: string;   // 请求内容
  context?: {        // 上下文信息
    language?: string;
    framework?: string;
    [key: string]: any;
  };
}

MCPResponse

interface MCPResponse {
  status: 'success' | 'error';  // 响应状态
  message: string;              // 响应消息
  actions?: MCPAction[];        // AI建议的操作
  error?: string;              // 错误信息
}

MCPAction

interface MCPAction {
  type: string;               // 操作类型
  target: string;            // 操作目标
  content: string;           // 操作内容
  params?: Record<string, any>; // 操作参数
}

注意事项

  1. 请确保妥善保管DeepSeek API密钥
  2. 目前这只是一个演示项目,实际使用时需要根据具体需求扩展功能
  3. 建议在使用前仔细阅读DeepSeek的API文档

许可证

MIT

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers