AI代理统一协调器

Pleiades是一个统一的MCP协调器,通过单一端点将AI代理连接到多个服务提供商(如Linear、Sentry等),简化了多服务集成和管理。

  • by joelachance
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 openworldapp/pleiades

使用说明

昴星团

统一的MCP编排器,通过单个端点将AI代理连接到多个提供者(Linear、Sentry等)。

快速开始

bun install
import Pleiades from './src/main.js';
import type { PleiadesConfig } from './src/types.js';

// Configure providers
const config: PleiadesConfig = {
  name: 'pleiades', //this becomes the `use_pleiades` tool
  baseUrl: 'http://localhost:8787',
  providers: [
    {
      id: 'sentry',
      mcpUrl: 'https://mcp.sentry.dev/mcp',
      oauth: {
        authUrl: 'https://mcp.sentry.dev/oauth/authorize',
        tokenUrl: 'https://mcp.sentry.dev/oauth/token',
        clientId: process.env.SENTRY_CLIENT_ID!,
        clientSecret: process.env.SENTRY_CLIENT_SECRET!,
        scopes: ['org:read', 'project:write']
      }
    },
    {
      id: 'linear',
      mcpUrl: 'https://mcp.linear.app/mcp',
      oauth: {
        authUrl: 'https://linear.app/oauth/authorize',
        tokenUrl: 'https://api.linear.app/oauth/token',
        clientId: process.env.LINEAR_CLIENT_ID!,
        clientSecret: process.env.LINEAR_CLIENT_SECRET!,
        scopes: ['read', 'write']
      }
    },
    ...
  ],
  store: yourTokenStore // Implement TokenStore interface
};

// Create instance
const pleiades = new Pleiades(config);

// Serve
Bun.serve({
  port: 8787,
  fetch: pleiades.fetch
});

配置

提供商类型:

  • OAuth:提供 oauth 需要身份验证的提供程序的配置
  • API代币:使用 apiToken 用于简单的基于令牌的身份验证

TokenStore接口:

interface TokenStore {
  getToken(tenantId: string, providerId: string, accountId?: string): Promise<Token | null>;
  setToken(tenantId: string, providerId: string, accountId: string, token: Token): Promise<void>;
  revokeToken(tenantId: string, providerId: string, accountId: string): Promise<void>;
  getAccounts(tenantId: string, providerId: string): Promise<string[]>;
}

端点

  • GET /mcp -人工智能代理的MCP端点
  • GET /oauth/callback -OAuth回调处理程序
  • 每个提供者都将工具公开为 use_{providerId}

在本地运行

bun run dev

部署

目前支持Cloudflare Workers。OAuth需要一个数据库来存储令牌。