Swiftcode MCP Server

Swiftcode MCP Server

A Model Context Protocol server that automates code generation for web development, specializing in creating TypeScript API clients from Swagger/OpenAPI specs and Vue.js components for frontend development.

Category
访问服务器

README

Swiftcode MCP Server

Project Overview

Swiftcode MCP Server is a Model Context Protocol (MCP) server that provides automatic code generation capabilities for modern web development. This server focuses on generating TypeScript API clients from Swagger/OpenAPI specifications and Vue.js components for rapid frontend development.

Features

  • Swagger/OpenAPI to TypeScript: Automatically generate TypeScript API clients from Swagger specifications
  • Vue Component Generation: Create complete Vue 3 list pages with filters, tables, and pagination
  • Template Management: Access and utilize pre-built code generation templates
  • Code Validation: Validate Swagger/OpenAPI specifications before generation
  • Mock Data Generation: Optionally generate mock data for testing purposes

Tools

1. generate_api_client

Generate TypeScript API client from Swagger/OpenAPI specification.

Parameters:

  • swagger_url (string): URL to Swagger/OpenAPI JSON specification
  • swagger_content (string): Direct Swagger/OpenAPI JSON or YAML content
  • output_format (string): Output format ("typescript" or "javascript", default: "typescript")
  • include_types (boolean): Whether to generate TypeScript type definitions (default: true)

Example:

{
  "swagger_url": "https://api.example.com/swagger.json",
  "output_format": "typescript",
  "include_types": true
}

2. generate_vue_list

Generate Vue list page component with table and filters.

Parameters:

  • page_config (object): Page configuration with Chinese/English names and features
  • filters (object): Filter configuration for search functionality
  • table_columns (object): Table column definitions
  • generate_mock (boolean): Whether to generate mock data (default: false)

Example:

{
  "page_config": {
    "cn": "用户管理",
    "en": "userManagement",
    "select": true,
    "btn": ["新增", "删除"]
  },
  "filters": {
    "用户名": "input",
    "状态": "select",
    "创建时间": "daterange"
  },
  "table_columns": {
    "用户名": "text",
    "邮箱": "text",
    "创建时间": "time",
    "操作": {
      "type": "operate",
      "render": ["编辑", "删除"]
    }
  }
}

3. get_templates

Get available code generation templates.

Parameters:

  • template_type (string): Type of templates to retrieve ("vue-list", "api-client", or "all")

4. validate_swagger

Validate Swagger/OpenAPI specification.

Parameters:

  • swagger_url (string): URL to Swagger/OpenAPI specification
  • swagger_content (string): Direct Swagger/OpenAPI content

Prompts

The server provides several helpful prompts:

  • swiftcode_getting_started: Introduction guide to Swiftcode features
  • swagger_to_typescript: Detailed guide for Swagger to TypeScript conversion
  • vue_component_generation: Vue component generation guide and best practices
  • troubleshooting: Common issues and troubleshooting guide

Supported Technologies

Frontend Frameworks

  • Vue 3 with Composition API
  • Element Plus UI components
  • TypeScript support

API Specifications

  • Swagger 2.0
  • OpenAPI 3.0+
  • JSON and YAML formats

Generated Code Features

  • TypeScript interfaces and types
  • Vue 3 reactive components
  • Element Plus form and table components
  • Pagination and filtering
  • Mock data generation

Setup

NPX (Recommended)

Add to your MCP client configuration:

{
  "mcpServers": {
    "swiftcode-npm": {
      "command": "npx",
      "args": ["-y", "@swiftcode/mcp"]
    }
  }
}

Local Development

pnpm install

# 编译 mcp
ppm build

# 启动 mcp 调试器
pnpm inspector

Add to your MCP client configuration:

{
  "mcpServers": {
    // 本地开发
    "swiftcode-local": {
      "command": "node",
      "args": ["swiftcode-mcp-server/dist/index.js"]
    }
  }
}

Docker

# Build Docker image
docker build -t swiftcode-mcp .

# Run container
docker run -it swiftcode-mcp

Usage Examples

Generate API Client from Swagger URL

// Use the generate_api_client tool
{
  "swagger_url": "https://petstore.swagger.io/v2/swagger.json",
  "output_format": "typescript",
  "include_types": true
}

Generate Vue List Component

// Use the generate_sfc_client tool
{
  "page_config": {
    "cn": "产品列表",
    "en": "productList",
    "select": true,
    "top": true,
    "btn": ["新增产品", "批量删除"]
  },
  "filters": {
    "产品名称": "input",
    "分类": "select",
    "价格范围": {
      "type": "daterange",
      "range": [1, "m"]
    }
  },
  "table_columns": {
    "选择": "select",
    "序号": "index",
    "产品名称": "text",
    "价格": "text",
    "创建时间": "date",
    "操作": {
      "type": "operate",
      "fixed": "right",
      "render": ["编辑", "删除", "查看详情"]
    }
  },
  "generate_mock": true
}

Filter Types

  • input: Text input field
  • select: Dropdown selection
  • daterange: Date range picker
  • datetime: Date and time picker
  • date: Date picker only
  • datetimerange: Date and time range picker

Table Column Types

  • text: Plain text column
  • time/date: Formatted date/time column
  • select: Selection checkbox column
  • index: Auto-incrementing index column
  • operate: Action buttons column
  • option: Enum/status column
  • link: Clickable link column
  • tag: Tag/badge column

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

This project is licensed under the MIT License. See the LICENSE file for details.

Support

For questions, issues, or feature requests, please visit the GitHub repository or contact the development team.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选