GitHub Stars
17,372
User Rating
Not Rated
Favorites
0
Views
7
Forks
1,195
Issues
168
Installation
Difficulty
IntermediateEstimated Time
10-20 minutes
Requirements
Python 3.7 or higher
pip latest version
Installation
Installation
Prerequisites
Please specify required software and versions:Python: 3.7 or higher
pip: Latest version
Installation Steps
1. Clone Repository
bash
git clone https://github.com/jlowin/fastmcp.git
cd fastmcp
2. Install Dependencies
bash
pip install -r requirements.txt
3. Start Server
bash
fastmcp run server.py
Troubleshooting
Common Issues
Issue: Server won't start Solution: Check Python version and reinstall dependencies. Issue: Client cannot connect to the server Solution: Verify the server URL and port.Configuration
Configuration
Basic Configuration
Server Setup
Server configuration is done within theserver.py
file. Hereβs a basic setup example:
python
from fastmcp import FastMCP
mcp = FastMCP("Demo π")
@mcp.tool
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
if __name__ == "__main__":
mcp.run()
Environment Variables
Set the following environment variables as needed:bash
export API_KEY="your-api-key"
export DEBUG="true"
Advanced Configuration
Security Settings
Store API keys in environment variables or secure configuration files
Set appropriate file access permissions
Adjust logging levels
Examples
Examples
Basic Usage
Here are basic usage examples for the MCP server:Running the Server
bash
fastmcp run server.py
Programmatic Usage
python
Python example
import requests
def call_mcp_tool(tool_name, params):
response = requests.post(
'http://localhost:3000/mcp/call',
json={
'tool': tool_name,
'parameters': params
}
)
return response.json()
Usage example
result = call_mcp_tool('add', {'a': 5, 'b': 3})
print(result) # 8
Use Cases
Using an MCP server to facilitate data sharing between different AI models.
Creating tools that integrate with external services via REST APIs.
Developing automation scripts for regular data processing tasks.
Invoking MCP tools from client applications to analyze data in real-time.
Additional Resources
Author Information
949
Followers
41
Repositories
9
Gists
0
Total Contributions
Related MCPs
An example agent demonstrating streaming, tool use, and interactivity from your terminal. This agent builder can help you to build your own agents and tools.
hica
7
hica is a high-performance editor tailored for Python, offering features like code auto-completion and debugging tools. Users can program efficiently through an intuitive interface. With a wide range of plugins, it also boasts high customization, making it suitable for various development environments.