-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.mjs
More file actions
20 lines (19 loc) · 881 Bytes
/
example.mjs
File metadata and controls
20 lines (19 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Example usage for ESM (example.mjs)
import { mcpServer } from '@eliware/mcp-server';
(async () => {
const { app, httpInstance } = await mcpServer({
// log, // Optional: pass your own logger instance
// port: 1234, // You can change the port as needed
// authToken: 'your-secret-token', // You can still use this for static token auth
// toolsDir: './tools', // Path to your tools directory
// name: 'Example MCP Server', // Set your server name
// version: '1.0.0', // Set your server version
// // Example: custom async auth callback
// authCallback: async (token) => {
// // Replace with your own logic, e.g. check token in DB or against a list
// return token === 'your-secret-token';
// },
// context: { db, redis } // Optional objects to pass to tools (db, redis, etc.)
});
console.log('MCP Server started!');
})();