Skip to content

Gopher-Auth-SDK Usages #132

@bettercallsaulj

Description

@bettercallsaulj

For competitiveness consideration, Gopher-Auth-SDK provides 3 usages:

  1. User provides MCP tools only.
import dotenv from "dotenv";
import { GopherAuthServer } from "@mcp/filter-sdk/auth";
import { tool1 } from "./tools/tool1.js";
import { tool2 } from "./tools/tool2.js";
import { tool3 } from "./tools/tool3.js";

dotenv.config();
const tools = [tool1, tool2, tool3];
const server = new GopherAuthServer();
server.register(tools);
server.start().catch(error => {
  console.error("Fatal error:", error);
  process.exit(1);
});
  1. User provides MCP Server and tools.
import dotenv from "dotenv";
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { GopherAuthServer } from "@mcp/filter-sdk/auth";
import { tool1 } from "./tools/tool1.js";
import { tool2 } from "./tools/tool2.js";
import { tool3 } from "./tools/tool3.js";

dotenv.config();
const mcpServer = new Server(
  {
    name: "example-server",
    version: "1.0.0"
  },
  {
    capabilities: {
      tools: {}
    },
  }
);
mcpServer.setRequestHandler(ListToolsRequestSchema, async () => {
  return {
    tools: [tool1, tool2, tool3],
  };
});

const server = new GopherAuthServer(mcpServer);
server.start().catch(error => {
  console.error("Fatal error:", error);
  process.exit(1);
});
  1. User handles server manually, Gopher-Auth SDK provides authentication middleware.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions