import { FlowMCP } from './src/index.mjs'
import { Server } from '@modelcontextprotocol/sdk/server/index.js'
// Create MCP server instance
const server = new Server({
name: 'crypto-api-server',
version: '1.0.0'
}, {
capabilities: { tools: {} }
})
// Define your schema
const schema = {
namespace: 'github',
flowMCP: '1.2.2',
root: 'https://api.github.com',
requiredServerParams: ['GITHUB_TOKEN'],
headers: {
'Authorization': 'token {{GITHUB_TOKEN}}',
'Accept': 'application/vnd.github.v3+json'
},
routes: {
getUser: {
requestMethod: 'GET',
description: 'Get GitHub user information',
route: '/users/{{USER_PARAM}}',
parameters: [
{ position: { key: "username", value: "{{USER_PARAM}}", location: "insert" }, z: { primitive: "string()", options: ["min(1)", "max(39)"] } }
],
tests: [],
modifiers: []
}
}
}
// Server parameters for authentication
const serverParams = {
GITHUB_TOKEN: process.env.GITHUB_TOKEN
}
// Activate schema as MCP tools
const { mcpTools } = FlowMCP.activateServerTools({
server,
schema,
serverParams,
validate: true,
silent: false
})
console.log('Activated tools:', Object.keys(mcpTools))
// Output: ['github__getUser']