MCP Server Demo - Learning Project
Provides integration with Google Assistant through fulfillment handlers, analytics logging, and tool usage tracking for processing Assistant requests.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Server Demo - Learning Projectcalculate 15 plus 7"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server Demo - Learning Project
A comprehensive learning project demonstrating how to build a Model Context Protocol (MCP) server with Google ADK integration using best practices.
π― Learning Objectives
This project teaches you:
MCP Server Architecture
How to structure an MCP server
Tool definitions and handlers
Resource management
Error handling patterns
Best Practices
TypeScript for type safety
Separation of concerns
Input validation and security
Error handling
Extensible architecture
Google ADK Integration
Integration points for Google Actions
Analytics and logging
Fulfillment handlers (placeholder)
Related MCP server: Minimal MCP
π Project Structure
mcp-server-demo/
βββ src/
β βββ index.ts # Main server entry point
β βββ tools/
β β βββ base-tool.ts # Base tool interface
β β βββ calculator.ts # Calculator tool example
β β βββ file-operations.ts # File operations tool
β β βββ system-info.ts # System information tool
β βββ integrations/
β βββ google-adk.ts # Google ADK integration
βββ package.json
βββ tsconfig.json
βββ README.mdπ Getting Started
Prerequisites
Node.js 18+
npm or yarn
Installation
# Install dependencies
npm install
# Build the project
npm run build
# Run in development mode (with auto-reload)
npm run dev
# Run the built server
npm startπ οΈ Available Tools
1. Calculator Tool
Perform basic mathematical operations.
Example:
{
"name": "calculator",
"arguments": {
"operation": "add",
"a": 10,
"b": 5
}
}2. File Operations Tool
Read, write, list, and get info about files.
Example:
{
"name": "file_operations",
"arguments": {
"operation": "read",
"path": "README.md"
}
}3. System Info Tool
Get system information (platform, memory, CPU, etc.).
Example:
{
"name": "system_info",
"arguments": {
"detail": "full"
}
}π Google ADK Integration
The project includes a Google ADK integration module that demonstrates:
Analytics Logging: Track tool usage
Fulfillment Handlers: Process Google Assistant requests (placeholder)
Usage Statistics: Get insights into tool usage
Enabling Google ADK
Set the environment variable:
export GOOGLE_ADK_ENABLED=trueNext Steps for Full Integration
Set up Google Actions Project
Create a project in Google Cloud Console
Enable Actions API
Set up OAuth credentials
Implement Webhook Server
Use Express.js or similar
Handle fulfillment requests
Connect to MCP server tools
Deploy
Deploy to Google Cloud Functions or Cloud Run
Configure webhook URL in Actions Console
π Best Practices Demonstrated
1. Type Safety
Full TypeScript implementation
Strict type checking enabled
Interface definitions for all tools
2. Security
Path validation (prevents directory traversal)
Input sanitization
Error message sanitization
3. Error Handling
Comprehensive try-catch blocks
Meaningful error messages
Graceful degradation
4. Code Organization
Separation of concerns
Modular tool architecture
Clear abstraction layers
5. Extensibility
Easy to add new tools (extend
BaseTool)Plugin-like architecture
Configuration-driven behavior
π§ͺ Testing Your MCP Server
Using Claude Desktop
Add to Claude Desktop configuration:
{
"mcpServers": {
"demo": {
"command": "node",
"args": ["/path/to/mcp-server-demo/dist/index.js"]
}
}
}Restart Claude Desktop
The tools should be available in Claude
Using MCP Client
You can also test with an MCP client library or create a simple test script.
π Learning Path
Beginner Tasks
β Understand the project structure
β Run the server and test tools
β Read through the code comments
β Modify calculator tool to add new operations
Intermediate Tasks
Add a new tool (e.g.,
weathertool using an API)Implement resource caching
Add tool usage rate limiting
Create unit tests for tools
Advanced Tasks
Implement full Google ADK webhook server
Add authentication/authorization
Implement tool chaining
Add streaming responses
Create a remote MCP server (HTTP transport)
π Resources
π€ Contributing
This is a learning project! Feel free to:
Add more example tools
Improve error handling
Add tests
Enhance documentation
π License
MIT
Happy Learning! π
Available Tools
3 toolscalculatorB
Perform basic mathematical calculations (add, subtract, multiply, divide)
| Name | Required | Description | Default |
|---|---|---|---|
| operation | Yes | The mathematical operation to perform | |
| a | Yes | First number | |
| b | Yes | Second number |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'perform basic mathematical calculations' implies a read-only computation, it doesn't explicitly state whether this tool has side effects, requires permissions, handles errors (like division by zero), or has rate limits. The description is minimal and lacks behavioral context beyond the basic operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's function without any wasted words. It's appropriately sized for a simple tool and front-loaded with the core purpose. Every part of the sentence earns its place by specifying the operations.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (basic math operations) and the absence of an output schema, the description is minimally complete. It covers what the tool does but lacks details on return values, error handling, or usage context. With no annotations and no output schema, it should ideally provide more behavioral insight, but for this simple tool, it's adequate though with clear gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with clear documentation for all three parameters (operation, a, b). The description adds no additional parameter semantics beyond what's in the schema, such as format examples or constraints. According to the rules, with high schema coverage (>80%), the baseline is 3 even without param info in the description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with specific verbs (add, subtract, multiply, divide) and the resource (mathematical calculations). It distinguishes itself from sibling tools like file_operations and system_info by focusing on arithmetic operations. However, it doesn't explicitly differentiate from potential alternative calculation tools, keeping it at a 4 rather than a 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, limitations, or context for choosing this calculator over other methods. With sibling tools like file_operations and system_info available, there's no indication of when mathematical calculations are appropriate versus those other operations.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
file_operationsC
Read, write, and list files in the current workspace
| Name | Required | Description | Default |
|---|---|---|---|
| operation | Yes | The file operation to perform | |
| path | Yes | File or directory path (relative to workspace) | |
| content | No | Content to write (required for write operation) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions the three operation types, it doesn't describe what 'read' returns, how 'write' handles existing files, what 'list' includes, what 'info' provides, workspace boundaries, error conditions, or permission requirements. This is inadequate for a multi-operation tool with mutation capabilities.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise (7 words) and front-loaded with all essential information. Every word earns its place by covering the core functionality without redundancy or unnecessary elaboration.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a multi-operation tool with write capabilities and no annotations or output schema, the description is insufficient. It doesn't explain return values, error handling, workspace constraints, or behavioral differences between operations. The agent lacks critical information needed to use this tool effectively.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema. The baseline score of 3 reflects adequate schema coverage without description enhancement.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with specific verbs (read, write, list) and resource (files in current workspace). It distinguishes this tool from its siblings (calculator, system_info) by focusing on file operations. However, it doesn't explicitly differentiate between the different operation types within the tool itself.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives or when specific operations are appropriate. There's no mention of prerequisites, constraints, or comparison with other file management approaches. The agent must infer usage from the operation parameter alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
system_infoB
Get information about the system (platform, CPU, memory, uptime)
| Name | Required | Description | Default |
|---|---|---|---|
| detail | No | Level of detail (basic or full) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. While it indicates a read operation ('Get'), it lacks details on permissions needed, rate limits, error conditions, or what the return format looks like (e.g., structured data vs. raw text). This is a significant gap for a tool with no annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core purpose ('Get information about the system') and lists specific components (platform, CPU, memory, uptime). There is zero waste or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (one optional parameter with full schema coverage) and no output schema, the description is adequate but incomplete. It covers the purpose well but lacks behavioral context and usage guidelines, which are important for an agent to use it effectively without annotations.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description does not mention the 'detail' parameter or its semantics. However, the input schema has 100% description coverage, with a clear enum for 'basic' and 'full', so the schema does the heavy lifting. The baseline is 3 when schema coverage is high, even without param info in the description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'Get' and the resource 'information about the system', specifying the exact scope: platform, CPU, memory, and uptime. It distinguishes itself from sibling tools like 'calculator' and 'file_operations' by focusing on system diagnostics rather than calculations or file management.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives. The description does not mention any prerequisites, exclusions, or specific contexts for usage, leaving the agent to infer based on the tool's name and purpose alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v1.0.0- First observed
calculator - First observed
file_operations - First observed
system_info
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose with no overlap: calculator handles math, file_operations manages files, and system_info provides system data. An agent can easily tell them apart based on their domains.
All tool names follow a consistent snake_case pattern with clear noun-based naming (calculator, file_operations, system_info). There are no deviations or mixed conventions.
With only 3 tools, the set feels thin for a 'Learning Project' server that might benefit from more educational or varied utilities. While each tool is distinct, the count is borderline low for broader scope.
The tools cover basic domains (math, file I/O, system info) well, but there are minor gaps for a learning context, such as missing tools for networking, data processing, or interactive tutorials that could enhance educational value.
Maintenance
Related MCP Connectors
Nifty's MCP server β exposes tasks, projects, messages, and files as tools for AI agents.
A MCP server built for developers enabling Git based project management with project and personalβ¦
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yoβ¦
MCP Server for an Agent Task Marketplace
Related MCP Servers
- FlicenseBqualityDmaintenanceA comprehensive learning project providing hands-on experience with Model Context Protocol (MCP) server development, featuring calculator and text utility tools for integration with Claude Desktop.1-
- FlicenseNot gradedqualityDmaintenanceA basic educational MCP server that provides simple tools for mathematical calculations, text manipulation, and time retrieval. Designed for learning MCP implementation patterns and development purposes.-
- FlicenseAqualityDmaintenanceA demonstration MCP server built with FastMCP v2.0 that provides basic mathematical calculations and greeting functionality. Features Docker containerization, comprehensive testing, and CI/CD automation for learning MCP development patterns.2-
- AlicenseNot gradedqualityDmaintenanceA comprehensive MCP server that enables file operations, mathematical calculations with unit conversions, and system information retrieval. Provides secure access to local file system, calculator functions with statistics, and system monitoring capabilities.9 npmISC