@paybyrd/ai-agent-claude
Version:
Paybyrd integration for a claude AI agent
28 lines (27 loc) • 1.06 kB
JavaScript
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { isToolAllowed, PaybyrdAPI, tools } from '@paybyrd/ai-agent-toolkit';
class ClaudeAgentToolkit extends McpServer {
constructor({ authToken, configuration, }) {
super({
name: 'paybyrd',
version: '0.1.0'
});
this._paybyrd = new PaybyrdAPI(authToken, configuration.context);
const filteredTools = tools.filter((tool) => isToolAllowed(tool, configuration));
filteredTools.forEach((tool) => {
this.tool(tool.method, // Method is the tool's ID
tool.description, tool.parameters.shape, async (arg, _extra) => {
const result = await this._paybyrd.run(tool.method, arg);
return {
content: [
{
type: 'text',
text: String(result),
},
],
};
});
});
}
}
export default ClaudeAgentToolkit;