AI流程本地运行服务

Wordware MCP是一个允许在本地开发环境中运行Wordware AI流程的服务,便于测试和开发集成Wordware功能的应用程序。

  • by hugobiais
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 yuhuangou/wordware-mcp

使用说明

文字软件mcp

Wordware MCP(模型上下文协议)服务器允许您在本地运行您的Wordware应用程序。这使您能够将Wordware强大的AI流直接集成到本地开发环境中,从而更容易测试和开发利用Wordware功能的应用程序。

1.1.5版本的新增功能

  • 已更新以使用新的本地API终结点(http://localhost:9000/{WORDWARE_API_TOKEN})
  • 无需再指定APP_ID-工具会自动发现
  • 交互式安装过程 npx wordware-mcp
  • 自动克劳德配置设置
  • 增强的CLI界面,支持命令行参数
  • 通过参数直接指定API密钥
  • 改进了错误处理和日志记录
  • 具有简单命令语法的全局安装支持

安装

最简单的入门方法是使用npx的交互式安装过程:

npx wordware-mcp

这将指导您完成:

  1. 输入Wordware API密钥
  2. 设置Claude配置(可选)

npx命令将:

  • 如果未提供配置详细信息,则提示您提供
  • 创建必要的配置文件
  • 设置本地环境以运行Wordware应用程序

运行npx命令后,您可以使用以下命令启动MCP服务器:

npx wordware-mcp

永久性安装

如果您希望永久安装该软件包:

# Install globally from npm registry
npm install -g wordware-mcp

# Or install locally in your project
npm install wordware-mcp

# Or clone this repository and install globally
git clone https://github.com/{username}/wordware-mcp.git
cd wordware-mcp
npm run install-global

先决条件

在使用此软件包之前,您需要:

  1. Wordware帐户(在以下网址注册 wordware.ai)
  2. Wordware API密钥
  3. 至少一个已部署的Wordware应用程序

基本用法

直接使用npx(无需安装)

您可以使用npx运行wordware mcp,而无需先安装它:

# Interactive mode - will prompt for required information
npx wordware-mcp

# Or with command line parameters
npx wordware-mcp --api-key your-api-key --port 3000

# Start MCP server after configuration
npx wordware-mcp start

作为全球司令部

如果全局安装,您可以通过以下两种方式之一运行:

# Option 1: Create an .env file in your current directory first (see Configuration section)
wordware-mcp

# Option 2: Pass parameters directly via command line
wordware-mcp --api-key your-api-key --port 3000

命令行选项

Options:
  --api-key, -k <key>      Wordware API key (required unless in .env file)
  --port, -p <port>        Port to run the server on (default: 3000)
  --help, -h               Show this help message

作为项目中的一个包

// In your script
import { startMCP } from "wordware-mcp";

// Start the MCP server
startMCP();

配置

您可以通过两种方式配置MCP服务器:

1.环境变量或.env文件

创建一个 .env 包含以下变量的文件:

WORDWARE_API_KEY=your-api-key
PORT=3000

2.命令行参数

运行命令时直接传递配置:

wordware-mcp -k your-api-key -p 3000

创建您的Wordware安装程序

创建账户

首先,您需要一个Wordware帐户。前往 wordware.ai,登录并创建帐户

创建API密钥

要通过MCP访问您的文字软件流,您需要创建一个API密钥。为此,请单击右上角的个人资料图片>API密钥>创建新密钥>复制密钥

创建应用程序

现在是时候发挥创造力了。为您想要实现的任何目标创建一个WordPress应用程序,或者随时从探索页面分叉应用程序(https://app.wordware.ai/explore).

部署您的应用程序

为了使你的应用程序被触发为MCP,你需要部署它。为此,请前往你的应用。您应该在右上角看到一个“部署”按钮。然后转到部署页面。

拿到 app_id

在部署页面上,您将看到您的部署url: https://app.wordware.ai/explore/apps/{app_id}.从那里获取您的app_id

与Claude Desktop一起使用

要将此MCP服务器与Claude Desktop一起使用:

  1. 确保已安装Claude for Desktop

  2. 修改位于以下位置的Claude桌面配置文件: ~/Library/Application\ Support/Claude/claude_desktop_config.json

  3. 将以下内容添加到文件中:

{
  "mcpServers": {
    "wordware": {
      "command": "wordware-mcp"
    }
  }
}

完整示例工作流

以下是一个完整的工作流示例,可以快速启动和运行:

1.配置并启动Wordware MCP

# Run the interactive setup
npx wordware-mcp

# Follow the prompts to:
# - Enter your Wordware API key
# - Configure Claude integration (if desired)

# Once configured, start the server
npx wordware-mcp start

2.与您的应用程序集成

启动MCP服务器后,您的Wordware应用程序将可在以下位置访问:

http://localhost:3000/api/run/{app_id}

您可以通过HTTP请求触发您的Wordware流:

// Example: Calling your Wordware app from JavaScript
async function callWordwareApp() {
  const response = await fetch("http://localhost:3000/api/run/your-app-id", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      // Your input data here
      prompt: "Your prompt to the AI model",
      // Any other parameters your Wordware app expects
    }),
  });

  const result = await response.json();
  console.log(result);
}

3.热重载开发

在开发过程中,您对Wordware应用程序所做的任何更改都将立即可用-只需刷新应用程序或进行新的API调用即可。

发展

如果你想为这个包做出贡献:

# Clone the repository
git clone https://github.com/yuhuangou/wordware-mcp.git
cd wordware-mcp

# Install dependencies
npm install

# Build the package
npm run build

# Run in development mode
npm run dev

许可证

麻省理工学院

故障排除

npx常见问题

  1. 安装后“找不到命令”

    如果你看到 command not found 使用npx安装后:

    # Make sure the package is installed globally
    npm install -g wordware-mcp
    
    # Check your npm global path is in your PATH
    npm config get prefix
    # Add the resulting path + /bin to your PATH if needed
    
  2. 配置问题

    如果未检测到您的配置:

    # Check if .env file exists in current directory
    ls -la .env
    
    # Manually run with parameters to bypass .env
    npx wordware-mcp --api-key your-api-key
    
  3. 连接被拒绝错误

    如果您在尝试使用应用程序时看到连接错误:

    # Check if server is running
    lsof -i :3000
    
    # Restart server with verbose logging
    npx wordware-mcp start --verbose
    
  4. 权限问题

    如果遇到npx权限错误:

    # Run with sudo (not recommended as permanent solution)
    sudo npx wordware-mcp
    
    # Fix npm permissions
    chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
    

如需更多帮助,请在我们的GitHub存储库上提交问题。

环境变量

以下环境变量可以在 .env 文件:

  • PORT -运行服务器的端口(默认值:3000)
  • WORDWARE_API_KEY -您的Wordware API密钥