stocks-mcp-server

laplus-x/stocks-mcp-server

3.2

If you are the rightful owner of stocks-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

stocks-mcp-server is a backend service for querying Taiwan stock information using Spring Boot and MCP.

Tools
1
Resources
0
Prompts
0

๐Ÿ“ˆ stocks-mcp-server

Spring Boot + MCP Server based AI tool service for Taiwan Stock Query

๐Ÿ“ Project Overview

stocks-mcp-server is a backend service built with Spring Boot and Model Context Protocol (MCP) for querying Taiwan stock information. It provides APIs for searching by stock name/symbol, real-time price, and volume, and exposes these as AI tools for easy integration with AI agents or automation workflows.

๐Ÿ—๏ธ Architecture

  • Spring Boot WebFlux: High-performance, non-blocking REST API
  • Spring AI MCP Server: AI tool registration and STDIO/SSE communication
  • TWSE API: Integration with Taiwan Stock Exchange public data
  • ModelMapper: Data object mapping
  • Lombok: Simplified Java POJO syntax

Main modules:

  • Config.java: Bean registration (RestClient, ModelMapper)
  • StocksMcpServerApplication.java: Main entry, AI tool registration
  • repositories/TwseRepository.java: TWSE API integration and data parsing
  • tools/StockTool.java: AI tool method (getStock)
  • usecases/StockService.java: Business logic
  • dao/, dto/: Data structures
  • exceptions/: Error handling

๐Ÿš€ Installation & Startup

1. Requirements

  • Java 17+
  • Maven 3.9+

2. Local Startup

./mvnw spring-boot:run

or

mvn spring-boot:run

๐Ÿ› ๏ธ API Tool (MCP)

getStock

  • Description: Query real-time stock info by name or symbol
  • Parameter: name (stock name or symbol)
  • Response:
    {
    	"code": "2330",
    	"name": "TSMC",
    	"price": "800.00",
    	"volume": "10000"
    }
    

SSE Endpoints

  • /mcp/sse: MCP Server SSE communication
  • /mcp/sse/messages: Message push

๐Ÿ“ฆ Tech Stack

  • Spring Boot 3.5
  • Spring AI MCP Server WebFlux
  • ModelMapper
  • Lombok
  • JUnit 5

๐Ÿงฉ Directory Structure

src/
	main/
		java/dev/laplus/stocks_mcp_server/
			Config.java
			StocksMcpServerApplication.java
			repositories/
			tools/
			usecases/
			dao/
			dto/
			exceptions/
		resources/application.properties
	test/
		java/dev/laplus/stocks_mcp_server/
			StocksMcpServerApplicationTests.java
Taskfile.yml
pom.xml

๐Ÿงช Testing

./mvnw test

๐Ÿค Contributing

Issues, PRs, and discussions are welcome!

๐Ÿ“„ License

Apache License 2.0