Skip to content

AppiumTestDistribution/api-days-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple MCP Server (using @modelcontextprotocol/sdk)

This is a simple MCP server built with the @modelcontextprotocol/sdk, express, and zod.

Features

  • Tools: get-time - returns the current time.
  • Resources: sample-resource - returns a sample resource.

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/simple-mcp-server.git cd simple-mcp-server
  2. Install dependencies:

    npm install

Usage

To run the server, use the following command:

npm start

The server will start on http://localhost:3000/mcp. You can send POST requests to this endpoint to interact with the server.

Example Requests

Tool Request

Request:

curl -X POST -H "Content-Type: application/json" -d '{  "id": "1",  "type": "tool",  "name": "get-time",  "arguments": {} }' http://localhost:3000/mcp

Response:

{ "id": "1", "result": { "content": [ { "type": "text", "text": "{\"time\":\"2023-10-27T12:34:56.789Z\"}" } ], "structuredContent": { "time": "2023-10-27T12:34:56.789Z" } } }

Resource Request

Request:

curl -X POST -H "Content-Type: application/json" -d '{  "id": "2",  "type": "resource",  "uri": "sample-resource" }' http://localhost:3000/mcp

Response:

{ "id": "2", "result": { "contents": [ { "uri": "sample-resource:", "text": "This is a sample resource" } ] } }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •