### MCP Server Startup Output Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Example output observed in the terminal after successfully starting the MCP server, indicating loaded tools and server version. ```text 2025-11-03 13:46:11.041 | DEBUG | arcade_mcp_server.mcp_app:add_tool:242 - Added tool: greet 2025-11-03 13:46:11.042 | DEBUG | arcade_mcp_server.mcp_app:add_tool:242 - Added tool: whisper_secret 2025-11-03 13:46:11.043 | DEBUG | arcade_mcp_server.mcp_app:add_tool:242 - Added tool: get_posts_in_subreddit INFO | 13:46:11 | arcade_mcp_server.mcp_app:299 | Starting my_server v1.0.0 with 3 tools ``` -------------------------------- ### Run Java Example Source: https://docs.arcade.dev/en/home/quickstart Run your Java application to see the output. The expected output confirms the successful chaining of tools. ```text Success! Check your email at brian.demers@gmail.com You just chained 3 tools together: 1. Searched Google News for stories about MCP URL mode elicitation 2. Created a Google Doc with the results 3. Sent yourself an email with the document link Email metadata: {id=19ba..., label_ids=[UNREAD, SENT, INBOX], thread_id=19ba..., url=https://mail.google.com/mail/u/0/#sent/19ba...} ``` -------------------------------- ### Run TypeScript Example Source: https://docs.arcade.dev/en/home/quickstart Execute the TypeScript example from your terminal. This command runs the example script. ```bash bun run example.ts ``` -------------------------------- ### Example MCP Server structure Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server This illustrates the file structure generated for a new MCP Server project, including the main server file, configuration, and environment examples. ```tree my_server/ ├── .env.example ├── src/ │ └── my_server/ │ ├── __init__.py │ └── server.py └── pyproject.toml ``` -------------------------------- ### Install Arcade CLI with uv Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Install the arcade-mcp package as a uv tool for system-wide availability. ```bash uv tool install arcade-mcp ``` -------------------------------- ### Install the TypeScript client package Source: https://docs.arcade.dev/en/home/quickstart Install the `@arcadeai/arcadejs` JavaScript client package using `bun install`. This command fetches and installs the necessary Arcade client library for your TypeScript project. ```bash bun install @arcadeai/arcadejs ``` -------------------------------- ### Copy .env.example to .env (Bash/Zsh) Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Use this command in Bash or Zsh to copy the example .env file to a new .env file, preparing it for your secrets. ```bash mv ../../.env.example ../../.env ``` -------------------------------- ### Install Arcade CLI with pip Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Install the arcade-mcp package using pip. ```bash pip install arcade-mcp ``` -------------------------------- ### Initialize Arcade Client and Authorize/Run Tools Source: https://docs.arcade.dev/en/home/quickstart Initialize the Arcade client with your API key and user ID. This example shows how to create a helper function to authorize and run tools, including handling cases where user authorization is required. It then chains three tools: searching Google News, creating a Google Doc, and sending an email with the document link. ```typescript import Arcade from "@arcadeai/arcadejs"; // You can also set the `ARCADE_API_KEY` environment variable instead of passing it as a parameter. const client = new Arcade( apiKey: "{arcade_api_key}", ); // Arcade needs a unique identifier for your application user (this could be an email address, a UUID, etc). // In this example, use the email you used to sign up for Arcade.dev: let userId = "{arcade_user_id}"; // Helper function to authorize and run any tool async function authorize_and_run_tool({ tool_name, input, user_id, }: { tool_name: string, input: any, user_id: string, }) { // Start the authorization process const authResponse = await client.tools.authorize({ tool_name: tool_name, user_id: user_id, }); // If the authorization is not completed, print the authorization URL and wait for the user to authorize the app. Tools that do not require authorization will have the status "completed" already. if (authResponse.status !== "completed") { console.log( `Click this link to authorize ${tool_name}:\n${authResponse.url}.\nThe process will continue once you have authorized the app.` ); // Wait for the user to authorize the app await client.auth.waitForCompletion(authResponse.id); } // Run the tool const response = await client.tools.execute({ tool_name: tool_name, input: input, user_id: user_id, }); return response; } // This tool does not require authorization, so it will return the results // without prompting the user to authorize the app. const response_search = await authorize_and_run_tool({ tool_name: "GoogleNews.SearchNewsStories", input: { keywords: "MCP URL mode elicitation", }, user_id: userId, }); // Get the news results from the response const news = response_search.output?.value?.news_results; // Format the news results into a string let output = "latest news about MCP URL mode elicitation:\n"; for (const search_result of news) { output += "--------------------------------\n"; output += `${search_result.source} - ${search_result.title}\n`; output += `${search_result.link ?? ""}\n`; } // Create a Google Doc with the news results // If the user has not previously authorized the Google Docs tool, they will be prompted to authorize the tool call. const respose_create_doc = await authorize_and_run_tool({ tool_name: "GoogleDocs.CreateDocumentFromText", input: { title: "News about MCP URL mode elicitation", text_content: output, }, user_id: userId, }); const google_doc = respose_create_doc.output?.value; // Send an email with the link to the Google Doc const email_body = `You can find the news about MCP URL mode elicitation in the following Google Doc: ${google_doc.documentUrl}`; // Here again, if the user has not previously authorized the Gmail tool, they will be prompted to authorize the tool call. const respose_send_email = await authorize_and_run_tool({ tool_name: "Gmail.SendEmail", input: { recipient: userId, subject: "News about MCP URL mode elicitation", body: email_body, }, user_id: userId, }); // Print the response from the tool call console.log( `Success! Check your email at ${userId}\n\nYou just chained 3 tools together:\n 1. Searched Google News for stories about MCP URL mode elicitation\n 2. Created a Google Doc with the results\n 3. Sent yourself an email with the document link\n\nEmail metadata:` ); console.log(respose_send_email.output?.value); ``` -------------------------------- ### Install the Python client package Source: https://docs.arcade.dev/en/home/quickstart Install the `arcadepy` Python client package using the `uv add` command. This makes the Arcade client functionalities available in your Python project. ```bash uv add arcadepy ``` -------------------------------- ### Python Example: Full File Source: https://docs.arcade.dev/en/home/quickstart This Python script demonstrates chaining three tools: Google News search, Google Docs creation, and Gmail sending. It includes a helper function for tool authorization and execution. ```python from arcadepy import Arcade # You can also set the `ARCADE_API_KEY` environment variable instead of passing it as a parameter. client = Arcade(api_key="{arcade_api_key}") # Arcade needs a unique identifier for your application user (this could be an email address, a UUID, etc). # In this example, use the email you used to sign up for Arcade.dev: user_id = "{arcade_user_id}" # Helper function to authorize and run any tool def authorize_and_run_tool(tool_name, input, user_id): # Start the authorization process auth_response = client.tools.authorize( tool_name=tool_name, user_id=user_id, ) # If the authorization is not completed, print the authorization URL and wait for the user to authorize the app. # Tools that do not require authorization will have the status "completed" already. if auth_response.status != "completed": print(f"Click this link to authorize {tool_name}:\n{auth_response.url}.\nThe process will continue once you have authorized the app.") client.auth.wait_for_completion(auth_response.id) # Run the tool return client.tools.execute(tool_name=tool_name, input=input, user_id=user_id) # This tool does not require authorization, so it will return the results # without prompting the user to authorize the tool call. response_search = authorize_and_run_tool( tool_name="GoogleNews.SearchNewsStories", input={ "keywords": "MCP URL mode elicitation", }, user_id=user_id, ) # Get the news results from the response news = response_search.output.value["news_results"] # Format the news results into a string output = "latest news about MCP URL mode elicitation:\n" for search_result in news: output += "----------------------------\n" output += f"{search_result['source']} - {search_result['title']}\n" output += f"{search_result['link']}\n" # Create a Google Doc with the news results # If the user has not previously authorized the Google Docs tool, they will be prompted to authorize the tool call. response_create_doc = authorize_and_run_tool( tool_name="GoogleDocs.CreateDocumentFromText", input={ "title": "News about MCP URL mode elicitation", "text_content": output, }, user_id=user_id, ) # Get the Google Doc from the response google_doc = response_create_doc.output.value email_body = f"You can find the news about MCP URL mode elicitation in the following Google Doc: {google_doc['documentUrl']}" # Send an email with the link to the Google Doc response_send_email = authorize_and_run_tool( tool_name="Gmail.SendEmail", input={ "recipient": user_id, "subject": "News about MCP URL mode elicitation", "body": email_body, }, user_id=user_id, ) # Print the response from the tool call print(f"Success! Check your email at {user_id}\n\nYou just chained 3 tools together:\n 1. Searched Google News for stories about MCP URL mode elicitation\n 2. Created a Google Doc with the results\n 3. Sent yourself an email with the document link\n\nEmail metadata:") print(response_send_email.output.value) ``` -------------------------------- ### Copy .env.example to .env (PowerShell) Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Use this command in PowerShell to copy the example .env file to a new .env file, preparing it for your secrets. ```powershell Copy-Item .env.example .env ``` -------------------------------- ### Implement a Workflow with Tool Chaining in Python Source: https://docs.arcade.dev/en/home/quickstart Example workflow demonstrating chaining multiple tool calls: searching for news, creating a Google Doc with the results, and emailing the document link. This showcases a practical application of the `authorize_and_run_tool` function. ```python # This tool does not require authorization, so it will return the results # without prompting the user to authorize the tool call. response_search = authorize_and_run_tool( tool_name="GoogleNews.SearchNewsStories", input={ "keywords": "MCP URL mode elicitation", }, user_id=user_id, ) # Get the news results from the response news = response_search.output.value["news_results"] # Format the news results into a string output = "latest news about MCP URL mode elicitation:\n" for search_result in news: output += f"{search_result['source']} - {search_result['title']}\n" output += f"{search_result['link']}\n\n" # Create a Google Doc with the news results # If the user has not previously authorized the Google Docs tool, they will be prompted to authorize the tool call. response_create_doc = authorize_and_run_tool( tool_name="GoogleDocs.CreateDocumentFromText", input={ "title": "News about MCP URL mode elicitation", "text_content": output, }, user_id=user_id, ) # Get the Google Doc from the response google_doc = response_create_doc.output.value email_body = f"You can find the news about MCP URL mode elicitation in the following Google Doc: {google_doc['documentUrl']}" # Send an email with the link to the Google Doc response_send_email = authorize_and_run_tool( tool_name="Gmail.SendEmail", input={ "recipient": user_id, "subject": "News about MCP URL mode elicitation", "body": email_body, }, user_id=user_id, ) # Print the response from the tool call print(f"Success! Check your email at {user_id}\n\nYou just chained 3 tools together:\n 1. Searched Google News for stories about MCP URL mode elicitation\n 2. Created a Google Doc with the results\n 3. Sent yourself an email with the document link\n\nEmail metadata:") print(response_send_email.output.value) ``` -------------------------------- ### Example Output of Tool Chaining Source: https://docs.arcade.dev/en/home/quickstart This is an example of the success message and email metadata received after chaining the Google News, Google Docs, and Gmail tools. It confirms the workflow completion and provides a link to the sent email. ```text Success! Check your email at {arcade_user_id} You just chained 3 tools together: 1. Searched Google News for stories about MCP URL mode elicitation 2. Created a Google Doc with the results 3. Sent yourself an email with the document link Email metadata: {'id': '19ba...', 'label_ids': ['UNREAD', 'SENT', 'INBOX'], 'thread_id': '19ba...', 'url': 'https://mail.google.com/mail/u/0/#sent/19ba...'} ``` -------------------------------- ### Basic MCP App Initialization in Python Source: https://docs.arcade.dev/en/learn/server-level-vs-tool-level-auth Initialize an MCPApp without specific authentication configurations. This is a starting point for servers that might later implement tool-level authorization or other features. ```python from typing import Annotated from arcade_mcp_server import Context, MCPApp from arcade_mcp_server.auth import GitHub import httpx app = MCPApp(name="my_server", version="1.0.0") ``` -------------------------------- ### Define a simple greet tool Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server This Python code defines a basic tool within an MCPApp that greets a person by name. Ensure the `arcade_mcp_server` package is installed. ```python #!/usr/bin/env python3 """my_server MCP server""" import sys from typing import Annotated import httpx from arcade_mcp_server import Context, MCPApp from arcade_mcp_server.auth import Reddit app = MCPApp(name="my_server", version="1.0.0", log_level="DEBUG") @app.tool def greet(name: Annotated[str, "The name of the person to greet"]) -> str: """Greet a person by name.""" return f"Hello, {name}!" # To use this tool locally, you need to either set the secret in the .env file or as an environment variable @app.tool(requires_secrets=["MY_SECRET_KEY"]) def whisper_secret(context: Context) -> Annotated[str, "The last 4 characters of the secret"]: """Reveal the last 4 characters of a secret""" # Secrets are injected into the context at runtime. # LLMs and MCP clients cannot see or access your secrets # You can define secrets in a .env file. try: secret = context.get_secret("MY_SECRET_KEY") except Exception as e: return str(e) return "The last 4 characters of the secret are: " + secret[-4:] # To use this tool locally, you need to install the Arcade CLI (uv tool install arcade-mcp) # and then run 'arcade login' to authenticate. @app.tool(requires_auth=Reddit(scopes=["read"])) async def get_posts_in_subreddit( context: Context, subreddit: Annotated[str, "The name of the subreddit"] ) -> dict: """Get posts from a specific subreddit""" # Normalize the subreddit name subreddit = subreddit.lower().replace("r/", "").replace(" ", "") # Prepare the httpx request # OAuth token is injected into the context at runtime. # LLMs and MCP clients cannot see or access your OAuth tokens. oauth_token = context.get_auth_token_or_empty() headers = { "Authorization": f"Bearer {oauth_token}", "User-Agent": "finally-mcp-server", } params = {"limit": 5} url = f"https://oauth.reddit.com/r/{subreddit}/hot" # Make the request async with httpx.AsyncClient() as client: response = await client.get(url, headers=headers, params=params) response.raise_for_status() # Return the response return response.json() ``` -------------------------------- ### Chain Google News, Google Docs, and Gmail in Java Source: https://docs.arcade.dev/en/home/quickstart This Java example demonstrates chaining the same tools: searching news, creating a document, and sending an email. It uses a client object for tool execution and requires user authorization. ```java Map searchResult = authorizeAndRunTool( client, "GoogleNews.SearchNewsStories", Map.of("keywords", "MCP URL mode elicitation"), userId); // Extract the list of news results from the tool output List news = searchResult .getOrDefault("news_results", JsonValue.from(List.of())) .toListOrEmpty(); String output = "latest news about MCP URL mode elicitation:\n" + news.stream() .map(item -> { Map newsItem = item.toMapOrEmpty(); return newsItem.get("source").asStringOrThrow() + " - " + newsItem.get("title").asStringOrThrow() + "\n" + newsItem.get("link").asStringOrThrow() + "\n\n"; }) .collect(Collectors.joining("\n")); // Create a Google Doc with the news results // If the user has not previously authorized the Google Docs tool, they will be prompted to authorize the tool // call. Map createDocResult = authorizeAndRunTool( client, "GoogleDocs.CreateDocumentFromText", Map.of("title", "News about MCP URL mode elicitation", "text_content", output), userId); String googleDocUrl = createDocResult.get("documentUrl").asStringOrThrow(); String emailBody = "You can find the news about MCP URL mode elicitation in the following Google Doc: " + googleDocUrl; Map sendEmailResult = authorizeAndRunTool( client, "Gmail.SendEmail", Map.of("recipient", userId, "subject", "News about MCP URL mode elicitation", "body", emailBody), userId); // Print the response from the tool call logger.info( """ Success! Check your email at {} You just chained 3 tools together: 1. Searched Google News for stories about MCP URL mode elicitation 2. Created a Google Doc with the results 3. Sent yourself an email with the document link Email metadata: {} """, userId, sendEmailResult); ``` -------------------------------- ### Chain Google News, Google Docs, and Gmail in TypeScript Source: https://docs.arcade.dev/en/home/quickstart This example shows how to search for news, create a Google Doc with the results, and email the document link. It requires authorization for each tool used. ```typescript // This tool does not require authorization, so it will return the results // without prompting the user to authorize the app. const response_search = await authorize_and_run_tool({ tool_name: "GoogleNews.SearchNewsStories", input: { keywords: "MCP URL mode elicitation", }, user_id: userId, }); // Get the news results from the response const news = response_search.output?.value?.news_results; // Format the news results into a string let output = "latest news about MCP URL mode elicitation:\n"; for (const search_result of news) { output += "--------------------------------\n"; output += `${search_result.source} - ${search_result.title}\n`; output += `${search_result.link ?? ""}\n`; } // Create a Google Doc with the news results // If the user has not previously authorized the Google Docs tool, they will be prompted to authorize the tool call. const respose_create_doc = await authorize_and_run_tool({ tool_name: "GoogleDocs.CreateDocumentFromText", input: { title: "News about MCP URL mode elicitation", text_content: output, }, user_id: userId, }); const google_doc = respose_create_doc.output?.value; // Send an email with the link to the Google Doc const email_body = `You can find the news about MCP URL mode elicitation in the following Google Doc: ${google_doc.documentUrl}`; // Here again, if the user has not previously authorized the Gmail tool, they will be prompted to authorize the tool call. const respose_send_email = await authorize_and_run_tool({ tool_name: "Gmail.SendEmail", input: { recipient: userId, subject: "News about MCP URL mode elicitation", body: email_body, }, user_id: userId, }); // Print the response from the tool call console.log( `Success! Check your email at ${userId}\n\nYou just chained 3 tools together:\n 1. Searched Google News for stories about MCP URL mode elicitation\n 2. Created a Google Doc with the results\n 3. Sent yourself an email with the document link\n\nEmail metadata:` ); console.log(respose_send_email.output?.value); ``` -------------------------------- ### Run Python script Source: https://docs.arcade.dev/en/home/quickstart This command executes a Python script named 'main.py' using the 'uv' package manager. Ensure 'uv' is installed and 'main.py' is in the current directory. ```bash uv run main.py ``` -------------------------------- ### Run MCP Server with http Transport Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Start the MCP server using the 'http' transport. Access API documentation at http://127.0.0.1:8000/docs. Local HTTP servers do not support tool-level authorization or secrets. ```bash uv run server.py http ``` -------------------------------- ### Create a new uv project Source: https://docs.arcade.dev/en/home/quickstart Use `uv init` to create a new Python project. This command initializes a new project structure and sets up necessary configurations. ```bash mkdir arcade-quickstart cd arcade-quickstart uv init ``` -------------------------------- ### Create and activate a virtual environment Source: https://docs.arcade.dev/en/home/quickstart Create a new virtual environment using `uv venv` to isolate project dependencies. Activate it using the provided commands for Bash/Zsh or PowerShell. ```bash uv venv ``` ```bash source .venv/bin/activate ``` ```powershell . ".venv\Scripts\Activate.ps1" ``` -------------------------------- ### Scaffold a new MCP Server project Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Use the arcade-mcp CLI to create a new MCP Server project named 'my_server' and navigate into its source directory. ```bash arcade new my_server cd my_server/src/my_server ``` -------------------------------- ### Initialize Arcade client in Java Source: https://docs.arcade.dev/en/home/quickstart Initialize the Arcade client in Java using `ArcadeOkHttpClient.builder()`. You can pass the API key directly or use `ArcadeOkHttpClient.fromEnv()` if the key is set as an environment variable. A `userId` is required. ```java // You can also set the `ARCADE_API_KEY` environment variable instead of passing it as a // parameter by using ArcadeOkHttpClient.fromEnv(). ArcadeClient client = ArcadeOkHttpClient.builder().apiKey("{arcade_api_key}").build(); // Arcade needs a unique identifier for your application user (this could be an email address, a UUID, etc). // In this example, use the email you used to sign up for Arcade.dev: String userId = "{arcade_user_id}"; ``` -------------------------------- ### Initialize Arcade client in Python Source: https://docs.arcade.dev/en/home/quickstart Initialize the Arcade client in Python, passing your API key. Alternatively, set the `ARCADE_API_KEY` environment variable. Provide a unique `user_id` for your application user. ```python from arcadepy import Arcade # You can also set the `ARCADE_API_KEY` environment variable instead of passing it as a parameter. client = Arcade(api_key="{arcade_api_key}") # Arcade needs a unique identifier for your application user (this could be an email address, a UUID, etc). # In this example, use the email you used to sign up for Arcade.dev: user_id = "{arcade_user_id}" ``` -------------------------------- ### Authorize and Run Tool in JavaScript Source: https://docs.arcade.dev/en/home/quickstart Helper function to authorize and run any tool. It handles the authorization flow, including prompting the user if necessary, and then executes the tool. ```javascript // Helper function to authorize and run any tool async function authorize_and_run_tool({ tool_name, input, user_id, }: { tool_name: string; input: any; user_id: string; }) { // Start the authorization process const authResponse = await client.tools.authorize({ tool_name: tool_name, user_id: user_id, }); // If the authorization is not completed, print the authorization URL and wait for the user to authorize the app. Tools that do not require authorization will have the status "completed" already. if (authResponse.status !== "completed") { console.log( `Click this link to authorize ${tool_name}: ${authResponse.url}. The process will continue once you have authorized the app.` ); // Wait for the user to authorize the app await client.auth.waitForCompletion(authResponse.id); } // Run the tool const response = await client.tools.execute({ tool_name: tool_name, input: input, user_id: user_id, }); return response; } ``` -------------------------------- ### Authorize and Run Tool in Java Source: https://docs.arcade.dev/en/home/quickstart Java method to authorize and execute a tool. It includes logic to display an authorization URL if needed and handles the tool execution, returning the output as a Map. ```java public static Map authorizeAndRunTool(ArcadeClient client, String toolName, Map input, String userId) { // Start the authorization process AuthorizationResponse authResponse = client.tools().authorize( AuthorizeToolRequest.builder() .toolName(toolName) .userId(userId) .build()); // If the authorization is not completed, print the authorization URL and wait for the user to authorize the app. // Tools that do not require authorization will have the status "completed" already. authResponse .status() .filter(status -> status != AuthorizationResponse.Status.COMPLETED) .flatMap(status -> authResponse.url()) .ifPresent(url -> logger.info( """ Click this link to authorize {}: {}. The process will continue once you have authorized the app. """, toolName, url)); client.auth().waitForCompletion(authResponse); // Execute the tool and extract the output as a Map return client.tools().execute(ExecuteToolRequest.builder() .toolName(toolName) .input(input) .userId(userId) .includeErrorStacktrace(true) .build()) .output() .flatMap(Output::valueAsObject) .orElse(Map.of()); } ``` -------------------------------- ### Authorize and run tool in Python Source: https://docs.arcade.dev/en/home/quickstart This Python helper function checks if a tool requires authorization. If so, it prints the authorization URL and waits for completion. Otherwise, it executes the tool directly. ```python # Helper function to authorize and run any tool def authorize_and_run_tool(tool_name, input, user_id): # Start the authorization process auth_response = client.tools.authorize( tool_name=tool_name, user_id=user_id, ) # If the authorization is not completed, print the authorization URL and wait for the user to authorize the app. # Tools that do not require authorization will have the status "completed" already. if auth_response.status != "completed": print(f"Click this link to authorize {tool_name}:\n{auth_response.url}.\nThe process will continue once you have authorized the app.") client.auth.wait_for_completion(auth_response.id) # Run the tool return client.tools.execute(tool_name=tool_name, input=input, user_id=user_id) ``` -------------------------------- ### Login to Arcade Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Connect your terminal to your Arcade account by running the 'arcade login' command and following the browser instructions. ```bash arcade login ``` -------------------------------- ### Configure Claude Desktop for MCP Server (stdio) Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Configure Claude Desktop to connect to your MCP server using the default 'stdio' transport. ```bash arcade configure claude ``` -------------------------------- ### Configure Cursor IDE for MCP Server (http) Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Configure the Cursor IDE to connect to your MCP server using the 'http' transport. ```bash arcade configure cursor --transport http ``` -------------------------------- ### Run MCP Server with Transport Argument Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server This snippet shows how to run the MCP server, allowing you to specify the transport method (stdio or http) via a command-line argument. The default transport is 'stdio'. ```python if __name__ == "__main__": transport = sys.argv[1] if len(sys.argv) > 1 else "stdio" app.run(transport=transport, host="127.0.0.1", port=8000) ``` -------------------------------- ### Configure Cursor IDE for MCP Server (stdio) Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Configure the Cursor IDE to connect to your MCP server using the default 'stdio' transport. ```bash arcade configure cursor ``` -------------------------------- ### Configure Claude Desktop with HTTP Transport Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Use this command to connect Claude Desktop to your MCP server via the HTTP transport. Ensure your MCP server is running before executing this command. ```bash arcade configure claude --transport http ``` -------------------------------- ### Configure Resource Server Auth in Python Source: https://docs.arcade.dev/en/learn/server-level-vs-tool-level-auth Set up server-level authorization by defining the resource server and its associated authorization servers. This ensures only users with valid tokens can access your MCP server. ```python from arcade_mcp_server import MCPApp from arcade_mcp_server.resource_server import ResourceServerAuth, AuthorizationServerEntry # Configure who can access your MCP server resource_server_auth = ResourceServerAuth( canonical_url="http://127.0.0.1:8000/mcp", authorization_servers=[ AuthorizationServerEntry( authorization_server_url="https://auth.example.com", issuer="https://auth.example.com", jwks_uri="https://auth.example.com/jwks", ) ], ) app = MCPApp(name="my_server", version="1.0.0", auth=resource_server_auth) ``` -------------------------------- ### Set Secret Key in .env File Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Create a .env file at your project root to store sensitive information like API keys. Arcade automatically discovers this file. ```env MY_SECRET_KEY="my-secret-value" ``` -------------------------------- ### Initialize Arcade client in TypeScript Source: https://docs.arcade.dev/en/home/quickstart Initialize the Arcade client in TypeScript, providing your API key within an object. The `userId` should be a unique identifier for your application user. ```typescript import Arcade from "@arcadeai/arcadejs"; // You can also set the `ARCADE_API_KEY` environment variable instead of passing it as a parameter. const client = new Arcade({ apiKey: "{arcade_api_key}", }); // Arcade needs a unique identifier for your application user (this could be an email address, a UUID, etc). // In this example, use the email you used to sign up for Arcade.dev: let userId = "{arcade_user_id}"; ``` -------------------------------- ### Configure VS Code for MCP Server (stdio) Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Configure VS Code to connect to your MCP server using the default 'stdio' transport. ```bash arcade configure vscode ``` -------------------------------- ### Add Arcade Java SDK dependency (Gradle) Source: https://docs.arcade.dev/en/home/quickstart Add the Arcade Java SDK as an implementation dependency in your Gradle project. Replace `${arcade-java-version}` with the latest version. ```groovy implementation("dev.arcade:arcade-java:${arcade-java-version}") ``` -------------------------------- ### Run MCP Server with stdio Transport Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Execute the MCP server using the 'stdio' transport. Note that this transport may not have access to local .env secrets if the server runs in a different environment. ```bash uv run server.py stdio ``` -------------------------------- ### Configure VS Code for MCP Server (http) Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Configure VS Code to connect to your MCP server using the 'http' transport. ```bash arcade configure vscode --transport http ``` -------------------------------- ### Add Arcade Java SDK dependency (Maven) Source: https://docs.arcade.dev/en/home/quickstart Add the Arcade Java SDK as a dependency in your Maven project's `pom.xml`. Ensure you use the correct version for `${arcade-java-version}`. ```xml dev.arcade arcade-java ${arcade-java-version} ``` -------------------------------- ### Define Tool Requiring GitHub Auth Source: https://docs.arcade.dev/en/learn/server-level-vs-tool-level-auth This tool requires GitHub authentication with specific scopes. Arcade provides the OAuth token for the authenticated user in the context. ```python from typing import Annotated import httpx from arcade_mcp_server import Context, MCPApp from arcade_mcp_server.auth import GitHub @app.tool(requires_auth=GitHub(scopes=["repo", "read:user"])) async def create_github_issue( context: Context, repo: Annotated[str, "The repository to create the issue in"], title: Annotated[str, "The title of the issue"], body: Annotated[str, "The body of the issue"], ) -> Annotated[dict, "The created issue"]: """Create a GitHub issue""" # Arcade provides the OAuth token for this user in the context token = context.get_auth_token_or_empty() headers = {"Authorization": f"Bearer {token}"} url = f"https://api.github.com/repos/{repo}/issues" async with httpx.AsyncClient() as client: response = await client.post( url, headers=headers, json={"title": title, "body": body} ) return response.json() if __name__ == "__main__": app.run(transport="stdio") ``` -------------------------------- ### Configure Resource Server Auth for HTTP Transport Source: https://docs.arcade.dev/en/learn/server-level-vs-tool-level-auth Configure Resource Server authentication for an HTTP transport. This secures your MCP server and controls who can call your tools. It requires specifying the canonical URL and details of the authorization servers. ```python from typing import Annotated import httpx from arcade_mcp_server import Context, MCPApp from arcade_mcp_server.auth import GitHub from arcade_mcp_server.resource_server import AuthorizationServerEntry, ResourceServerAuth # Configure who can access your MCP server resource_server_auth = ResourceServerAuth( canonical_url="http://127.0.0.1:8000/mcp", authorization_servers=[ AuthorizationServerEntry( authorization_server_url="https://auth.example.com", issuer="https://auth.example.com", jwks_uri="https://auth.example.com/jwks", ) ], ) app = MCPApp(name="my_server", version="1.0.0", auth=resource_server_auth) # This tool requires GitHub auth @app.tool(requires_auth=GitHub(scopes=["repo", "read:user"])) async def create_github_issue( context: Context, repo: Annotated[str, "The repository to create the issue in"], title: Annotated[str, "The title of the issue"], body: Annotated[str, "The body of the issue"], ) -> Annotated[dict, "The created issue"]: """Create a GitHub issue""" # Arcade provides the OAuth token for this user in the context token = context.get_auth_token_or_empty() headers = {"Authorization": f"Bearer {token}"} url = f"https://api.github.com/repos/{repo}/issues" async with httpx.AsyncClient() as client: response = await client.post( url, headers=headers, json={"title": title, "body": body}, ) return response.json() if __name__ == "__main__": app.run(transport="http") ``` -------------------------------- ### Export Secret Key Environment Variable (Bash/Zsh) Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Set a secret key as an environment variable directly in your terminal using Bash or Zsh. ```bash export MY_SECRET_KEY="my-secret-value" ``` -------------------------------- ### Set Secret Key Environment Variable (PowerShell) Source: https://docs.arcade.dev/en/home/build-tools/create-a-mcp-server Set a secret key as an environment variable directly in your terminal using PowerShell. ```powershell $env:MY_SECRET_KEY="my-secret-value" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.