Add MCP server for AI agents
Expose webshare_search, webshare_get_link, and webshare_login_check over stdio via the Model Context Protocol SDK. Document client configuration.
This commit is contained in:
19
__tests__/mcp-server.test.js
Normal file
19
__tests__/mcp-server.test.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const { formatSize, createWebshareMcpServer } = require('../src/mcp-server');
|
||||
|
||||
describe('formatSize', () => {
|
||||
it('formats bytes', () => {
|
||||
expect(formatSize(0)).toBe('0 B');
|
||||
expect(formatSize(512)).toBe('512 B');
|
||||
expect(formatSize(1024)).toBe('1.0 KB');
|
||||
expect(formatSize(1536)).toBe('1.5 KB');
|
||||
expect(formatSize(1024 * 1024)).toBe('1.0 MB');
|
||||
});
|
||||
});
|
||||
|
||||
describe('createWebshareMcpServer', () => {
|
||||
it('creates a server instance with credentials', () => {
|
||||
const server = createWebshareMcpServer({ username: 'u', password: 'p' });
|
||||
expect(server).toBeDefined();
|
||||
expect(server.server).toBeDefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user