Tushare MCP Server
This is a Model Context Protocol (MCP) server that provides access to Tushare financial data.
Prerequisites
Python 3.10 or higher
A Tushare Token (Get it from Tushare.pro)
Installation
Install the dependencies:
pip install -r requirements.txt
Configuration
Create a
.envfile in the project root directory:TUSHARE_TOKEN=your_tushare_token_here
Using with GitHub Copilot in VS Code
To use this MCP server with GitHub Copilot in VS Code, you need to configure the mcp.json file.
Open Configuration:
Open the Command Palette (
Ctrl+Shift+PorF1).Search for and select
MCP: Configure MCP Servers.This will open the
mcp.jsonfile (typically located in%APPDATA%\Code\User\mcp.jsonon Windows).
Add Server Configuration: Add the
tushare-serverconfiguration to the JSON file. Make sure to use absolute paths for both the Python executable and the script.{ "mcpServers": { "tushare-server": { "command": "C:\\path\\to\\your\\python.exe", "args": [ "C:\\path\\to\\tushare_mcp_server\\server.py" ] } } }Replace
C:\\path\\to\\your\\python.exewith your actual Python interpreter path (e.g.,C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\python.exe).Replace
C:\\path\\to\\tushare_mcp_server\\server.pywith the absolute path to this project'sserver.py.
Restart VS Code: After saving
mcp.json, restart VS Code for the changes to take effect.
Usage
Testing with MCP Inspector
You can test the server using the MCP Inspector:
Using with Claude Desktop
Add the following configuration to your claude_desktop_config.json:
Make sure to replace your_token_here with your actual Tushare token.