Markdown Content: wxflows/examples/mcp/javascript at main · IBM/wxflows · GitHub
===============
Skip to content Navigation Menu
Toggle navigation
Appearance settings
- Product
* [GitHub Copilot Write better code with AI](https://github.com/features/copilot)
* [GitHub Spark New Build and deploy intelligent apps](https://github.com/features/spark)
* [GitHub Models New Manage and compare prompts](https://github.com/features/models)
* [GitHub Advanced Security Find and fix vulnerabilities](https://github.com/security/advanced-security)
* [Actions Automate any workflow](https://github.com/features/actions)
* [Codespaces Instant dev environments](https://github.com/features/codespaces)
* [Issues Plan and track work](https://github.com/features/issues)
* [Code Review Manage code changes](https://github.com/features/code-review)
* [Discussions Collaborate outside of code](https://github.com/features/discussions)
* [Code Search Find more, search less](https://github.com/features/code-search)
Explore * Why GitHub * All features * Documentation * GitHub Skills * Blog
- Solutions
By company size * Enterprises * Small and medium teams * Startups * Nonprofits
By use case * DevSecOps * DevOps * CI/CD * View all use cases
By industry * Healthcare * Financial services * Manufacturing * Government * View all industries
- Resources
Topics * AI * DevOps * Security * Software Development * View all
Explore * Learning Pathways * Events & Webinars * Ebooks & Whitepapers * Customer Stories * Partners * Executive Insights
- Open Source
* [GitHub Sponsors Fund open source developers](https://github.com/sponsors)
* [The ReadME Project GitHub community articles](https://github.com/readme)
Repositories * Topics * Trending * Collections
- Enterprise
* [Enterprise platform AI-powered developer platform](https://github.com/enterprise)
Available add-ons * GitHub Advanced Security Enterprise-grade security features * Copilot for business Enterprise-grade AI features * Premium Support Enterprise-grade 24/7 support
Search or jump to...
Search code, repositories, users, issues, pull requests...
Search
Clear
Provide feedback
We read every piece of feedback, and take your input very seriously.
- [x] Include my email address so I can be contacted
Cancel Submit feedback
Saved searches
Use saved searches to filter your results more quickly
Name
Query
To see all available qualifiers, see our documentation.
Cancel Create saved search
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
-
NotificationsYou must be signed in to change notification settings
-
Security### Uh oh! There was an error while loading.Please reload this page.
Additional navigation options
Collapse file tree
Files
main
Search this repository
-
assets -
examples-
agents -
chat-app -
langgraph-math-agent -
langgraph-youtube-agent -
mcp-
javascript-
src -
wxflows -
.env.sample -
.gitignore -
README.md -
package.json -
tsconfig.json
-
-
README.md
-
-
rag-question-answer -
text-to-sql-agent -
tool-calling -
webpage-summarization -
README.md
-
-
tools -
.gitignore -
LICENSE -
README.md -
wxflows-2.0.0.tgz
Breadcrumbs
/ javascript
/
Copy path
Directory actions
More options
More options
Directory actions
More options
More options
Latest commit
Remove duplicate step in mcp tutorial
Jan 17, 2025
c98055a·Jan 17, 2025
History
Open commit details
Breadcrumbs
/ javascript
/
Top
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
| ### parent directory .. | |||
| src | src | Allow non graphql tools in the mcp server | Jan 17, 2025 |
| wxflows | wxflows | update mcp example to use node.js cli | Jan 13, 2025 |
| .env.sample | .env.sample | Add new tools, langchain/langgraph example updates, mcp server exampl… | Dec 14, 2024 |
| .gitignore | .gitignore | Add new tools, langchain/langgraph example updates, mcp server exampl… | Dec 14, 2024 |
| README.md | README.md | Remove duplicate step in mcp tutorial | Jan 17, 2025 |
| package.json | package.json | Add new tools, langchain/langgraph example updates, mcp server exampl… | Dec 14, 2024 |
| tsconfig.json | tsconfig.json | Add new tools, langchain/langgraph example updates, mcp server exampl… | Dec 14, 2024 |
| View all files |
README.md
Outline
Using watsonx.ai Flows Engine with Model Context Protocol (MCP)
Here's a step-by-step tutorial for setting up and deploying a project with wxflows, including installing necessary tools, deploying the app, and running it locally.
This example consists of the following pieces:
- MCP TypeScript SDK (mcp server)
- wxflows SDK (tools)
You can use any of the supported MCP clients.
This guide will walk you through installing the wxflows CLI, initializing and deploying a project, and running the application locally. We’ll use google_books and wikipedia tools as examples for tool calling with wxflows.
Before you start
Clone this repository and open the right directory:
undefinedshell git clone https://github.com/IBM/wxflows.git cd examples/mcp/javascript undefined
Step 1: Set up wxflows
Before you can start building AI applications using watsonx.ai Flows Engine:
- Sign up for a free account
- Download & install the Node.js CLI
- Authenticate your account
Step 2: Deploy a Flows Engine project
Move into the wxflows directory:
undefinedshell cd wxflows undefined
There's already a wxflows project for you set up this repository with the following values:
- Defines an endpoint
api/mcp-examplefor the project. - Imports
google_bookstool with a description for searching books and specifying fieldsbooks|book. - Imports
wikipediatool with a description for Wikipedia searches and specifying fieldssearch|page.
You can deploy this tool configuration to a Flows Engine endpoint by running:
undefinedshell wxflows deploy undefined
This command deploys the endpoint and tools defined, these will be used by the wxflows SDK in your application.
Step 3: Set Up Environment Variables
From the project’s root directory copy the sample environment file to create your .env file:
undefinedshell cp .env.sample .env undefined
Edit the .env file and add your credentials, such as API keys and other required environment variables. Ensure the credentials are correct to allow the tools to authenticate and interact with external services.
Step 4: Install Dependencies in the Application
To run the application you need to install the necessary dependencies:
undefinedshell npm i undefined
This command installs all required packages, including the @wxflows/sdk package and any dependencies specified in the project.
Step 5: Build the MCP server
Build the server by running:
undefinedshell npm run build undefined
Step 6: Use in a MCP client
Finally, you can use the MCP server in a client. To use with Claude Desktop, add the server config:
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json On Windows: %APPDATA%/Claude/claude_desktop_config.json
undefinedjson { "mcpServers": { "wxflows-server": { "command": "node", "args": ["/path/to/wxflows-server/build/index.js"], "env": { "WXFLOWS_APIKEY": "YOUR_WXFLOWS_APIKEY", "WXFLOWS_ENDPOINT": "YOUR_WXFLOWS_ENDPOINT" } } } } undefined
You can now open Claude Desktop and should be seeing the tools from the wxflows-server listed. You can now test the google_books and wikipedia tools through Claude Desktop.
Summary
You’ve now successfully set up, deployed, and run a wxflows project with google_books and wikipedia tools. This setup provides a flexible environment to leverage external tools for data retrieval, allowing you to further build and expand your app with wxflows. See the instructions in tools to add more tools or create your own tools from Databases, NoSQL, REST or GraphQL APIs.
Support
Please reach out to us on Discord if you have any questions or want to share feedback. We'd love to hear from you!
Installation
To use with Claude Desktop, add the server config:
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json On Windows: %APPDATA%/Claude/claude_desktop_config.json
undefinedjson { "mcpServers": { "weather-server": { "command": "/path/to/weather-server/build/index.js" } } } undefined
Debugging
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:
undefinedshell npm run inspector undefined
The Inspector will provide a URL to access debugging tools in your browser.
Footer
Footer navigation
You can’t perform that action at this time.
Recommend MCP Servers 💡
@aixbt/mcp-server
A MCP server integrating AIXBT data API to provide context services.
mcp-alapi-cn
一个基于ALAPI的MCP服务器,通过MCP协议提供ALAPI的API服务,包括IP查询、天气、热搜等100+种常用API。
mcp-searxng
MCP Server for SearXNG
@shortcut/mcp
An MCP server that integrates with Shortcut, a project management tool, to provide project context and information to large language models.
NBA-stats-predictor
An MCP server that provides real-time NBA player performance forecasts using statistical modeling and real-time data analysis.
mcp_email_reader
MCP server to connect to an email server and read emails, exposing tools like search_emails, download_attachment, and list_folders