├── .github ├── pull_request_template.md └── workflows │ ├── mcp_clients_lint.yml │ ├── mcp_servers_lint.yml │ └── python-app.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── examples ├── connect-mcp-server │ ├── .env.example │ ├── requirements.txt │ └── script.py ├── function-calling │ ├── .python-version │ ├── README.md │ ├── main.py │ ├── pyproject.toml │ └── uv.lock ├── simple-chat-with-toggle │ ├── .gitignore │ ├── README.md │ ├── components.json │ ├── eslint.config.mjs │ ├── next.config.ts │ ├── package-lock.json │ ├── package.json │ ├── postcss.config.mjs │ ├── public │ │ ├── file.svg │ │ ├── globe.svg │ │ ├── next.svg │ │ ├── vercel.svg │ │ └── window.svg │ ├── src │ │ ├── app │ │ │ ├── favicon.ico │ │ │ ├── globals.css │ │ │ ├── layout.tsx │ │ │ └── page.tsx │ │ └── components │ │ │ ├── ChatInput.tsx │ │ │ ├── ChatMessage.tsx │ │ │ └── ui │ │ │ ├── button.tsx │ │ │ ├── card.tsx │ │ │ └── textarea.tsx │ └── tsconfig.json └── with_mcp_clients │ ├── .python-version │ ├── README.md │ ├── main.py │ └── pyproject.toml ├── mcp-clients ├── .dockerignore ├── .env.example ├── .gitignore ├── .python-version ├── Dockerfile.discord ├── Dockerfile.slack ├── Dockerfile.web ├── Dockerfile.whatsapp ├── README-Discord.md ├── README-Slack.md ├── README-Web.md ├── README-WhatsApp.md ├── README.md ├── pyproject.toml ├── src │ └── mcp_clients │ │ ├── __init__.py │ │ ├── base_bot.py │ │ ├── config.py │ │ ├── discord_bot.py │ │ ├── llms │ │ ├── __init__.py │ │ ├── anthropic.py │ │ ├── base.py │ │ ├── configs.py │ │ └── openai.py │ │ ├── local_mcp_servers.json │ │ ├── mcp_client.py │ │ ├── slack │ │ ├── __init__.py │ │ ├── context.py │ │ ├── event_routes.py │ │ ├── interactive_handlers.py │ │ ├── message_handlers.py │ │ ├── oauth_routes.py │ │ └── settings.py │ │ ├── slack_bot.py │ │ ├── sse_client.py │ │ ├── streamable_http_client.py │ │ ├── web_bot.py │ │ └── whatsapp_bot.py └── uv.lock ├── mcp_servers ├── .eslintignore ├── .eslintrc.js ├── .prettierignore ├── .prettierrc.json ├── attio │ ├── .env.example │ ├── .eslintrc.json │ ├── Dockerfile │ ├── README.md │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── cloudflare │ └── graphql │ │ ├── .env.example │ │ ├── .eslintrc.cjs │ │ ├── Dockerfile │ │ ├── index.ts │ │ ├── package.json │ │ ├── src │ │ ├── graphql.app.ts │ │ ├── graphql.context.ts │ │ └── tools │ │ │ └── graphql.tools.ts │ │ ├── tsconfig.json │ │ └── types.d.ts ├── confluence │ ├── Dockerfile │ ├── requirements.txt │ ├── server.py │ └── tools │ │ ├── __init__.py │ │ ├── client.py │ │ ├── comments.py │ │ ├── config.py │ │ ├── constants.py │ │ ├── labels.py │ │ ├── pages.py │ │ ├── search.py │ │ ├── spaces.py │ │ ├── users.py │ │ └── utils.py ├── discord │ ├── .env.example │ ├── Dockerfile │ ├── README.md │ ├── requirements.txt │ └── server.py ├── figma │ ├── .eslintrc.json │ ├── Dockerfile │ ├── cli.ts │ ├── config.ts │ ├── index.ts │ ├── mcp.ts │ ├── package.json │ ├── server.ts │ ├── services │ │ ├── figma.ts │ │ └── simplify-node-response.ts │ ├── transformers │ │ ├── effects.ts │ │ ├── layout.ts │ │ └── style.ts │ ├── tsconfig.json │ └── utils │ │ ├── common.ts │ │ ├── identity.ts │ │ └── logger.ts ├── firecrawl │ ├── .env.example │ ├── .eslintrc.json │ ├── Dockerfile │ ├── README.md │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── firecrawl_deep_research │ ├── .env.example │ ├── .eslintrc.json │ ├── Dockerfile │ ├── README.md │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── github │ ├── .env.example │ ├── Dockerfile │ ├── README.md │ ├── github-mcp-server │ ├── go.mod │ ├── go.sum │ ├── pkg │ │ ├── github │ │ │ ├── code_scanning.go │ │ │ ├── code_scanning_test.go │ │ │ ├── helper_test.go │ │ │ ├── issues.go │ │ │ ├── issues_test.go │ │ │ ├── pullrequests.go │ │ │ ├── pullrequests_test.go │ │ │ ├── repositories.go │ │ │ ├── repositories_test.go │ │ │ ├── repository_resource.go │ │ │ ├── repository_resource_test.go │ │ │ ├── search.go │ │ │ ├── search_test.go │ │ │ ├── server.go │ │ │ └── server_test.go │ │ ├── log │ │ │ ├── io.go │ │ │ └── io_test.go │ │ └── translations │ │ │ └── translations.go │ └── server.go ├── gmail │ ├── Dockerfile │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── index.ts │ │ └── utl.ts │ └── tsconfig.json ├── google_calendar │ ├── .env.example │ ├── Dockerfile │ ├── requirements.txt │ └── server.py ├── google_docs │ ├── .env.example │ ├── Dockerfile │ ├── requirements.txt │ └── server.py ├── google_drive │ ├── .env.example │ ├── Dockerfile │ ├── requirements.txt │ ├── server.py │ └── utils.py ├── google_sheets │ ├── .env.example │ ├── Dockerfile │ ├── models.py │ ├── requirements.txt │ ├── server.py │ └── utils.py ├── google_slides │ ├── .env.example │ ├── Dockerfile │ ├── README.md │ ├── requirements.txt │ └── server.py ├── jira │ ├── Dockerfile │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── linear │ ├── .env.example │ ├── Dockerfile │ ├── requirements.txt │ ├── server.py │ └── tools │ │ ├── __init__.py │ │ ├── base.py │ │ ├── comments.py │ │ ├── issues.py │ │ ├── projects.py │ │ └── teams.py ├── markitdown │ ├── Dockerfile │ ├── README.md │ ├── requirements.txt │ └── server.py ├── notion │ ├── .dockerignore │ ├── .env.example │ ├── .gitignore │ ├── Dockerfile │ ├── README.md │ ├── docker-compose.yml │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ ├── scripts │ │ ├── build-cli.js │ │ ├── notion-openapi.json │ │ └── start-server.ts │ ├── src │ │ ├── init-server.ts │ │ └── openapi-mcp-server │ │ │ ├── client │ │ │ ├── __tests__ │ │ │ │ ├── http-client-upload.test.ts │ │ │ │ ├── http-client.integration.test.ts │ │ │ │ └── http-client.test.ts │ │ │ └── http-client.ts │ │ │ ├── index.ts │ │ │ ├── mcp │ │ │ ├── __tests__ │ │ │ │ └── proxy.test.ts │ │ │ └── proxy.ts │ │ │ └── openapi │ │ │ ├── __tests__ │ │ │ ├── file-upload.test.ts │ │ │ ├── parser-multipart.test.ts │ │ │ └── parser.test.ts │ │ │ ├── file-upload.ts │ │ │ └── parser.ts │ └── tsconfig.json ├── package-lock.json ├── package.json ├── pandoc │ ├── .env.example │ ├── Dockerfile │ ├── README.md │ ├── requirements.txt │ └── server.py ├── perplexity │ ├── .eslintrc.json │ ├── Dockerfile │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── postgres │ ├── .env.example │ ├── .eslintrc.json │ ├── Dockerfile │ ├── README.md │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── report_generation │ ├── .env.example │ ├── Dockerfile │ ├── README.md │ ├── requirements.txt │ └── server.py ├── resend │ ├── .env.example │ ├── .eslintrc.json │ ├── Dockerfile │ ├── README.md │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── salesforce │ ├── .env.example │ ├── Dockerfile │ ├── requirements.txt │ └── server.py ├── shopify │ ├── .env.example │ ├── .eslintrc.json │ ├── Dockerfile │ ├── README.md │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ ├── tools.ts │ ├── tsconfig.json │ └── types.ts ├── slack │ ├── .env.example │ ├── .eslintrc.json │ ├── Dockerfile │ ├── README.md │ ├── common │ │ └── errors.ts │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── stripe │ ├── Dockerfile │ ├── requirements.txt │ └── src │ │ ├── __init__.py │ │ ├── server.py │ │ └── tools.py ├── supabase │ ├── .env.example │ ├── .eslintrc.json │ ├── Dockerfile │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── logs.ts │ │ ├── management-api │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── password.test.ts │ │ ├── password.ts │ │ ├── pg-meta │ │ │ ├── columns.sql │ │ │ ├── extensions.sql │ │ │ ├── index.ts │ │ │ ├── tables.sql │ │ │ └── types.ts │ │ ├── pricing.ts │ │ ├── regions.test.ts │ │ ├── regions.ts │ │ ├── server.test.ts │ │ ├── server.ts │ │ ├── sse.ts │ │ ├── types │ │ │ └── sql.d.ts │ │ ├── util.test.ts │ │ └── util.ts │ ├── test │ │ ├── extensions.d.ts │ │ ├── extensions.ts │ │ ├── llm.e2e.ts │ │ └── mocks.ts │ ├── tsconfig.json │ ├── tsup.config.ts │ ├── vitest.setup.ts │ └── vitest.workspace.ts ├── tsconfig.json ├── wordpress │ ├── .eslintrc.json │ ├── Dockerfile │ ├── README.md │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json └── youtube │ ├── .env.example │ ├── Dockerfile │ ├── README.md │ ├── requirements.txt │ └── server.py ├── openapi-config.json ├── openapitools.json ├── package-lock.json ├── sdks ├── openapi-templates │ └── python-sdk-templates │ │ ├── LICENSE.mustache │ │ ├── README.mustache │ │ ├── README_onlypackage.mustache │ │ ├── __init__.mustache │ │ ├── __init__api.mustache │ │ ├── __init__model.mustache │ │ ├── __init__package.mustache │ │ ├── api.mustache │ │ ├── api_client.mustache │ │ ├── api_doc.mustache │ │ ├── api_doc_example.mustache │ │ ├── api_response.mustache │ │ ├── asyncio │ │ └── rest.mustache │ │ ├── common_README.mustache │ │ ├── configuration.mustache │ │ ├── exceptions.mustache │ │ ├── git_push.sh.mustache │ │ ├── github-workflow.mustache │ │ ├── gitignore.mustache │ │ ├── gitlab-ci.mustache │ │ ├── model.mustache │ │ ├── model_anyof.mustache │ │ ├── model_doc.mustache │ │ ├── model_enum.mustache │ │ ├── model_generic.mustache │ │ ├── model_oneof.mustache │ │ ├── partial_api.mustache │ │ ├── partial_api_args.mustache │ │ ├── partial_header.mustache │ │ ├── py.typed.mustache │ │ ├── pyproject.mustache │ │ ├── python_doc_auth_partial.mustache │ │ ├── requirements.mustache │ │ ├── rest.mustache │ │ ├── setup.mustache │ │ ├── setup_cfg.mustache │ │ ├── signing.mustache │ │ ├── test-requirements.mustache │ │ ├── tornado │ │ └── rest.mustache │ │ ├── tox.mustache │ │ └── travis.mustache └── python │ ├── .github │ └── workflows │ │ └── python.yml │ ├── .gitignore │ ├── .gitlab-ci.yml │ ├── .openapi-generator-ignore │ ├── .openapi-generator │ ├── FILES │ └── VERSION │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── docs │ ├── CallToolRequest.md │ ├── CallToolResponse.md │ ├── CallToolResult.md │ ├── CreateServerRequest.md │ ├── CreateServerResponse.md │ ├── CreateWhiteLabelingRequest.md │ ├── GetInstanceResponse.md │ ├── GetMcpServersResponse.md │ ├── GetToolsResponse.md │ ├── GithubOauthApi.md │ ├── GithubOauthErrorResponse.md │ ├── GithubOauthSuccessResponse.md │ ├── HTTPValidationError.md │ ├── JiraOauthApi.md │ ├── JiraOauthErrorResponse.md │ ├── JiraOauthSuccessResponse.md │ ├── ListToolResponse.md │ ├── McpServer.md │ ├── McpServerApi.md │ ├── NotionOauthApi.md │ ├── NotionOauthErrorResponse.md │ ├── NotionOauthSuccessResponse.md │ ├── ServerName.md │ ├── ServerTool.md │ ├── SetAuthTokenRequest.md │ ├── SlackOauthApi.md │ ├── SlackOauthErrorResponse.md │ ├── SlackOauthSuccessResponse.md │ ├── StatusResponse.md │ ├── SupabaseOauthApi.md │ ├── SupabaseOauthErrorResponse.md │ ├── SupabaseOauthSuccessResponse.md │ ├── ValidationError.md │ ├── ValidationErrorLocInner.md │ ├── WhiteLabelServerName.md │ ├── WhiteLabelingApi.md │ ├── WhiteLabelingResponse.md │ ├── WordpressOauthApi.md │ ├── WordpressOauthErrorResponse.md │ └── WordpressOauthSuccessResponse.md │ ├── git_push.sh │ ├── klavis │ ├── __init__.py │ ├── api │ │ ├── __init__.py │ │ ├── github_oauth_api.py │ │ ├── jira_oauth_api.py │ │ ├── mcp_server_api.py │ │ ├── notion_oauth_api.py │ │ ├── slack_oauth_api.py │ │ ├── supabase_oauth_api.py │ │ ├── white_labeling_api.py │ │ └── wordpress_oauth_api.py │ ├── api_client.py │ ├── api_response.py │ ├── configuration.py │ ├── exceptions.py │ ├── models │ │ ├── __init__.py │ │ ├── call_tool_request.py │ │ ├── call_tool_response.py │ │ ├── call_tool_result.py │ │ ├── create_server_request.py │ │ ├── create_server_response.py │ │ ├── create_white_labeling_request.py │ │ ├── get_instance_response.py │ │ ├── get_mcp_servers_response.py │ │ ├── get_tools_response.py │ │ ├── github_oauth_error_response.py │ │ ├── github_oauth_success_response.py │ │ ├── http_validation_error.py │ │ ├── jira_oauth_error_response.py │ │ ├── jira_oauth_success_response.py │ │ ├── list_tool_response.py │ │ ├── mcp_server.py │ │ ├── notion_oauth_error_response.py │ │ ├── notion_oauth_success_response.py │ │ ├── server_name.py │ │ ├── server_tool.py │ │ ├── set_auth_token_request.py │ │ ├── slack_oauth_error_response.py │ │ ├── slack_oauth_success_response.py │ │ ├── status_response.py │ │ ├── supabase_oauth_error_response.py │ │ ├── supabase_oauth_success_response.py │ │ ├── validation_error.py │ │ ├── validation_error_loc_inner.py │ │ ├── white_label_server_name.py │ │ ├── white_labeling_response.py │ │ ├── wordpress_oauth_error_response.py │ │ └── wordpress_oauth_success_response.py │ ├── py.typed │ └── rest.py │ ├── pyproject.toml │ ├── requirements.txt │ ├── setup.cfg │ ├── setup.py │ ├── test-requirements.txt │ └── tox.ini └── static └── klavis-ai.png /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | 4 | ## Related issue 5 | 6 | 7 | 8 | ## Type of change 9 | 10 | - [ ] Bug fix (non-breaking change which fixes an issue) 11 | - [ ] New MCP feature (non-breaking change which adds functionality) 12 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 13 | - [ ] Documentation update 14 | - [ ] Other (please specify) 15 | 16 | ## How has this been tested? 17 | (Add screenshots or recordings here if applicable.) 18 | 19 | 20 | ## Checklist 21 | 22 | - [ ] I have performed a self-review of my own code 23 | - [ ] I have commented my code, particularly in hard-to-understand areas 24 | - [ ] I have made corresponding changes to the documentation 25 | - [ ] My changes generate no new warnings 26 | - [ ] I have added tests that prove my fix is effective or that my feature works 27 | - [ ] New and existing tests pass locally with my changes -------------------------------------------------------------------------------- /.github/workflows/python-app.yml: -------------------------------------------------------------------------------- 1 | name: Klavis AI Python SDK Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*.*.*' # Trigger on tags like v0.1.0, v1.2.3, etc. 7 | 8 | permissions: 9 | contents: write # Needed to create GitHub releases 10 | id-token: write # Needed for trusted publishing to PyPI 11 | 12 | jobs: 13 | deploy: 14 | runs-on: ubuntu-latest 15 | environment: pypi # Add environment name 16 | # Only run this job if the tag matches the version in pyproject.toml 17 | # This requires an extra step to read the version, omitted for simplicity for now 18 | # Add validation if needed: https://github.com/marketplace/actions/check-python-versions 19 | 20 | steps: 21 | - uses: actions/checkout@v4 22 | 23 | - name: Set up Python 24 | uses: actions/setup-python@v5 25 | with: 26 | python-version: '3.12' # Choose a Python version, adjust as needed 27 | 28 | - name: Install dependencies 29 | run: | 30 | python -m pip install --upgrade pip 31 | pip install setuptools wheel twine build 32 | working-directory: ./sdks/python 33 | 34 | - name: Build package 35 | run: python -m build 36 | working-directory: ./sdks/python 37 | 38 | - name: Publish package to PyPI 39 | uses: pypa/gh-action-pypi-publish@release/v1 40 | with: 41 | packages_dir: sdks/python/dist/ 42 | # No API token needed with Trusted Publisher 43 | 44 | - name: Create GitHub Release 45 | uses: softprops/action-gh-release@v1 46 | with: 47 | # The release name will be the tag name (e.g., "v0.0.4") 48 | # The body will be auto-generated based on commits since the last tag 49 | generate_release_notes: true 50 | env: 51 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 52 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Environment variables 2 | .env 3 | 4 | # Byte-compiled / optimized / DLL files 5 | __pycache__/ 6 | *.py[cod] 7 | *$py.class 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a CI script 30 | # One normally never wants to keep them 31 | *.manifest 32 | *.spec 33 | 34 | # Jupyter Notebook 35 | .ipynb_checkpoints 36 | 37 | # Instance Environment 38 | instance/ 39 | .webassets-cache 40 | 41 | # Temporary files 42 | *.swp 43 | *~ 44 | *.bak 45 | *.tmp 46 | 47 | # OS generated files 48 | .DS_Store 49 | Thumbs.db 50 | 51 | # IDE specific files 52 | .idea/ 53 | .vscode/ 54 | *.iml 55 | *.project 56 | .classpath 57 | *.launch 58 | 59 | # Node.js 60 | **/node_modules/ 61 | npm-debug.log* 62 | yarn-debug.log* 63 | yarn-error.log* 64 | pnpm-debug.log* 65 | lerna-debug.log* 66 | coverage/ 67 | dist/ 68 | .npm 69 | .yarnrc 70 | .yarn/cache 71 | .yarn/plugnplay 72 | .yarn/unplugged 73 | .pnpm-store/ 74 | 75 | # Docker 76 | .docker/ 77 | 78 | # Python 79 | .venv/ 80 | 81 | # submodules 82 | .gitmodules -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Klavis AI 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/connect-mcp-server/.env.example: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klavis-AI/klavis/c3a0793edc5fc56206e522adec0da9cf1c298b03/examples/connect-mcp-server/.env.example -------------------------------------------------------------------------------- /examples/connect-mcp-server/requirements.txt: -------------------------------------------------------------------------------- 1 | requests>=2.31.0 2 | python-dotenv>=1.1.0 -------------------------------------------------------------------------------- /examples/connect-mcp-server/script.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Simple script to create Klavis MCP server instance and redirect to OAuth authorization. 4 | """ 5 | 6 | import requests 7 | import webbrowser 8 | import os 9 | from dotenv import load_dotenv 10 | 11 | load_dotenv() 12 | API_KEY = os.getenv('KLAVIS_API_KEY') 13 | 14 | # Create MCP server instance 15 | def create_mcp_instance(server_name, user_id, platform_name): 16 | url = "https://api.klavis.ai/mcp-server/instance/create" 17 | 18 | headers = { 19 | "Authorization": f"Bearer {API_KEY}", 20 | "Content-Type": "application/json" 21 | } 22 | 23 | data = { 24 | "serverName": server_name, 25 | "userId": user_id, 26 | "platformName": platform_name 27 | } 28 | 29 | response = requests.post(url, headers=headers, json=data) 30 | 31 | result = response.json() 32 | print(result) 33 | return result['instanceId'] 34 | 35 | 36 | # Redirect to OAuth authorization page 37 | def redirect_to_oauth(instance_id): 38 | oauth_url = f"https://api.klavis.ai/oauth/github/authorize?instance_id={instance_id}" 39 | webbrowser.open(oauth_url) 40 | 41 | def main(): 42 | instance_id = create_mcp_instance("GitHub", "1234", "demo") 43 | redirect_to_oauth(instance_id) 44 | 45 | if __name__ == "__main__": 46 | main() -------------------------------------------------------------------------------- /examples/function-calling/.python-version: -------------------------------------------------------------------------------- 1 | 3.12 2 | -------------------------------------------------------------------------------- /examples/function-calling/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klavis-AI/klavis/c3a0793edc5fc56206e522adec0da9cf1c298b03/examples/function-calling/README.md -------------------------------------------------------------------------------- /examples/function-calling/main.py: -------------------------------------------------------------------------------- 1 | import os 2 | from klavis import ApiClient, Configuration 3 | from klavis.api import McpServerApi 4 | from klavis.models import CreateServerRequest, ServerName 5 | 6 | def main(): 7 | api_key = os.environ.get("KLAVIS_API_KEY", "YOUR_API_KEY") 8 | if api_key == "YOUR_API_KEY": 9 | print("Warning: API Key not configured. Please set the KLAVIS_API_KEY environment variable or replace 'YOUR_API_KEY'.") 10 | 11 | config = Configuration( 12 | host="https://api.klavis.ai", 13 | api_key=api_key, 14 | ) 15 | api_client = ApiClient(config) 16 | mcp_api = McpServerApi(api_client) 17 | 18 | create_request = CreateServerRequest( 19 | server_name=ServerName.GITHUB, 20 | user_id="1234", 21 | platform_name="zihao_test" 22 | ) 23 | instance = mcp_api.create_server_instance(create_request) 24 | 25 | print(instance.instance_id) 26 | 27 | if __name__ == "__main__": 28 | main() 29 | -------------------------------------------------------------------------------- /examples/function-calling/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "function-calling" 3 | version = "0.1.0" 4 | description = "Add your description here" 5 | readme = "README.md" 6 | requires-python = ">=3.12" 7 | dependencies = [ 8 | "klavis>=0.0.6", 9 | "openai>=1.78.1", 10 | ] 11 | -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.* 7 | .yarn/* 8 | !.yarn/patches 9 | !.yarn/plugins 10 | !.yarn/releases 11 | !.yarn/versions 12 | 13 | # testing 14 | /coverage 15 | 16 | # next.js 17 | /.next/ 18 | /out/ 19 | 20 | # production 21 | /build 22 | 23 | # misc 24 | .DS_Store 25 | *.pem 26 | 27 | # debug 28 | npm-debug.log* 29 | yarn-debug.log* 30 | yarn-error.log* 31 | .pnpm-debug.log* 32 | 33 | # env files (can opt-in for committing if needed) 34 | .env* 35 | 36 | # vercel 37 | .vercel 38 | 39 | # typescript 40 | *.tsbuildinfo 41 | next-env.d.ts 42 | -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/README.md: -------------------------------------------------------------------------------- 1 | This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). 2 | 3 | ## Getting Started 4 | 5 | First, run the development server: 6 | 7 | ```bash 8 | npm run dev 9 | # or 10 | yarn dev 11 | # or 12 | pnpm dev 13 | # or 14 | bun dev 15 | ``` 16 | 17 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. 18 | 19 | You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. 20 | 21 | This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. 22 | 23 | ## Learn More 24 | 25 | To learn more about Next.js, take a look at the following resources: 26 | 27 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. 28 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. 29 | 30 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! 31 | 32 | ## Deploy on Vercel 33 | 34 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. 35 | 36 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. 37 | -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "", 8 | "css": "src/app/globals.css", 9 | "baseColor": "neutral", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils", 16 | "ui": "@/components/ui", 17 | "lib": "@/lib", 18 | "hooks": "@/hooks" 19 | }, 20 | "iconLibrary": "lucide" 21 | } -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import { dirname } from "path"; 2 | import { fileURLToPath } from "url"; 3 | import { FlatCompat } from "@eslint/eslintrc"; 4 | 5 | const __filename = fileURLToPath(import.meta.url); 6 | const __dirname = dirname(__filename); 7 | 8 | const compat = new FlatCompat({ 9 | baseDirectory: __dirname, 10 | }); 11 | 12 | const eslintConfig = [ 13 | ...compat.extends("next/core-web-vitals", "next/typescript"), 14 | ]; 15 | 16 | export default eslintConfig; 17 | -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/next.config.ts: -------------------------------------------------------------------------------- 1 | import type { NextConfig } from "next"; 2 | 3 | const nextConfig: NextConfig = { 4 | /* config options here */ 5 | }; 6 | 7 | export default nextConfig; 8 | -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple-chat-with-toggle", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev --turbopack", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "@radix-ui/react-slot": "^1.2.3", 13 | "@radix-ui/react-switch": "^1.2.5", 14 | "class-variance-authority": "^0.7.1", 15 | "clsx": "^2.1.1", 16 | "lucide-react": "^0.511.0", 17 | "next": "15.3.2", 18 | "react": "^19.0.0", 19 | "react-dom": "^19.0.0", 20 | "tailwind-merge": "^3.3.0" 21 | }, 22 | "devDependencies": { 23 | "@eslint/eslintrc": "^3", 24 | "@tailwindcss/postcss": "^4", 25 | "@types/node": "^20", 26 | "@types/react": "^19", 27 | "@types/react-dom": "^19", 28 | "eslint": "^9", 29 | "eslint-config-next": "15.3.2", 30 | "tailwindcss": "^4", 31 | "tw-animate-css": "^1.3.0", 32 | "typescript": "^5" 33 | }, 34 | "packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977" 35 | } 36 | -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | const config = { 2 | plugins: ["@tailwindcss/postcss"], 3 | }; 4 | 5 | export default config; 6 | -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/public/file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/public/globe.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/public/next.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/public/window.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klavis-AI/klavis/c3a0793edc5fc56206e522adec0da9cf1c298b03/examples/simple-chat-with-toggle/src/app/favicon.ico -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/src/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | import { Inter } from "next/font/google"; 3 | import "./globals.css"; 4 | 5 | const inter = Inter({ subsets: ["latin"], variable: "--font-sans" }); 6 | 7 | export const metadata: Metadata = { 8 | title: "Simple Chat Playground", 9 | description: "Simple chat interface with toggleable response modes", 10 | }; 11 | 12 | export default function RootLayout({ 13 | children, 14 | }: Readonly<{ 15 | children: React.ReactNode; 16 | }>) { 17 | return ( 18 | 19 | 20 | {children} 21 | 22 | 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /examples/simple-chat-with-toggle/src/components/ChatInput.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react' 2 | import { Button } from '@/components/ui/button' 3 | import { Textarea } from '@/components/ui/textarea' 4 | import { Send } from 'lucide-react' 5 | 6 | interface ChatInputProps { 7 | onSendMessage: (message: string) => void 8 | isLoading: boolean 9 | } 10 | 11 | export function ChatInput({ onSendMessage, isLoading }: ChatInputProps) { 12 | const [input, setInput] = useState('') 13 | 14 | const handleSubmit = (e: React.FormEvent) => { 15 | e.preventDefault() 16 | if (input.trim() && !isLoading) { 17 | onSendMessage(input) 18 | setInput('') 19 | } 20 | } 21 | 22 | const handleKeyDown = (e: React.KeyboardEvent) => { 23 | if (e.key === 'Enter' && !e.shiftKey) { 24 | e.preventDefault() 25 | handleSubmit(e as unknown as React.FormEvent) 26 | } 27 | } 28 | 29 | return ( 30 |
31 |