Build a simple MCP Server in Go for financial tools and real-time stock quotes with Alpha Vantage integration
This project is a practical example of building a simple MCP Server using Go. It simulates financial tool management and performs real-time stock price queries using Alpha Vantage's public API.
The goal is to demonstrate how to structure a server that adheres to the basic principles of the Model Context Protocol (MCP), including exposing an /metadata
endpoint.
Financial MCP Server is designed as an example implementation showcasing the capabilities of the Model Context Protocol within the financial tool domain. This server leverages Go for its lightweight and efficient nature, ensuring robust performance while simulating financial operations such as stock price queries and dynamic tool registration.
The primary focus on this project lies in demonstrating how AI applications can integrate with a standard MCP protocol to access various tools and data sources through a unified API. By using Financial MCP Server, developers and AI application creators gain insight into the process of setting up an adapter that can connect multiple services via MCP, thus enhancing interoperability between different systems.
Financial MCP Server allows for dynamic registration of financial tools. Users can submit a POST request to /register-financial-tool
with detailed information about the tool, such as name, description, endpoint URL, and service type.
POST http://localhost:8080/register-financial-tool
Content-Type: application/json
{
"name": "Consulta Ações",
"description": "Consulta cotações de ações em tempo real",
"endpoint": "https://www.alphavantage.co/query",
"service_type": "cotacao"
}
Clients can query the server for a list of all registered financial tools using the /list-financial-tools
endpoint.
GET http://localhost:8080/list-financial-tools
Accept: application/json
This feature is crucial for managing and monitoring the availability and usage of various financial tools, ensuring that end-users have up-to-date information about the services provided by Financial MCP Server.
Financial clients can use the /query-stock-price
endpoint to request real-time stock prices from Alpha Vantage using dynamic configuration stored within the server.
POST http://localhost:8080/query-stock-price
Content-Type: application/json
{
"symbol": "AAPL"
}
This function supports dynamic updates and scalability, making it highly suitable for applications requiring frequent and precise financial data queries.
In compliance with the Model Context Protocol (MCP), Financial MCP Server exposes its metadatas via the /metadata
endpoint. This feature allows clients to understand more about the server's capabilities, tool integrations, and other relevant information.
GET http://localhost:8080/metadata
Accept: application/json
Financial MCP Server is compatible with several MCP clients, including Claude Desktop, Continue, and Cursor. The following table provides an overview of the current compatibility status:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
The Financial MCP Server is designed to strictly comply with the principles of the Model Context Protocol. It handles various requests from clients, dynamically registers financial tools, and provides real-time stock price data via well-defined endpoints.
graph TD
A[AI Application] -->|MCP Client| B[MCP Server]
B --> C[Data Source/Tool]
style A fill:#e1f5fe
style B fill:#f3e5f5
style C fill:#e8f5e8
graph LR
@startArrow [AI Application -->]
S[Service Registration] --> R[Real-Time Data Query]
R --> D[Data Source/Tool]
D --> E[MCP Server]
style @startArrow red
style S fill:#e1f5fe
style R fill:#e8f5e8
style D fill:#f3e5f5
To set up the Financial MCP Server, follow these steps:
Clone the repository:
git clone https://github.com/seuusuario/go-mcp-server-financeiro.git
cd go-mcp-server-financeiro
Create a .env
file in the project root with your Alpha Vantage API key:
ALPHA_VANTAGE_API_KEY=sua_api_key_aqui
Install dependencies:
go mod tidy
Run the server:
go run cmd/main.go
The server will be available at http://localhost:8080
.
Suppose an finance analyst needs to integrate multiple financial tools into a single platform. By using the Financial MCP Server, they can dynamically register and manage various tools like stock price calculators, currency converters, and more. This flexibility ensures that users have access to the latest and most relevant data sources.
A quantitative trader wants to develop a real-time trading strategy based on multiple financial metrics. With Financial MCP Server, they can seamlessly query stock prices from Alpha Vantage or other sources, allowing for continuous performance monitoring and adjustment of strategies in response to market fluctuations.
Financial MCP Server supports integration with various AI applications such as Claude Desktop, Continue, Cursor, and more. This integration allows these clients to leverage the financial tools and services provided by the server without needing complex implementation details.
By following the standardized process for MCP compliance, developers can ensure that their applications are seamlessly integrated into existing systems, promoting seamless data exchange and enhanced functionality.
The table below provides a detailed view of the performance and compatibility status of Financial MCP Server with different clients:
Client | Resource Management | Tool Support | Prompt Management |
---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ |
Continue | ✅ | ✅ | ✅ |
Cursor | ❌ | ✅ | ❌ |
This matrix highlights the specific areas of compatibility and functionality available for each client.
Advanced users can customize the configuration files to meet their security requirements. The mcpServers
section in the server configuration can be modified as follows:
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
These settings allow for secure and fine-grained access management, ensuring that only authorized clients can interact with the server.
Financial MCP Server uses Alpha Vantage's public API to fetch real-time stock prices. Users can send requests via the /query-stock-price
endpoint, and the server processes them to return accurate and current data.
Yes, the server is designed to be flexible. You can replace or extend the existing services with custom data sources by modifying the configuration files according to your needs.
Security is a top priority. The server employs secure protocols and ensures that all communication is encrypted. Additionally, environment variables like API keys are stored securely and only accessible through authorized channels.
The metadata endpoint helps MCP clients understand the capabilities of Financial MCP Server, including available services and data sources. This understanding enables seamless integration without requiring detailed knowledge about underlying infrastructure.
Absolutely! The service_type
field within tool registration can be used to point to a variety of data sources or API endpoints. Users can replace or extend the services as needed, making the system highly adaptable and versatile for different use cases.
Contributions are encouraged from developers looking to enhance Financial MCP Server’s functionality. Feel free to report bugs, request new features, or submit pull requests with improvements. For more details on development and contributing, please refer to the official repository here.
Financial MCP Server is part of a broader ecosystem dedicated to promoting interoperability between AI applications and data sources via the Model Context Protocol. Developers can find additional resources, tutorials, and community support in the official MCP Developer Community.
Next-generation MCP server enhances documentation analysis with AI-powered neural processing and multi-language support
Learn to connect to MCP servers over HTTP with Python SDK using SSE for efficient protocol communication
Python MCP client for testing servers avoid message limits and customize with API key
Discover easy deployment and management of MCP servers with Glutamate platform for Windows Linux Mac
Learn how to use MCProto Ruby gem to create and chain MCP servers for custom solutions
Explore community contributions to MCP including clients, servers, and projects for seamless integration