Skip to main content
Glama
TalissonFV

MCP User Management Server

by TalissonFV

create-user

Add new users to the MCP User Management Server by providing required details including name, email, password, address, and phone information.

Instructions

Create a new user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
emailYes
passwordYes
addressYes
phoneYes

Implementation Reference

  • src/server.ts:33-63 (registration)
    Registration of the 'create-user' tool on the MCP server, including name, description, input schema, metadata, and handler function.
    server.tool(
      "create-user",
      "Create a new user",
      {
        name: z.string(),
        email: z.string(),
        password: z.string(),
        address: z.string(),
        phone: z.string(),
      },
      {
        title: "Create User",
        readOnlyHint: false,
        destructiveHint: false,
        idempotentHint: false,
        openWorldHint: true,
        description: "Create a new user",
      },
      async (params) => {
        try {
          await createUser(params);
          return {
            content: [{ type: "text", text: "User created" }],
          };
        } catch {
          return {
            content: [{ type: "text", text: "Failed to save user" }],
          };
        }
      }
    );
  • Handler function passed to MCP server.tool for 'create-user', which calls the createUser helper and returns a simple text response on success or failure.
    async (params) => {
      try {
        await createUser(params);
        return {
          content: [{ type: "text", text: "User created" }],
        };
      } catch {
        return {
          content: [{ type: "text", text: "Failed to save user" }],
        };
      }
    }
  • Zod schema defining the input parameters for the 'create-user' tool.
    {
      name: z.string(),
      email: z.string(),
      password: z.string(),
      address: z.string(),
      phone: z.string(),
    },
  • Helper function that loads users from JSON, generates new ID, appends the user, and persists to file system.
    async function createUser(user: { name: string; email: string; password: string; address: string; phone: string }) {
      const users = await import("./data/users.json", { with: { type: "json" } }).then((m) => m.default);
    
      const id = users.length + 1;
    
      users.push({ id, ...user });
    
      await fs.writeFile("./src/data/users.json", JSON.stringify(users, null, 2));
    
      return id;
    }
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TalissonFV/mcp-test'

If you have feedback or need assistance with the MCP directory API, please join our Discord server