Company API MCP Server Template
A template for creating Model Context Protocol (MCP) servers that integrate with your company's API using FastMCP.
Overview
This template provides a starting point for building MCP servers that can interact with your company's REST API. It includes:
- Authentication handling (Bearer token)
- Error handling and logging
- Example tools for common API operations
- Environment variable configuration
- Proper async/await patterns
Setup
- Clone this repository
- Install dependencies:
- Set environment variables:
Configuration
The server can be configured using environment variables:
API_BASE_URL
: Base URL of your company's APIAPI_KEY
: API key for authentication
Usage
Running the server
Available Tools
The template includes two example tools:
- get_user_info(user_id): Retrieve user information by ID
- search_items(query, limit): Search for items with optional limit
Customization
To adapt this template for your API:
- Update the
API_BASE_URL
and authentication method inserver.py
- Modify the existing tools or add new ones based on your API endpoints
- Update the response formatting to match your API's data structure
- Add any additional error handling specific to your API
Example Tools Implementation
MCP Integration
To use this server with an MCP client, add it to your MCP configuration:
Development
Project Structure
Adding New Tools
- Define your tool function with the
@mcp.tool()
decorator - Use
make_api_request()
to call your API - Handle errors appropriately
- Format the response for the user
License
[Add your license here]
Contributing
[Add contribution guidelines here]
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A template for building Model Context Protocol servers that connect to company REST APIs using FastMCP, providing authentication handling, error management, and example tools for common API operations.
Related MCP Servers
- AsecurityAlicenseAqualityA TypeScript-based template for building Model Context Protocol servers, featuring fast testing, automated version management, and a clean structure for MCP tool implementations.Last updated -15214TypeScriptMIT License
- -securityFlicense-qualityA server implementation of the Model Context Protocol (MCP) that provides REST API endpoints for managing and interacting with MCP resources.Last updated -Python
- -securityAlicense-qualityA REST API built with FastAPI that exposes endpoints via Model Context Protocol (MCP), allowing clients to interact with CRUD operations through MCP interfaces.Last updated -PythonMIT License
- -securityAlicense-qualityA server that implements the Model Context Protocol (MCP) with StreamableHTTP transport, enabling standardized interaction with model services through a RESTful API interface.Last updated -1551JavaScriptMIT License