ModelContextProtocolServer

ModelContextProtocolServer

By InnoBridge GitHub

MCP server to provide tools

mathgpt math-solver
Overview

what is ModelContextProtocolServer?

ModelContextProtocolServer (MCP) is a server that provides tools for various functionalities, including a calculator and weather information retrieval.

how to use ModelContextProtocolServer?

To use MCP, you can connect to the server via SSE stream or stdio, and send requests to utilize its tools through JSON-RPC.

key features of ModelContextProtocolServer?

  • Provides a basic calculator tool for arithmetic operations.
  • Offers a weather tool to get current weather information based on location.
  • Supports JSON-RPC for communication with the server.

use cases of ModelContextProtocolServer?

  1. Performing basic arithmetic calculations.
  2. Retrieving current weather data for specific locations.
  3. Integrating with other applications that require mathematical or weather-related functionalities.

FAQ from ModelContextProtocolServer?

  • What tools are available in MCP?

MCP currently includes a calculator and a weather tool.

  • How do I connect to the MCP server?

You can connect using curl commands provided in the documentation.

  • Is there a limit to the number of requests I can make?

There is no specified limit, but performance may vary based on server load.

Content

ModelContextProtocolServer

API Examples

Connect to SSE stream

curl -N -H "Accept: text/event-stream" http://localhost:8081/sse

Connect to stdio

Generate Java artifact

./mvnw clean install

Starting stdio server

java -Dtransport.mode=stdio \
     -Dspring.main.web-application-type=none \
     -Dspring.main.banner-mode=off \
     -Dlogging.file.name=mcpserver.log \
     -jar target/mcpserver-0.0.1-SNAPSHOT.jar

Send a tool/list request

Example

Request

curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' http://localhost:8081/mcp/message

Respone

event:message
data:{"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"calculator","description":"Basic calculator","inputSchema":{"type":"object","properties":{"operation":{"type":"string"},"a":{"type":"number"},"b":{"type":"number"}},"required":["operation","a","b"]}},{"name":"get_current_weather","description":"Get the current weather in a given location","inputSchema":{"type":"object","properties":{"location":{"type":"string","description":"The name of the city e.g. San Francisco, CA"},"format":{"type":"string","enum":["celsius","fahrenheit"],"description":"The format to return the weather in"}},"required":["location"]}}]}}

Call the calculator tool

Example

Request

curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"calculator","arguments":{"operation":"+","a":2,"b":3}}}' http://localhost:8081/mcp/message

Response

event:message
data:{"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","type":"text","text":"2.00 + 3.00 = 5.00"}],"isError":false}}

Call the weather tool

Example

Request

curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_current_weather","arguments":{"location":"San Francisco","format":"celsius"}}}' http://localhost:8081/mcp/

Response

event:message
data:{"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","type":"text","text":"Current weather in San Francisco, United States of America: Partly cloudy, 11.1°C, Precipitation: 0.0 mm"}],"isError":false}}
No tools information available.

-

mathgpt math-solver
View Details
StatSource
StatSource by jamie7893

Statsource is a standalone MCP server designed to simplify data analysis. Whether you're pulling data from a PostgreSQL database or a CSV file, Statsource delivers actionable insights with ease

mathgpt math-solver
View Details

Mirror of

mathgpt math-solver
View Details

created from MCP server demo

mathgpt math-solver
View Details

-

mathgpt math-solver
View Details

created from MCP server demo

mathgpt math-solver
View Details