spring-bitcoin-mcp-server
This project provides a Model Context Protocol (MCP) server for Bitcoin price information.
Bitcoin MCP Server
This project provides a Model Context Protocol (MCP) server for Bitcoin price information.
Building the Project
To build the project, run:
mvn clean package
This will create a JAR file at target/bitcoinmcp-0.0.1-SNAPSHOT.jar
.
Running the MCP Server
The server is configured to use standard input/output (STDIO) for communication, as specified in the application.yaml
file.
Using the ClientSTDIO Test Client
The project includes a test client (ClientSTDIO
) that demonstrates how to connect to the MCP server.
Why ClientSTDIO Needs to See the Server JAR
The ClientSTDIO class uses the Model Context Protocol (MCP) client library to communicate with the MCP server. It needs to reference the server JAR file because:
- The MCP client uses a subprocess mechanism to start the server
- It launches the server by executing the JAR file as a separate Java process
- The client and server communicate via standard input/output (STDIO)
This architecture allows the client to interact with the server without requiring the server to be started separately or to expose network ports. However, it means the client needs to know the location of the server JAR file to start it.
Configuring the JAR File Path
The client needs to know the location of the server JAR file. There are three ways to specify this:
-
System Property:
java -Dmcp.server.jar.path=/path/to/bitcoinmcp-0.0.1-SNAPSHOT.jar -cp target/test-classes za.sk.bitconmcp.ClientSTDIO
-
Environment Variable:
export MCP_SERVER_JAR_PATH=/path/to/bitcoinmcp-0.0.1-SNAPSHOT.jar java -cp target/test-classes za.sk.bitconmcp.ClientSTDIO
-
Default Path: If neither the system property nor the environment variable is set, the client will look for the JAR file at
target/bitcoinmcp-0.0.1-SNAPSHOT.jar
relative to the current working directory.
Running the Client
To run the client, use Maven's exec plugin to ensure all dependencies are included in the classpath:
# Make sure you're in the project root directory
cd /opt/mcp/server/bitcoinmcp
# Run the client using Maven
mvn exec:java -Dexec.classpathScope=test -Dexec.mainClass="za.sk.bitconmcp.ClientSTDIO"
You can also specify the JAR path as a system property:
mvn exec:java -Dexec.classpathScope=test -Dexec.mainClass="za.sk.bitconmcp.ClientSTDIO" -Dmcp.server.jar.path=/path/to/bitcoinmcp-0.0.1-SNAPSHOT.jar
The client will:
- Connect to the MCP server
- List available tools
- Call the
getBitcoinProceByCurrency
tool with USD as the currency - Display the result
- Close the connection
Troubleshooting
If you see an error like "MCP server JAR file not found", make sure:
- You've built the project with
mvn clean package
- You're running the client from the correct directory
- The JAR file path is correctly specified
You can also specify the absolute path to the JAR file using one of the configuration methods described above.
Related MCP Servers
View all finance servers →mcp-server
by financial-datasets
This is a Model Context Protocol (MCP) server that provides access to stock market data from Financial Datasets.
razorpay-mcp-server
by razorpay
The Razorpay MCP Server is a Model Context Protocol server that integrates with Razorpay APIs for advanced payment processing.
evm-mcp-server
by mcpdotdirect
A comprehensive Model Context Protocol (MCP) server that provides blockchain services across multiple EVM-compatible networks.
investor-agent
by ferdousbhai
The investor-agent is a Model Context Protocol server designed to provide comprehensive financial insights and analysis to Large Language Models.
mcp-cn-a-stock
by elsejj
This is an MCP (Model Content Protocol) service providing A-share data for large models.
mcp-trader
by wshobson
A Model Context Protocol (MCP) server designed for stock traders, offering a suite of tools for technical analysis and trading.
coincap-mcp
by QuantGeekDev
Coincap MCP allows users to query cryptocurrency information from Coincap's public API without requiring API keys or registration.