mcp-server logo

mcp-server

by TogetherCrew

The mcp-server provides a server-side component for the Model Context Protocol. It facilitates communication and interaction between clients and tools, enabling functionalities like querying community resources.

View on GitHub

Last updated: N/A

mcp-server

Install

npm i @togethercrew.dev/mcp-server
yarn add @togethercrew.dev/mcp-server
pnpm add @togethercrew.dev/mcp-server

Inspector

Try it using @modelcontextprotocol/inspector.

Note: The inspector timeout is set to 10 seconds by default. Our services can take several minutes to process a request, therefore you should extend the timeout. This can be done (soon) through the configuration settings. Or by adding the param timeout=600000 (10 minutes) to the url.

Client example

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import { exit } from "process";

async function main() {
  const transport = new StdioClientTransport({
    command: "node",
    args: ["./src/index.ts"], // This will need to connect to the mpc server
  });

  const client = new Client({
    name: "TogetherCrew-Agent",
    version: "1.0.0",
  });

  await client.connect(transport);

  console.log("Client connected");

  const response = await client.callTool({
    name: "query-community-resources",
    arguments: {
      communityId: "TOGETHERCREW_COMMUNITY_ID",
      question: "YOUR QUESTION",
    },
  });

  console.log("Response:", response.content[0].text);
  exit(0);
}

main().catch(console.error);