FrameworksBackend
Elysia
Integrate the Integrate SDK with Elysia
The Integrate SDK provides seamless integration with Elysia through server-side configuration and route handlers. This guide assumes you have an Elysia project already set up.
Installation
Install the Integrate SDK in your Elysia project:
bun add integrate-sdkSetup
Create a server configuration file with your OAuth credentials:
// src/index.ts
import { Elysia } from "elysia";
import { createMCPServer, githubIntegration } from "integrate-sdk/server";
import { cors } from "@elysiajs/cors";
const app = new Elysia();
const { client: serverClient } = createMCPServer({
apiKey: process.env.INTEGRATE_API_KEY,
integrations: [
githubIntegration({
scopes: ["repo", "user"],
}),
],
});
app.use(
cors({
origin: process.env.FRONTEND_URL || "http://localhost:3000",
credentials: true,
})
);
app.all("/api/integrate/*", (context) => {
return serverClient.handler(context.request);
});
app.listen(process.env.PORT || 8080);
console.log(`Server running on port ${process.env.PORT || 8080}`);You can get an API key from the Integrate Dashboard.
Configuration
Add your OAuth credentials to your .env file:
INTEGRATE_API_KEY=your_integrate_api_key
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
FRONTEND_URL=http://localhost:3000
PORT=8080CORS Setup
CORS is configured in the setup above. If you need to customize it, adjust the CORS middleware:
app.use(
cors({
origin: process.env.FRONTEND_URL || "http://localhost:3000",
credentials: true,
})
);Usage Examples
Client-Side Authorization
The client is automatically configured when making requests to the server.
import { client } from "integrate-sdk";
await client.authorize("github");